1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-31 04:41:23 -08:00
Commit graph

43379 commits

Author SHA1 Message Date
Andrea Corallo
39bdb3f6f5 Vanilla build warning clean-up
* lisp/emacs-lisp/disass.el (native-comp-unit-file)
	(subr-native-comp-unit): Declare function.
	* lisp/progmodes/elisp-mode.el (native-compile): Likewise.
	* lisp/emacs-lisp/package.el (comp-el-to-eln-filename): Likewise.
	* lisp/startup.el (normal-top-level): Silence warning.
	* src/data.c (syms_of_data): 'Ssubr_native_lambda_list' is always
	defined.
	* src/pdumper.c (dump_cold_native_subr): Move under ifdefs.
	(dump_drain_cold_data): Add ifdefs.
2020-12-04 23:21:15 +01:00
Andrea Corallo
dcfd367d28 * Fix `load-history' causing a number of spurious compiler warnings
* src/comp.c (Fcomp__register_subr): Fix missing entry into
	`load-history' indicating that the loaded function was already an
	autoload.
2020-12-04 23:21:08 +01:00
Andrea Corallo
981240078c * Reduce (half) the number of loads emitted for calling into C code
As after each function call GCC clobbers the pointer to the function
relocation table.  This commit modify the code generation to create a
local copy of it for each function.  This reduces the average number
of loads for each function call into C from two to one.

	* src/comp.c (comp_t): Add 'func_relocs_ptr_type' and
	'func_relocs_local' fields.
	(emit_call): Use the local func_relocs pointer when possible.
	(emit_ctxt_code): Fill 'comp.func_relocs_ptr_type'.
	(compile_function): Declare 'func_relocs_ptr_local'.
	(compile_function): Assign 'func_relocs_ptr_local' from the global
	value in each function prologue.
