commit 8c5d69998e65d3ecf5f599bd828bf3330f4f118a (HEAD, refs/remotes/origin/master) Author: Eli Zaretskii Date: Sun Oct 6 20:56:09 2024 +0300 ; Fix last change * lisp/tmm.el (tmm-prompt): * etc/NEWS: Fix last change. diff --git a/etc/NEWS b/etc/NEWS index 935caba5c0d..b532d7c6555 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -497,7 +497,7 @@ instead. ** Tmm Menubar --- -*** Add a shortcut to navigate to previous menu +*** A new shortcut to navigate to previous menu. The hardcoded "^" shortcut gets you back to the previous menu. diff --git a/lisp/tmm.el b/lisp/tmm.el index 444d7945987..ed74c307009 100644 --- a/lisp/tmm.el +++ b/lisp/tmm.el @@ -138,8 +138,8 @@ DEFAULT-ITEM, if non-nil, specifies an initial default choice. Its value should be an event that has a binding in MENU. NO-EXECUTE, if non-nil, means to return the command the user selects instead of executing it. -PATH is a stack that keeps track your path into sub-menus. It is used -to go back in the menu hierarchy." +PATH is a stack that keeps track of your path through sub-menus. It +is used to go back through those sub-menus." ;; If the optional argument IN-POPUP is t, ;; then MENU is an alist of elements of the form (STRING . VALUE). ;; That is used for recursive calls only. @@ -231,7 +231,7 @@ to go back in the menu hierarchy." (tmm--completion-table tmm-km-list) nil t nil 'tmm--history (reverse tmm--history))))))) (if (and (stringp out) (string= "^" out)) - ;; a fake choice to please the destructuring later. + ;; A fake choice to please the destructuring later. (setq choice (cons out out)) (setq choice (cdr (assoc out tmm-km-list))) (and (null choice) commit 1adcbdb21c19b42552736b60a5c1629b5d53a7a2 Author: Manuel Giraud Date: Wed Sep 25 10:31:12 2024 +0200 Add a shortcut to go up in the menu hierarchy. * lisp/tmm.el (tmm-prompt): Add a shortcut to go up in the menu hierarchy (bug#73498). (tmm-completion-prompt): Document it in help message. (tmm-define-keys): Add the shortcut in the keymap. * etc/NEWS: Document the change. diff --git a/etc/NEWS b/etc/NEWS index d1bd469435f..935caba5c0d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -494,6 +494,12 @@ instead. --- *** Support 'electric-layout-mode'. +** Tmm Menubar + +--- +*** Add a shortcut to navigate to previous menu +The hardcoded "^" shortcut gets you back to the previous menu. + * New Modes and Packages in Emacs 31.1 diff --git a/lisp/tmm.el b/lisp/tmm.el index f52afb7e162..444d7945987 100644 --- a/lisp/tmm.el +++ b/lisp/tmm.el @@ -88,8 +88,9 @@ or else the correct item might not be found in the `*Completions*' buffer." (defcustom tmm-completion-prompt "Press PageUp key to reach this buffer from the minibuffer. Alternatively, you can use Up/Down keys (or your History keys) to change -the item in the minibuffer, and press RET when you are done, or press the -marked letters to pick up your choice. Type C-g or ESC ESC ESC to cancel. +the item in the minibuffer, and press RET when you are done, or press +the marked letters to pick up your choice. Type ^ to go to the parent +menu. Type C-g or ESC ESC ESC to cancel. " "Help text to insert on the top of the completion buffer. To save space, you can set this to nil, @@ -123,7 +124,7 @@ specify nil for this variable." (defvar tmm--history nil) ;;;###autoload -(defun tmm-prompt (menu &optional in-popup default-item no-execute) +(defun tmm-prompt (menu &optional in-popup default-item no-execute path) "Text-mode emulation of calling the bindings in keymap. Creates a text-mode menu of possible choices. You can access the elements in the menu in two ways: @@ -136,7 +137,9 @@ keymap or an alist of alists. DEFAULT-ITEM, if non-nil, specifies an initial default choice. Its value should be an event that has a binding in MENU. NO-EXECUTE, if non-nil, means to return the command the user selects -instead of executing it." +instead of executing it. +PATH is a stack that keeps track your path into sub-menus. It is used +to go back in the menu hierarchy." ;; If the optional argument IN-POPUP is t, ;; then MENU is an alist of elements of the form (STRING . VALUE). ;; That is used for recursive calls only. @@ -227,22 +230,28 @@ instead of executing it." " (up/down to change, PgUp to menu): ") (tmm--completion-table tmm-km-list) nil t nil 'tmm--history (reverse tmm--history))))))) - (setq choice (cdr (assoc out tmm-km-list))) - (and (null choice) - (string-prefix-p tmm-c-prompt out) - (setq out (substring out (length tmm-c-prompt)) - choice (cdr (assoc out tmm-km-list)))) - (and (null choice) out - (setq out (try-completion out tmm-km-list) - choice (cdr (assoc out tmm-km-list))))) + (if (and (stringp out) (string= "^" out)) + ;; a fake choice to please the destructuring later. + (setq choice (cons out out)) + (setq choice (cdr (assoc out tmm-km-list))) + (and (null choice) + (string-prefix-p tmm-c-prompt out) + (setq out (substring out (length tmm-c-prompt)) + choice (cdr (assoc out tmm-km-list)))) + (and (null choice) out + (setq out (try-completion out tmm-km-list) + choice (cdr (assoc out tmm-km-list)))))) ;; CHOICE is now (STRING . MEANING). Separate the two parts. (setq chosen-string (car choice)) (setq choice (cdr choice)) - (cond (in-popup + (cond ((and (stringp choice) (string= "^" choice)) + ;; User wants to go up: do it first. + (if path (tmm-prompt (pop path) in-popup nil nil path))) + (in-popup ;; We just did the inner level of a -popup menu. choice) ;; We just did the outer level. Do the inner level now. - (not-menu (tmm-prompt choice t nil no-execute)) + (not-menu (tmm-prompt choice t nil no-execute (cons menu path))) ;; We just handled a menu keymap and found another keymap. ((keymapp choice) (if (symbolp choice) @@ -250,7 +259,7 @@ instead of executing it." (condition-case nil (require 'mouse) (error nil)) - (tmm-prompt choice nil nil no-execute)) + (tmm-prompt choice nil nil no-execute (cons menu path))) ;; We just handled a menu keymap and found a command. (choice (if chosen-string @@ -322,7 +331,8 @@ Stores a list of all the shortcuts in the free variable `tmm-short-cuts'." (define-key map [prior] 'tmm-goto-completions) (define-key map "\ev" 'tmm-goto-completions) (define-key map "\C-n" 'next-history-element) - (define-key map "\C-p" 'previous-history-element))) + (define-key map "\C-p" 'previous-history-element) + (define-key map "^" 'self-insert-and-exit))) (prog1 (current-local-map) (use-local-map (append map (current-local-map)))))) commit 9102f1eaafd51404ca93dacec8785dccad2a2ea0 Author: Juri Linkov Date: Sun Oct 6 20:16:21 2024 +0300 * lisp/vc/diff-mode.el (diff-apply-buffer): Add more failures. Add 'failures' as an argument to the 'message' call. diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index df55ca2ad80..d085c721bc8 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -2153,7 +2153,8 @@ the number of failed hunk applications otherwise." (t (message (ngettext "%d hunk failed; no buffers changed" "%d hunks failed; no buffers changed" - failures)) + failures) + failures) failures)))) (defalias 'diff-mouse-goto-source #'diff-goto-source) commit 61c91389a4da90645562a8b80858e62b7526cdd6 Author: Dmitry Gutov Date: Sun Oct 6 16:30:40 2024 +0300 help-setup-xref: Simplify further * lisp/help-mode.el (help-setup-xref): Simplify, given that the vars are marked 'permanent-local' already (bug#73637). diff --git a/lisp/help-mode.el b/lisp/help-mode.el index a44749d1fe9..4ee4f4156a1 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -505,19 +505,15 @@ This should be called very early, before the output buffer is cleared, because we want to record the \"previous\" position of point so we can restore it properly when going back." (with-current-buffer (help-buffer) - (let ((stack-item help-xref-stack-item) - (stack help-xref-stack)) - (kill-all-local-variables) - (setq help-xref-stack-item stack-item - help-xref-stack stack) - (when help-xref-stack-item - (push (cons (point) help-xref-stack-item) help-xref-stack) - (setq help-xref-forward-stack nil)) - (when interactive-p - (let ((tail (nthcdr 10 help-xref-stack))) - ;; Truncate the stack. - (if tail (setcdr tail nil)))) - (setq help-xref-stack-item item)))) + (kill-all-local-variables) + (when help-xref-stack-item + (push (cons (point) help-xref-stack-item) help-xref-stack) + (setq help-xref-forward-stack nil)) + (when interactive-p + (let ((tail (nthcdr 10 help-xref-stack))) + ;; Truncate the stack. + (if tail (setcdr tail nil)))) + (setq help-xref-stack-item item))) (defvar help-xref-following nil "Non-nil when following a help cross-reference.")