Po Lu [Tue, 21 Jun 2022 14:03:42 +0000 (22:03 +0800)]
Rewrite PGTK selection code from scratch
* src/frame.c (delete_frame): Clear selections and swallow
special events.
* src/keyboard.c (kbd_buffer_get_event, process_special_events):
Also handle selection events on PGTK.
* src/keyboard.h (union buffered_input_event): Include selection
events on PGTK.
* src/pgtkselect.c (symbol_to_gtk_clipboard, LOCAL_SELECTION):
New functions and macros.
(selection_type_to_quarks, get_func, clear_func): Delete
functions.
(pgtk_selection_init, pgtk_selection_lost):
(pgtk_selection_usable): New functions.
(Fpgtk_own_selection_internal, Fpgtk_disown_selection_internal)
(Fpgtk_selection_exists_p, Fpgtk_selection_owner_p)
(Fpgtk_get_selection_internal): Complete rewrite.
(syms_of_pgtkselect): Update defsyms and add more hooks.
* src/pgtkselect.h: Delete file.
* src/pgtkterm.c (evq_enqueue): Set last user time based on the
event.
(pgtk_any_window_to_frame, button_event): Fix coding style.
(pgtk_set_event_handler): Add selection events.
(pgtk_find_selection_owner, pgtk_selection_event): New
functions.
(pgtk_term_init): Remove call to `pgtk_selection_init'.
* src/pgtkterm.h (struct pgtk_display_info): New field
`display'.
(enum selection_input_event): New struct. New macros for
accessing its fields.
Stefan Kangas [Tue, 21 Jun 2022 12:27:51 +0000 (14:27 +0200)]
Allow shortening filenames in recentf-mode menu
* lisp/recentf.el (recentf-show-abbreviated): New function.
(recentf--filter-names): New helper function.
(recentf-show-basenames): Use above new helper function.
(recentf-menu-filter): Allow setting user option to new value
'recentf-show-abbreviated'.
* lisp/mail/mail-extr.el (mail-extract-address-components):
(mail-extract-address-components): The buffer is already in
fundamental-mode, so don't re-enable it (bug#56113).
Po Lu [Tue, 21 Jun 2022 05:04:24 +0000 (05:04 +0000)]
Allow toggling antialiasing inside the Haiku font dialog
* src/haiku_support.cc (struct font_selection_dialog_message):
New field `disable_antialias'.
(MessageReceived): Handle new message SET_DISABLE_ANTIALIASING.
(class DualLayoutView): Rename to `TripleLayoutView'.
(class TripleLayoutView): Rename from `DualLayoutView'.
(MinSize): Update computations for three views.
(class EmacsFontSelectionDialog, UpdatePreview)
(EmacsFontSelectionDialog): Add an antialiasing checkbox to
control antialiasing.
(be_select_font): New arguments `initial_antialias' and
`disable_antialias'.
* src/haiku_support.h: Update prototypes.
* src/haikufont.c (haikufont_pattern_from_object): Set
FSPEC_ANTIALIAS.
(Fx_select_font): Update accordingly.
Po Lu [Tue, 21 Jun 2022 01:52:47 +0000 (09:52 +0800)]
Remove selection requests on the keyboard buffer when closing display
* src/xterm.c (X_NEXT_KBD_EVENT): New macro.
(x_defer_selection_requests): Set input_pending if the kbd
buffer was modified.
(x_delete_selection_requests): New function.
(x_delete_display): Call that. Bug found when a display died
while the clipboard manager was sending an unreasonably high
number of requests.
Po Lu [Tue, 21 Jun 2022 01:35:07 +0000 (09:35 +0800)]
Move selection delayed message to a better location
* lisp/term/x-win.el (gui-backend-get-selection): Remove
`with-delayed-message' here.
* src/xselect.c (x_display_selection_waiting_message)
(x_cancel_atimer): New functions.
(x_get_foreign_selection): Add an atimer that displays the
message after a while.
Alan Mackenzie [Mon, 20 Jun 2022 18:31:05 +0000 (18:31 +0000)]
Fix potential (goto-char nil) in byte-compile-warning-prefix
* lisp/emacs-lisp/bytecomp.el (byte-compile-warning-prefix): Replace a wrong
'or' form involving OFFSET with simply OFFSET. This prevents OFFSET from
possibly being nil in the first branch of the containing `if' form.
Eli Zaretskii [Mon, 20 Jun 2022 16:04:06 +0000 (19:04 +0300)]
Support builds configured with a separate --bindir
* src/emacs.c (load_pdump): Don't overwrite the leading
directories of the Emacs executable just because the pdumper file
was not found in the expected directory relative to the binary.
This is needed to support builds with a separate --bindir
configure-time option and native-compilation. (Bug#55741)
Po Lu [Mon, 20 Jun 2022 10:57:17 +0000 (10:57 +0000)]
Fix initialization of Haiku font driver
* src/font.c (register_font_driver): Fix comment.
* src/haikufont.c (haikufont_booleans): New list.
(haikufont_filter_properties): New function.
(haikufont_driver): Register new hook.
(syms_of_haikufont_for_pdumper): Register font driver globally.
(syms_of_haikufont): Call it in a pdumper hook.
Richard Hansen [Mon, 20 Jun 2022 07:40:38 +0000 (09:40 +0200)]
whitespace: Redraw if indentation or line length changes
* lisp/whitespace.el (whitespace-color-on): Convert the indentation
matcher from a static regular expression to a function so that changes
to `indent-tabs-mode' and `tab-width' are picked up the next time
`font-lock-flush' runs.
(whitespace--indentation-matcher): The new function matcher.
(whitespace--variable-watcher): New variable watcher that calls
`font-lock-flush' if `whitespace-mode' is enabled for the buffer.
(whitespace--watched-vars): List of variables to watch.
(whitespace-unload-function): Un-watch the variables. (bug#56103).
Make M-S-x output better in mode that have bindings for `undefined'
* lisp/simple.el (command-completion-using-modes-p): Speed up case
when there's no command modes.
(execute-extended-command-for-buffer): Make M-S-x output better
(bug#46665).
Po Lu [Sun, 19 Jun 2022 12:56:46 +0000 (20:56 +0800)]
Fix setting last user time during drag-and-drop
* src/xterm.c (handle_one_xevent): Set the last user time if a
button press happens during drag and drop. Mysterious problems
were other seen with sending selections to a clipboard
immediately afterwards on Irix 6.5.
Stefan Kangas [Sun, 19 Jun 2022 11:16:19 +0000 (13:16 +0200)]
Add rudimentary font-locking to edmacro-mode
* lisp/edmacro.el (edmacro-label): New face.
(edmacro-mode-font-lock-keywords): New variable.
(edit-kbd-macro): Use font-lock in 'edmacro-mode'. Minor
improvement to command substitution.
* lisp/vc/ediff-wind.el (ediff-refresh-mode-lines): Decide whether to
display "Quick Help" in the mode-line based on the value of
`ediff-use-long-help-message' instead of checking
`ediff-window-setup-function' (Bug#12840).
Add mechanism for gradually phasing in new byte compilation warnings
* lisp/Makefile.in (BYTE_COMPILE_FLAGS): Enable all byte
compilation warnings.
* lisp/emacs-lisp/bytecomp.el (byte-compile-warning-types): Add
docstrings-non-ascii-quotes and document new semantics for `all'
and t.
(byte-compile--emacs-build-warning-types): New constant.
(byte-compile-warning-enabled-p): Implement the new semantics.
(byte-compile-docstring-style-warn): Reinstate the Unicode quote
warning.
Po Lu [Sun, 19 Jun 2022 04:22:12 +0000 (12:22 +0800)]
Fix XDND from Firefox again
* lisp/x-dnd.el (x-dnd-handle-xdnd): Prevent nil from appearing
in format 32 list.
(x-dnd-handle-motif): Send reply if the user quit out of the
drop handler as well.
Po Lu [Sun, 19 Jun 2022 03:35:12 +0000 (11:35 +0800)]
Cache the Motif drag window to avoid fetching it every time
* src/xterm.c (xm_get_drag_window_1): New function.
(xm_get_drag_window): Cache the window. If it already exists,
just return it.
(xm_setup_dnd_targets): If a BadWindow error occurs, re-create
the Motif drag window.
* src/xterm.h (struct x_display_info): New field
`motif_drag_window'.
Po Lu [Sun, 19 Jun 2022 02:31:33 +0000 (10:31 +0800)]
Fix timestamps recorded in Motif DND top level leave messages
* src/xterm.c (xm_send_top_level_leave_message): Use X_SHRT_MAX
since Motif treats x and y as signed.
(handle_one_xevent): Use correct time for lmsg.timestamp sent in
response to entering the return-frame.
Stefan Kangas [Sat, 18 Jun 2022 14:01:45 +0000 (16:01 +0200)]
Respect no-face argument in literal key substitutions
* lisp/help.el (substitute-command-keys): Respect 'no-face' argument
also in literal key substitutions.
* test/lisp/help-tests.el
(help-tests-substitute-key-bindings/help-key-binding-face): Rename
from help-tests-substitute-key-bindings/face-help-key-binding.
(help-tests-substitute-key-bindings/help-key-binding-no-face): New test.
* lisp/frame.el (tty-select-active-regions): Pacify warning about
missing defcustom :group by specifying the same group as
select-active-regions, as well as the frames group.
* src/keyboard.c (command_loop_1, syms_of_keyboard): Rename last
occurrences of xterm-select-active-regions to
tty-select-active-regions (bug#55883).
Alan Mackenzie [Sat, 18 Jun 2022 16:41:57 +0000 (16:41 +0000)]
CC Mode: Add accurate handling for backslash in C line and block comments
This is needed to handle the idiosyncratic meaning of backslash in comments in
the C and C++ standards.
* lisp/progmodes/cc-engine.el: Correct a spelling error.
* lisp/progmodes/cc-mode.el (c-before-change-fix-comment-escapes)
(c-after-change-fix-comment-escapes): New functions.
* lisp/progmodes/cc-langs.el (c-get-state-before-change-functions): Add
c-before-change-fix-comment-escapes to the C/Objc and C++ values.
(c-before-font-lock-functions): Add c-after-change-fix-comment-escapes to the
C/Objc and C++ values.
Eli Zaretskii [Sat, 18 Jun 2022 16:21:21 +0000 (19:21 +0300)]
Fix test failures due to 'xterm-select-active-regions'
* lisp/frame.el (tty-select-active-regions): Rename from
xterm-select-active-regions and move here from xterm.c.
(display-selections-p): Adjust to the above. (Bug#55883)
More aggressive bytecode split between top-level forms (bug#55972)
* lisp/emacs-lisp/bytecomp.el (byte-compile-keep-pending):
Allow bytecode split between all kinds of top-level forms, not just
those with chunk handlers, to prevent individual chunks from growing
too large. In particular this helps compilation of
package-quickstart.el.
Richard Hansen [Sat, 18 Jun 2022 12:11:01 +0000 (14:11 +0200)]
Fix invalid defcustom :group when :predicate is used
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix
invalid `:group' argument for the `-modes' defcustom that is created
when `:predicate' is used (bug#56049).
Alan Mackenzie [Sat, 18 Jun 2022 11:23:06 +0000 (11:23 +0000)]
CC Mode: Fix infinite loop in noise macro near end of buffer
This fixes bug #55771. Also fix an inaccuracy in c-defun-name-1 with the same
cause.
* lisp/progmodes/cc-cmds.el (c-defun-name-1)
* lisp/progmodes/cc-engine.el (c-forward-noise-clause): Check the return
value of c-forward-token-2 and act upon it when not zero.
Duncan Findlay [Sat, 11 Jun 2022 01:46:49 +0000 (18:46 -0700)]
Support `select-active-regions' with xterm
This allows Emacs to save the active region to the user's
primary selection on supported terminals. The behavior follows
the existing `select-active-regions' variable and requires
`xterm-select-active-regions' to be non-nil.
* src/keyboard.c (command_loop_1):
* lisp/frame.el (display-selections-p): On text terminals, check
terminal parameter `xterm--set-selections' and variable
`xterm-select-active-regions' when deciding whether to update
primary selection. (bug#55883)
* lisp/term/xterm.el (xterm-select-active-regions): New
defcustom.
Constructs such as ?\C-^@ or ?\C-\C-m literally apply a Control
modifier twice which doesn't make sense at all. What is really meant
is a C0 base character with the Control modifier bit set.
This change is only stylistic in nature.
* lisp/edmacro.el (edmacro-format-keys):
* lisp/keymap.el (key-parse):
* lisp/subr.el (event-modifiers, event-basic-type):
* test/lisp/subr-tests.el (subr-test-kbd):
Use \0 and \r instead of ^@ and \C-m to represent NUL and RET
when combined with other modifiers.