Eli Zaretskii [Mon, 14 Dec 2020 18:09:04 +0000 (20:09 +0200)]
Fix point location when completing in gdb-mi.el
* lisp/progmodes/gdb-mi.el (def-gdb-auto-update-handler): Don't
force window-start position, so that redisplay doesn't move point
when popping completion window below the GUD one. (Bug#45052)
Alan Third [Sat, 31 Oct 2020 15:14:34 +0000 (15:14 +0000)]
Fix crash in ns_mouse_position (bug#44313)
* src/nsterm.m (ns_destroy_window): Close the window before freeing
the frame resources so we don't end up accessing the frame struct
after it's been freed.
Alan Third [Sat, 5 Dec 2020 19:40:08 +0000 (19:40 +0000)]
Fix crash when using XRender and restoring image from X (bug#44930)
* src/dispextern.h (struct image): Add original dimension elements.
* src/image.c (image_set_transform): Store the original dimensions.
(image_get_x_image): If we're using transforms use the original
dimensions with XGetImage.
Tassilo Horn [Fri, 11 Dec 2020 09:24:58 +0000 (10:24 +0100)]
Bind k to image-kill-buffer in doc-view-mode-map.
* lisp/doc-view.el (doc-view-mode-map): Bind k to image-kill-buffer.
The binding k -> doc-view-kill-proc-and-buffer has been removed in
2015 and the function been made an obsolete function alias to
image-kill-buffer (bug#45157).
Eli Zaretskii [Mon, 30 Nov 2020 18:44:11 +0000 (20:44 +0200)]
Don't show in 'view-lossage' responses to xterm feature queries
* lisp/term/xterm.el (xterm--read-event-for-query): Prevent
recording the characters read as the xterm response to a query,
so as not to show them in 'view-lossage'. (Bug#44908)
Karl Fogel [Sun, 29 Nov 2020 00:17:46 +0000 (18:17 -0600)]
Save bookmarks by using `write-file' (bug#12507)
Go back to using `write-file' to save bookmarks, instead of using
`write-region'. This means numbered backups of the bookmark file may
get made again, depending on the value of `bookmark-version-control'.
Thanks especially to Drew Adams and Eli Zaretskii for their
persistence in tracking down information relevant to this change.
Eli Zaretskii [Sat, 28 Nov 2020 17:05:18 +0000 (19:05 +0200)]
Fix filing messages when 'rmail-output-reset-deleted-flag' is non-nil
* lisp/mail/rmailout.el (rmail-output): Fix off-by-one error in
deciding when to advance to the next message under non-nil
'rmail-output-reset-deleted-flag'. (Bug#44839)
Eli Zaretskii [Sat, 28 Nov 2020 07:21:33 +0000 (09:21 +0200)]
Revert "Fix incorrect handling of module runtime and environment pointers."
This reverts commit cdc632fbe6e149318147a98cccf1b7af191f2ce8.
Those changes are too significant and non-trivial to be
suitable for a release branch at this time.
Philipp Stephani [Fri, 27 Nov 2020 18:08:55 +0000 (19:08 +0100)]
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.
Instead, turn Vmodule_runtimes and Vmodule_environments into
hashtables keyed by the thread objects. The fix is relatively
localized and should therefore be safe enough for the release branch.
Module assertions now have to walk the pointer list for the current
thread, which is more correct since they now only find environments
for the current thread.
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/emacs-module.c (Fmodule_load, initialize_environment)
(finalize_environment, finalize_runtime_unwind): Store runtime and
environment pointers in per-thread lists.
(syms_of_module): Initialize runtimes and environments hashtables.
(module_assert_runtime, module_assert_env, value_to_lisp): Consider
only objects for the current thread.
(module_gc_hash_table_size, module_hash_push, module_hash_pop): New
generic hashtable helper functions.
(module_objects, module_push_pointer, module_pop_pointer): New helper
functions to main thread-specific lists of runtime and environment
pointers.
(mark_modules): Mark all environments in all threads.
* 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.
Alan Mackenzie [Thu, 26 Nov 2020 11:37:38 +0000 (11:37 +0000)]
CC Mode: Fix error in cache handling. This fixes bug #43481
* lisp/progmodes/cc-engine.el (c-full-pp-to-literal): Handle correctly END
being before HERE by using parse-partial-sexp to get the end of the literal
containing HERE.
Martin Rudalics [Wed, 25 Nov 2020 08:58:21 +0000 (09:58 +0100)]
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.
For discussion, see the following emacs-devel thread:
https://lists.gnu.org/r/emacs-devel/2020-11/msg00734.html
* lisp/custom.el (custom-declare-variable): Delay call to
make-variable-buffer-local until after user option has been
initialized with a value. Otherwise the user option may be
initialized to nil.
* test/lisp/custom-tests.el (custom--test-local-option)
(custom--test-permanent-option): New :local user options.
(custom-test-local-option): New test for defcustom :local keyword.
Michael Albinus [Sat, 21 Nov 2020 15:00:17 +0000 (16:00 +0100)]
Fix Bug#44481
* lisp/net/tramp.el (tramp-system-name): New defconst.
(tramp-default-host, tramp-restricted-shell-hosts-alist)
(tramp-local-host-regexp):
* lisp/net/tramp-sh.el (tramp-maybe-open-connection): Use it. (Bug#44481)
Eli Zaretskii [Sat, 21 Nov 2020 08:14:55 +0000 (10:14 +0200)]
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.
Glenn Morris [Mon, 16 Nov 2020 17:43:40 +0000 (09:43 -0800)]
; * INSTALL: Correct a recent change.
Debian stopped including the major version number in the emacs package
name after version 25, so there is no 'emacs27-dbg' package.
We may as well drop this clause altogether, since Debian stable has
version 26.
No need to merge to master (where this information is in etc/PROBLEMS
in any case).
Alan Mackenzie [Sun, 15 Nov 2020 13:23:15 +0000 (13:23 +0000)]
Make the invocation of combine-change-calls in comment-region valid
This fixes bug #44581. The problem was that whitespace outside of the (BEG
END) region was being deleted, and this made the invocation of
combine-change-calls with (BEG END) invalid.
* lisp/newcomment.el (comment-region-default): Amend the second argument to
combine-change-calls.
Eli Zaretskii [Sat, 14 Nov 2020 13:55:35 +0000 (15:55 +0200)]
Update the various INSTALL files
* nt/INSTALL.W64:
* nt/INSTALL:
* INSTALL: Update the installation information, in particular the
fact that HarfBuzz is now preferred as the shaping library.
Eli Zaretskii [Sat, 14 Nov 2020 13:20:30 +0000 (15:20 +0200)]
Fix input method translation near read-only text
* lisp/international/quail.el (quail-input-method): Don't disable
input method when the character after point has the read-only
property. Suggested by Evgeny Zajcev <lg.zevlg@gmail.com>
(Bug#44466)
* doc/emacs/mule.texi (Input Methods): Document that input methods
are inhibited in read-only text.
Eli Zaretskii [Sat, 14 Nov 2020 11:56:12 +0000 (13:56 +0200)]
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.
Eli Zaretskii [Sat, 14 Nov 2020 11:43:16 +0000 (13:43 +0200)]
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.
Eli Zaretskii [Wed, 11 Nov 2020 19:46:43 +0000 (21:46 +0200)]
Avoid crashes in the daemon due to user interaction
* src/minibuf.c (read_minibuf): Avoid crashes in the daemon if the
init file invokes some kind of minibuffer interaction, by not
updating the selected frame if it's the initial frame.
(Bug#44583)
Fix undefined behavior when fetching glyphs from the display vector.
You can trigger this rather obscure bug by enabling selective display
if the second glyph in its display vector has an invalid face. For
example, evaluate
Eli Zaretskii [Mon, 9 Nov 2020 15:22:25 +0000 (17:22 +0200)]
Avoid breaking Arabic shaping in 'window-text-pixel-size'
* src/xdisp.c (CHAR_COMPOSED_P): If the bidi_p flag is not set,
pass -1 to composition_reseat_it, so that the shaping engine will
figure out the directionality of the text. This is important,
e.g., when using move_it_* functions in some context that is not
redisplay, such as 'window-text-pixel-size'. (Bug#44521)
Kazuhiro Ito [Thu, 5 Nov 2020 10:48:08 +0000 (19:48 +0900)]
Fix 'uudecode-decode-region-internal' in multibyte buffers
* lisp/mail/uudecode.el (uudecode-decode-region-internal): Fix
inserting the decoded string into a multibyte buffer. Optimize by
working with characters, not strings. (Bug#44411)
Martin Rudalics [Sat, 7 Nov 2020 08:20:14 +0000 (09:20 +0100)]
Split windows evenly when 'min-margins' parameter was set (Bug#44483)
* lisp/window.el (split-window): Make new window inherit any
'min-margins' parameter from WINDOW so that horizontal splits
reliably produce windows of same width (Bug#44483).
Stefan Kangas [Tue, 3 Nov 2020 00:35:01 +0000 (01:35 +0100)]
Backport: Fix exiting the finder-commentary buffer
Do not merge to master.
* lisp/finder.el (finder-exit): Fix exiting the finder-commentary
buffer. (Bug#44384)
(finder-buffer): New defconst.
(finder-list-keywords): Use above new defconst.
Eli Zaretskii [Wed, 4 Nov 2020 20:10:06 +0000 (22:10 +0200)]
Prevent redisplay from moving point behind user's back
* src/bidi.c (bidi_at_paragraph_end, bidi_find_paragraph_start):
Bind inhibit-quit to a non-nil value around calls to
fast_looking_at, to prevent breaking out of redisplay_window,
which temporarily moves point in buffers shown in non-selected
windows. (Bug#44448)
Mauro Aranda [Mon, 2 Nov 2020 12:33:55 +0000 (09:33 -0300)]
Document that the :match function for a widget takes an external value
* doc/misc/widget.texi (Basic Types): Document what an external value
is. Document that a :match function expects the value to be in the
external format. (Bug#8717)