1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-24 07:20:37 +00:00

Fix tmm "previous menu" shortcut

* lisp/tmm.el (tmm-clear-self-insert-and-exit): New function to
clear the minibuffer content then call `self-insert-and-exit'.
(tmm-define-keys): Use it.
(tmm-goto-completions): Explain why.  (Bug#74166)
This commit is contained in:
Manuel Giraud 2024-11-01 19:27:31 +01:00 committed by Eli Zaretskii
parent 5def10ad94
commit e1e8da5e4f

View File

@ -336,6 +336,12 @@ Stores a list of all the shortcuts in the free variable `tmm-short-cuts'."
str)) str))
(cdr elt)))))) (cdr elt))))))
(defun tmm-clear-self-insert-and-exit ()
"Clear the minibuffer contents then self insert and exit."
(interactive)
(delete-minibuffer-contents)
(self-insert-and-exit))
;; This returns the old map. ;; This returns the old map.
(defun tmm-define-keys (minibuffer) (defun tmm-define-keys (minibuffer)
(let ((map (make-sparse-keymap))) (let ((map (make-sparse-keymap)))
@ -354,7 +360,7 @@ Stores a list of all the shortcuts in the free variable `tmm-short-cuts'."
(define-key map "\C-n" 'next-history-element) (define-key map "\C-n" 'next-history-element)
(define-key map "\C-p" 'previous-history-element) (define-key map "\C-p" 'previous-history-element)
;; Previous menu shortcut (see `tmm-prompt'). ;; Previous menu shortcut (see `tmm-prompt').
(define-key map "^" 'self-insert-and-exit)) (define-key map "^" 'tmm-clear-self-insert-and-exit))
(prog1 (current-local-map) (prog1 (current-local-map)
(use-local-map (append map (current-local-map)))))) (use-local-map (append map (current-local-map))))))
@ -452,10 +458,10 @@ Stores a list of all the shortcuts in the free variable `tmm-short-cuts'."
(defun tmm-goto-completions () (defun tmm-goto-completions ()
"Jump to the completions buffer." "Jump to the completions buffer."
(interactive) (interactive)
(let ((prompt-end (minibuffer-prompt-end))) (setq tmm-c-prompt (buffer-substring (minibuffer-prompt-end) (point-max)))
(setq tmm-c-prompt (buffer-substring prompt-end (point-max))) ;; Clear minibuffer old contents before using *Completions* buffer for
;; FIXME: Why? ;; selection.
(delete-region prompt-end (point-max))) (delete-minibuffer-contents)
(switch-to-buffer-other-window "*Completions*") (switch-to-buffer-other-window "*Completions*")
(search-forward tmm-c-prompt) (search-forward tmm-c-prompt)
(search-backward tmm-c-prompt)) (search-backward tmm-c-prompt))