2020-12-04 00:40:30 +01:00
Andrea Corallo
6523b84015 Merge remote-tracking branch 'savannah/master' into HEAD 2020-11-29 15:11:38 +01:00
Lars Ingebrigtsen
bb0e6fb886 frame-position doc string clarificaton
* src/frame.c (Fframe_position): Mention that the values are
system-dependent (bug#32977).
2020-11-29 11:10:42 +01:00
Lars Ingebrigtsen
70c8ed55fd garbage-collect doc string clarification
* src/alloc.c (Fgarbage_collect): Mention that calling this
function is not guaranteed to collect all the garbage (bug#34404).
2020-11-29 11:05:10 +01:00
Andrea Corallo
e2ff5d9605 * Synthesize as const primitive function pointers and its container struct.
* src/comp.c (declare_imported_func): Make const function pointer
	to primitive funcions.
	(emit_ctxt_code): Make struct 'comp.func_relocs' const.
2020-11-27 22:59:50 +01:00
Mattias Engdegård
a7825c4be0 Use correct glyph in title when resizing NS frames
* src/nsterm.m ([EmacsView windowWillResize:toSize:]): Use ×, not x.
2020-11-27 21:17:58 +01:00
Philipp Stephani
23974cfa48 Fix incorrect handling of module runtime and environment pointers.
We used to store module runtime and environment pointers in the static
lists Vmodule_runtimes and Vmodule_environments.  However, this is
incorrect because these objects have to be kept per-thread.  With this
naive approach, interleaving module function calls in separate threads
leads to environments being removed in the wrong order, which in turn
can cause local module values to be incorrectly garbage-collected.
The fix isn't completely trivial: specbinding the lists wouldn't work
either, because then the garbage collector wouldn't find the
environments in other threads than the current ones, again leading to
objects being garbage-collected incorrectly.  While introducing custom
pseudovector types would fix this, it's simpler to put the runtime and
environment pointers into the specbinding list as new specbinding
kinds.  This works since we need to unwind them anyway, and we only
ever treat the lists as a stack.  The thread switching machinery
ensures that the specbinding lists are thread-local, and that all
elements of the specbinding lists in all threads are marked during
garbage collection.

Module assertions now have to walk the specbinding list for the
current thread, which is more correct since they now only find
environments for the current thread.  As a result, we can now remove
the faulty Vmodule_runtimes and Vmodule_environments variables
entirely.

Also add a unit test that exemplifies the problem.  It interleaves two
module calls in two threads so that the first call ends while the
second one is still active.  Without this change, this test triggers
an assertion failure.

* src/lisp.h (enum specbind_tag): Add new tags for module runtimes and
environments.

* src/eval.c (record_unwind_protect_module): New function to record a
module object in the specpdl list.
(do_one_unbind): Unwind module objects.
(backtrace_eval_unrewind, default_toplevel_binding, lexbound_p)
(Fbacktrace__locals): Deal with new specbinding types.
(mark_specpdl): Mark module environments as needed.

* src/alloc.c (garbage_collect): Remove call to 'mark-modules'.
Garbage collection of module values is now handled as part of marking
the specpdl of each thread.

* src/emacs-module.c (Fmodule_load, funcall_module): Use specpdl to
record module runtimes and environments.
(module_assert_runtime, module_assert_env, value_to_lisp): Walk
through specpdl list instead of list variables.
(mark_module_environment): Rename from 'mark_modules'.  Don't attempt
to walk though current thread's environments only, since that would
miss other threads.
(initialize_environment, finalize_environment): Don't change
Vmodule_environments variable; environments are now in the specpdl
list.
(finalize_environment_unwind, finalize_runtime_unwind): Make 'extern'
since do_one_unbind now calls them.
(finalize_runtime_unwind): Don't change Vmodule_runtimes variable;
runtimes are now in the specpdl list.
(syms_of_module): Remove Vmodule_runtimes and Vmodule_environments.

* test/data/emacs-module/mod-test.c (Fmod_test_funcall): New test
function.
(emacs_module_init): Bind it.

* test/src/emacs-module-tests.el (emacs-module-tests--variable): New
helper type to guard access to state in a thread-safe way.
(emacs-module-tests--wait-for-variable)
(emacs-module-tests--change-variable): New helper functions.
(emacs-module-tests/interleaved-threads): New unit test.
2020-11-27 20:15:33 +01:00
Philipp Stephani
e742368920 ; * src/lisp.h (enum specbind_tag): Fix typo. 2020-11-27 20:04:20 +01:00
Mattias Engdegård
558b6dbca7 Fix replace-regexp-in-string substring match data translation
For certain patterns, re-matching the same regexp on the matched
substring does not produce correctly translated match data
(bug#15107 and bug#44861).

Using a new builtin function also improves performance since the
number of calls to string-match is halved.

Reported by Kevin Ryde and Shigeru Fukaya.

* lisp/subr.el (replace-regexp-in-string): Translate the match data
using match-data--translate instead of trusting a call to string-match
on the matched string to do the job.
* test/lisp/subr-tests.el (subr-replace-regexp-in-string):
Add test cases.
* src/search.c (Fmatch_data__translate): New internal function.
(syms_of_search): Register it as a subroutine.
2020-11-26 14:20:13 +01:00
Stefan Monnier
1eb168fa97 (defvar): Detect defining a variable currently lexically bound
* src/eval.c (lexbound_p): New function.
(Finternal__define_uninitialized_variable): Use it.
2020-11-25 14:49:55 -05:00
Michael Albinus
e45ad6b08e Merge from origin/emacs-27
6442cdc0e4 Revert extra focus redirection in do_switch_frame (Bug#24803)
fc4379f1ae Minor cleanup of tramp-tests.el on MS Windows
dea3d6aa18 Fix handling of defcustom :local tag
2020-11-25 12:18:23 +01:00
Michael Albinus
ba004ac7dd Merge from origin/emacs-27
f425a774c2 Fix display artifacts when 'display' properties cover newl...
2020-11-25 11:49:54 +01:00
Martin Rudalics
6442cdc0e4 Revert extra focus redirection in do_switch_frame (Bug#24803)
* src/frame.c (do_switch_frame): Do not also redirect frame
focus when FRAME has its minibuffer window on the selected
frame which was intended to fix Bug#24500.  It may cause
Bug#24803 and lead to a nasty state where no active cursor is
shown on any frame, see
https://lists.gnu.org/archive/html/emacs-devel/2020-11/msg01137.html.
2020-11-25 09:58:21 +01:00
Eli Zaretskii
f425a774c2 Fix display artifacts when 'display' properties cover newlines
* src/xdisp.c (pos_visible_p): Set glyph_row of scratch iterators
to NULL, to avoid producing glyphs while we figure out the layout.
(Bug#44826)
2020-11-24 17:04:37 +02:00
Itai Seggev
868f51324a Codesign the executable on recene MacOS systems
* src/Makefile.in (temacs$(EXEEXT)): Codesign the executable on
recent (ARM) MacOS systems (bug#43878).  Without this, building
Emacs fails.

Copyright-paperwork-exempt: yes
2020-11-24 06:52:27 +01:00
Glenn Morris
be17ee78c6 Merge from origin/emacs-27
86cbc9d216 Make ignoring modifiers on IME input optional
32b97bb9e0 Ignore modifiers when processing WM_IME_CHAR messages
f641ef1a07 Improve documentation of 'font-spec'

# Conflicts:
#	etc/NEWS
2020-11-23 09:41:53 -08:00
Alan Mackenzie
c3edaa5524 minibuffer code: restore original frame after using minibuffer-only frame, etc
* src/minibuf.c (read_minibuf): In the record_unwind_protect for the second
restore_window_configuration (separate minibuffer frame case) arrange for the
future switching back to the original frame by Fset_window_configuration.
2020-11-23 15:54:50 +00:00
Philipp Stephani
edd949a3eb Unbreak compilation with CHECK_STRUCTS.
Commit 3963aea4f4 modified the ‘buffer’
structure, but didn’t adapt the hash.

* src/pdumper.c (dump_buffer): Update buffer hash.
2020-11-22 23:22:50 +01:00
Andrea Corallo
033e96055c Merge remote-tracking branch 'savannah/master' into HEAD 2020-11-22 22:23:16 +01:00
Stefan Kangas
fb9326b45c Say which command shadows a key binding
* src/keymap.c (describe_vector): Say which command shadows this
binding.  (Bug#9293)
* test/src/keymap-tests.el
(help--describe-vector/bug-9293-one-shadowed-in-range): Adapt
test.
2020-11-22 02:48:53 +01:00
Stefan Kangas
84dd5c9bea Don't shadow bindings by the same command
* src/keymap.c (describe_vector): Do not say binding is shadowed if
the other key binding points to the same command.  (Bug#9293)
* test/src/keymap-tests.el
(help--describe-vector/bug-9293-same-command-does-not-shadow): New
test.
2020-11-22 02:45:03 +01:00
Stefan Kangas
a649034336 Don't show key ranges if shadowed by different commands
* src/keymap.c (describe_vector): Make sure found consecutive keys
are either not shadowed or, if they are, that they are shadowed by
the same command.  (Bug#9293)
* test/src/keymap-tests.el
(help--describe-vector/bug-9293-one-shadowed-in-range): New test.
2020-11-22 02:45:03 +01:00
Jared Finder
2c7687738d Migrate usage of GPM_CLICK_EVENT to MOUSE_CLICK_EVENT.
* src/termhooks.h (enum event_kind):
* src/term.c (term_mouse_click, handle_one_term_event):
* src/keyboard.c (discard_mouse_events, make_lispy_event): Migrate
usage of GPM_CLICK_EVENT to MOUSE_CLICK_EVENT.
2020-11-21 10:20:05 +02:00
Eli Zaretskii
86cbc9d216 Make ignoring modifiers on IME input optional
By default, ignore modifier keys on IME input, but add
a variable to get back old behavior.
* src/w32fns.c (syms_of_w32fns): New variable
w32-ignore-modifiers-on-IME-input.
(w32_wnd_proc): Use it to ignore modifier keys when IME input is
used.  (Bug#44641)

* etc/NEWS: Announce the change and the new variable.
2020-11-21 10:14:55 +02:00
Masahiro Nakamura
32b97bb9e0 Ignore modifiers when processing WM_IME_CHAR messages
* src/w32fns.c (w32_wnd_proc): Ignore modifiers when processing
WM_IME_CHAR messages.
2020-11-21 09:50:22 +02:00
Stefan Kangas
6781cd670d Make load argument of native-compile-async internal
* lisp/emacs-lisp/comp.el (native--compile-async): New defun extracted
from native-compile-async.
(native-compile-async): Remove load argument and use above new defun.
* src/comp.c (maybe_defer_native_compilation): Use above new
defun.  (Bug#44676)
2020-11-21 04:22:59 +01:00
Stefan Kangas
cf436db285 ; Fix trivial typos 2020-11-20 20:35:44 +01:00
Eli Zaretskii
88adf1f0dd Fix compilation on MS-Windows with librsvg > 2.46.0
* src/image.c (rsvg_handle_get_dimensions, init_svg_functions):
Make 'rsvg_handle_get_dimensions' available and defined for all
versions of librsvg.  (Bug#44655)
2020-11-20 17:00:36 +02:00
Lars Ingebrigtsen
bc951000b3 Avoid a compilation warning about an ambiguous else
* src/data.c (set_internal): Avoid compilation warning.

data.c:1443:9: error: suggest explicit braces to avoid ambiguous ‘else’
 1443 |      if (idx > 0 && bindflag == SET_INTERNAL_SET
      |         ^
2020-11-20 00:19:18 +01:00
Stefan Monnier
8fac244464 * src/data.c (set_internal): Fix bug#44733
Set the default value when `set` encounters a PER_BUFFER variable
which has been let-bound globally, to match the behavior seen with
`make-variable-buffer-local`.

* test/src/data-tests.el (binding-test--let-buffer-local):
Add corresponding test.
(data-tests--set-default-per-buffer): Add tentative test for the
performance problem encountered in bug#41029.
2020-11-19 17:13:04 -05:00
Eli Zaretskii
f641ef1a07 Improve documentation of 'font-spec'
* doc/lispref/display.texi (Low-Level Font):
* src/font.c (Ffont_spec): Document 'font-spec' keys that are
supported, but were undocumented.
2020-11-19 22:06:23 +02:00
Stefan Monnier
3963aea4f4 * src/buffer.h (struct buffer): Remove unused field minor_modes
* src/buffer.c (bset_minor_modes): Remove function.
(reset_buffer_local_variables, init_buffer_once): Don't set `minor_modes`.
2020-11-19 13:10:40 -05:00
Mattias Engdegård
90aab73f8d More string-search optimisations
All-ASCII strings cannot have substrings with non-ASCII characters in
them; use this fact to avoid searching entirely.

* src/fns.c (Fstring_search): For multibyte non-ASCII needle and
unibyte haystack, don't check if the haystack is all-ASCII; it's a
waste of time. For multibyte non-ASCII needle and multibyte
all-ASCII haystack, fail immediately.
* test/src/fns-tests.el (string-search): Add more test cases.
2020-11-19 14:58:48 +01:00
Alan Mackenzie
6e469709c5 In attempted recursive minibuffer use, display error message in correct frame
This was problematic when minibuffer-follows-selected-frame was non-nil.
Introduce a new parameter DONT-SET-FRAME to set-window-configuration.

* doc/lispref/windows.texi (Window Configurations): Describe the new &optional
parameter to set-window-configuration.

* etc/NEWS (Lisp Changes): Note the new parameter to set-window-configuration.

* src/keyboard.c (read_char_help_form_unwind): Add a new Qnil argument to the
call of Fset_window_configuration.

* src/minibuf.c (read_minibuf): Cons up a Qt with the window configuration in
the argument to record_unwind_protect for the window configuration (twice).

* src/window.c (Fset_window_configuration): Add the new &optional parameter
and document it in the doc string.  At the final do_switch_frame operation,
restore the original frame when DONT-SET-FRAME is non-nil.
(restore_window_configuration): Handle the new parameter when the supplied
argument is a cons.
2020-11-19 10:31:50 +00:00
Alan Third
ca8e37eaf6 Fix SVG display again (bug#44655)
* src/image.c (svg_load_image): Fall back to
rsvg_handle_get_dimensions if we can't calculate the size of the
image.
2020-11-18 23:07:57 +00:00
Andrea Corallo
3ae309bd59 * Fix eln file hasing for symlink paths (bug#44701)
* src/comp.c (Fcomp_el_to_eln_filename): Call `file-truename'
	in place of `expand-file-name' when available.
2020-11-18 18:34:04 +01:00
Glenn Morris
a280a6d7ca Merge from origin/emacs-27
19da602991 Fix input method translation near read-only text
5aabf2cc7f Fix display of truncated R2L lines on TTY frames
daff3bda10 Avoid crashes when a reversed glyph row starts with a comp...
b697bb91a1 ; * .gitignore: src/fingerprint.c not generated since 2019...
2020-11-16 08:59:47 -08:00
Stefan Kangas
cee6401c13 Various doc fixes for comp.el and comp.c
* lisp/emacs-lisp/comp.el: Remove redundant :group args.
(comp-async-cu-done-hook, comp-async-all-done-hook)
(comp-async-env-modifier-form, comp-dry-run)
(comp-ensure-native-compiler, comp-func-ret-typeset)
(comp-func-ret-range, comp-limple-lock-keywords)
(comp-make-curr-block):
* src/comp.c (Fcomp_el_to_eln_filename, Fcomp__init_ctxt)
(Fcomp_native_driver_options_effective_p)
(Fcomp__compile_ctxt_to_file, Fcomp_libgccjit_version)
(Fcomp__register_lambda, Fcomp__register_subr)
(Fcomp__late_register_subr, Fnative_elisp_load, syms_of_comp): Doc fixes.
2020-11-16 16:06:47 +01:00
Stefan Kangas
36431e1679 Make initial frame match frame-title-format
* src/xterm.c (x_term_init):
* src/w32term.c (w32_initialize_display_info): Sync initial frame
title with new value of Vframe_title_format.
Problem reported by Angelo Graziosi <angelo.g0@libero.it>.
2020-11-15 02:41:36 +01:00
Andrea Corallo
2a8bf2222d Merge remote-tracking branch 'savannah/master' into dev 2020-11-14 22:07:54 +01:00
Andrea Corallo
3d14a74f8f * Fix debug symbol emission
* src/comp.c (Fcomp__compile_ctxt_to_file): Now that we do not
	rely anymore on globlal variables move logic in from
	'Fcomp__init_ctxt' so comp.debug is already set correctly.
2020-11-14 22:06:31 +01:00
Akira Kyle
e71f5f1fd1 Work around glib messing with signal handlers more than it should
* src/process.c (init_process_emacs): force glib's g_unix_signal
handler into lib_child_handler where it should belong.

Copyright-paperwork-exempt: yes
2020-11-14 16:39:41 +01:00
Eli Zaretskii
e2c7b6372d Don't leave lock files after 'replace-buffer-contents'
* src/editfns.c (Freplace_buffer_contents): Unlock the buffer's
file if no changes have been made.  (Bug#44303)

(cherry picked from commit a5867ddfbd)
2020-11-14 15:24:15 +02:00
Eli Zaretskii
206445a703 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs 2020-11-14 14:36:34 +02:00
Philipp Stephani
b13e87c35b Capitalize portable dump messages.
We capitalize all other messages during the dump, so capitalize the
"dump mode" and "dumping fingerprint" ones as well for consistency.

* src/pdumper.c (Fdump_emacs_portable): Capitalize fingerprint message
prefix.

* lisp/loadup.el: Capitalize "dump mode" message.
2020-11-14 13:33:07 +01:00
Jared Finder
91d5edd9d1 Face-changing text properties and help-echo now work with xterm-mouse.
* src/dispnew.c (update_mouse_position): New function for mouse
movement logic in 'handle_one_term_event' that can be shared across
different mouse backends.
(display--update-for-mouse-movement): New lisp function, call it.
* lisp/xt-mouse.el (xterm-mouse--handle-mouse-movement): New function
that calls 'display--update-for-mouse-movement'.
(xterm-mouse-translate-1): Call it.
* src/term.c (handle_one_term_event): Inline logic from
'term_mouse_movement' and call 'update_mouse_position'.
(term_mouse_movement): Delete.
2020-11-14 14:31:55 +02:00
Eli Zaretskii
5aabf2cc7f Fix display of truncated R2L lines on TTY frames
* src/xdisp.c (extend_face_to_end_of_line): Use a while-loop, not
a do-while loop, to avoid appending an extra glyph at the end of a
line that is one character shorter than the window-width.  This is
needed to fix display of reversed glyph rows that are almost as
wide as the window, because append_space_for_newline already added
one space glyph.
2020-11-14 13:56:12 +02:00
Eli Zaretskii
daff3bda10 Avoid crashes when a reversed glyph row starts with a composition
* src/dispnew.c (build_frame_matrix_from_leaf_window): Add an
assertion to prevent us from overwriting non-char glyphs with the
vertical border glyph.
* src/xdisp.c (extend_face_to_end_of_line): Account for one glyph
possibly inserted by append_space_for_newline.  (Bug#44506)
Remove a kludgey correction for an off-by-one error in column
counting, which is no longer needed.
2020-11-14 13:43:16 +02:00