From 7404f4b4e0bf472d5f161957ff23e30df0e8b96d Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 18 Nov 2021 08:46:17 +0200 Subject: [PATCH 1/6] Improve doc string of 'highlight-nonselected-windows' * src/xdisp.c (syms_of_xdisp) : Clarify the doc string. (Bug#51927) --- src/xdisp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/xdisp.c b/src/xdisp.c index c05e7edbc97..0316408d927 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -35205,7 +35205,9 @@ line number may be omitted from the mode line. */); line_number_display_limit_width = 200; DEFVAR_BOOL ("highlight-nonselected-windows", highlight_nonselected_windows, - doc: /* Non-nil means highlight region even in nonselected windows. */); + doc: /* Non-nil means highlight active region even in nonselected windows. +When nil (the default), the active region is only highlighted when +the window is selected. */); highlight_nonselected_windows = false; DEFVAR_BOOL ("multiple-frames", multiple_frames, From 5eeaf857678d617560efa6a99bb6fd54c0ceddec Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 18 Nov 2021 10:25:58 +0200 Subject: [PATCH 2/6] Improve documentation of window hooks * doc/lispref/windows.texi (Window Hooks): Clarify "buffer-local functions". (Bug#51930) --- doc/lispref/windows.texi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index 57cd2274d4b..a3a37bc60d2 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi @@ -6375,7 +6375,9 @@ changed. @xref{Other Font Lock Variables}. during redisplay provided a significant, non-scrolling change of a window has been detected. For simplicity, these hooks and the functions they call will be collectively referred to as @dfn{window -change functions}. +change functions}. As any hook, these hooks can be set either +globally of buffer-locally via the @var{local} argument of +@code{add-hook} (@pxref{Setting Hooks}) when the hook is installed. @cindex window buffer change The first of these hooks is run after a @dfn{window buffer change} is From 6fc94fb99e38960a24ee3a3dc441f85f786a654e Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Thu, 18 Nov 2021 19:36:42 +0200 Subject: [PATCH 3/6] * lisp/tab-bar.el: Use 'mouse-1' for history buttons like for 'add-tab' button * lisp/tab-bar.el (tab-bar-mouse-down-1, tab-bar-mouse-1): Handle clicks for 'history-back' and 'history-forward' the same way as 'add-tab' clicks. --- lisp/tab-bar.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 871ed1c9817..ca1087e827d 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -284,7 +284,8 @@ existing tab." (setq tab-bar--dragging-in-progress t) ;; Don't close the tab when clicked on the close button. Also ;; don't add new tab on down-mouse. Let `tab-bar-mouse-1' do this. - (unless (or (eq (car item) 'add-tab) (nth 2 item)) + (unless (or (memq (car item) '(add-tab history-back history-forward)) + (nth 2 item)) (if (functionp (nth 1 item)) (call-interactively (nth 1 item)) (unless (eq tab-number t) @@ -298,7 +299,8 @@ regardless of where you click on it. Also add a new tab." (let* ((item (tab-bar--event-to-item (event-start event))) (tab-number (tab-bar--key-to-number (nth 0 item)))) (cond - ((and (eq (car item) 'add-tab) (functionp (nth 1 item))) + ((and (memq (car item) '(add-tab history-back history-forward)) + (functionp (nth 1 item))) (call-interactively (nth 1 item))) ((and (nth 2 item) (not (eq tab-number t))) (tab-bar-close-tab tab-number))))) From bf824843f40a8235e2cdfc6d84d67ea2e2e96acb Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Thu, 18 Nov 2021 19:42:44 +0200 Subject: [PATCH 4/6] * lisp/repeat.el (describe-repeat-maps): Print all bound keys (bug#49265). --- lisp/repeat.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/repeat.el b/lisp/repeat.el index 45201ad1aa6..4dcd353e346 100644 --- a/lisp/repeat.el +++ b/lisp/repeat.el @@ -533,10 +533,12 @@ Used in `repeat-mode'." (dolist (command (sort (cdr keymap) 'string-lessp)) (let* ((info (help-fns--analyze-function command)) (map (list (symbol-value (car keymap)))) - (desc (key-description - (or (where-is-internal command map t) - (where-is-internal (nth 3 info) map t))))) - (princ (format-message " `%s' (bound to '%s')\n" command desc)))) + (desc (mapconcat (lambda (key) + (format-message "`%s'" (key-description key))) + (or (where-is-internal command map) + (where-is-internal (nth 3 info) map)) + ", "))) + (princ (format-message " `%s' (bound to %s)\n" command desc)))) (princ "\n")))))) (provide 'repeat) From 14271d050a30b8121358361ba671ba29493e03dd Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Thu, 18 Nov 2021 20:23:58 +0200 Subject: [PATCH 5/6] Fix flyspell-correct-word selected from context menu opened with the keyboard * lisp/mouse.el (context-menu-open): Call interactively a command returned by `context-menu-map' such as `flyspell-correct-word' (bug#50067). * lisp/textmodes/flyspell.el (flyspell-correct-word): Handle the case when it's called by a key bound to `context-menu-open'. Then it should work the same way as `C-c $' typed on misspelled word where the arg `event' of `flyspell-correct-word-before-point' is nil. --- lisp/mouse.el | 7 +++++-- lisp/textmodes/flyspell.el | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/mouse.el b/lisp/mouse.el index 091383bf110..b6448a13f3a 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -541,8 +541,11 @@ activates the menu whose contents depends on its surrounding context." "Start key navigation of the context menu. This is the keyboard interface to \\[context-menu-map]." (interactive) - (let ((inhibit-mouse-event-check t)) - (popup-menu (context-menu-map) (point)))) + (let ((inhibit-mouse-event-check t) + (map (context-menu-map))) + (if (commandp map) + (call-interactively map) + (popup-menu map (point))))) (global-set-key [S-f10] 'context-menu-open) diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index 1d450b50012..258e5fde674 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el @@ -2160,7 +2160,7 @@ The word checked is the word at the mouse position." (interactive "e") (let ((save (point))) (mouse-set-point event) - (flyspell-correct-word-before-point event save))) + (flyspell-correct-word-before-point (and (consp event) event) save))) (defun flyspell-correct-word-before-point (&optional event opoint) "Pop up a menu of possible corrections for misspelled word before point. From 02853edba795b0d47201977d3b500e8a46ed5e0f Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Thu, 18 Nov 2021 20:36:55 +0200 Subject: [PATCH 6/6] Fix sorting of menus in `context-menu-local' (bug#50067). * lisp/menu-bar.el (menu-bar-keymap): Don't use `lookup-key' on the `keymap' arg. * lisp/mouse.el (context-menu-global): Use `lookup-key global-map' for the `keymap' arg of `menu-bar-keymap'. (context-menu-local): Use `menu-bar-keymap' to sort `keymap'. --- lisp/menu-bar.el | 2 +- lisp/mouse.el | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index f19dc9e7c97..da79aae5295 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -2715,7 +2715,7 @@ could provide `global-map' where items are limited to the global map only." ;; sorting. (push (cons pos menu-item) menu-end) (push menu-item menu-bar)))) - (lookup-key (or keymap (menu-bar-current-active-maps)) [menu-bar])) + (or keymap (lookup-key (menu-bar-current-active-maps) [menu-bar]))) `(keymap ,@(nreverse menu-bar) ,@(mapcar #'cdr (sort menu-end (lambda (a b) diff --git a/lisp/mouse.el b/lisp/mouse.el index b6448a13f3a..0a4ab2878ab 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -364,7 +364,7 @@ Some context functions add menu items below the separator." (when (consp binding) (define-key-after menu (vector key) (copy-sequence binding)))) - (menu-bar-keymap global-map)) + (menu-bar-keymap (lookup-key global-map [menu-bar]))) menu) (defun context-menu-local (menu _click) @@ -377,7 +377,7 @@ Some context functions add menu items below the separator." (when (consp binding) (define-key-after menu (vector key) (copy-sequence binding)))) - keymap))) + (menu-bar-keymap keymap)))) menu) (defun context-menu-minor (menu _click)