From 2acf1e10828b760b87be3791014451cb666336c3 Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Mon, 7 Oct 2024 10:52:03 +0200 Subject: [PATCH] Clean up tmm.el * lisp/tmm.el (tmm-old-mb-map, tmm-mb-map, tmm-prompt): Remove unused keymap variables. (tmm-define-keys, tmm-add-prompt): Remove always true parameter. --- lisp/tmm.el | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/lisp/tmm.el b/lisp/tmm.el index ed74c307009..46919a08b96 100644 --- a/lisp/tmm.el +++ b/lisp/tmm.el @@ -37,7 +37,6 @@ tmm ;;; The following will be localized, added only to pacify the compiler. (defvar tmm-short-cuts) -(defvar tmm-old-mb-map nil) (defvar tmm-c-prompt nil) (defvar tmm-km-list) (defvar tmm-next-shortcut-digit) @@ -82,9 +81,6 @@ tmm-mid-prompt :type '(choice (const :tag "No shortcuts" nil) string)) -(defvar tmm-mb-map nil - "A place to store minibuffer map.") - (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 @@ -146,7 +142,7 @@ tmm-prompt (let ((gl-str "Menu bar") ;; The menu bar itself is not a menu keymap ; so it doesn't have a name. tmm-km-list out history-len tmm-table-undef tmm-c-prompt - tmm-old-mb-map tmm-short-cuts + tmm-short-cuts chosen-string choice (not-menu (not (keymapp menu)))) (run-hooks 'activate-menubar-hook) @@ -314,8 +310,7 @@ tmm-add-one-shortcut str) (cdr elt)))))) -;; This returns the old map. -(defun tmm-define-keys (minibuffer) +(defun tmm-define-keys () (let ((map (make-sparse-keymap))) (suppress-keymap map t) (dolist (c tmm-short-cuts) @@ -325,16 +320,14 @@ tmm-define-keys ;; downcase input to the same (define-key map (char-to-string (downcase c)) 'tmm-shortcut) (define-key map (char-to-string (upcase c)) 'tmm-shortcut))) - (if minibuffer - (progn - (define-key map [pageup] 'tmm-goto-completions) - (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 "^" 'self-insert-and-exit))) - (prog1 (current-local-map) - (use-local-map (append map (current-local-map)))))) + (define-key map "\C-p" 'previous-history-element) + (define-key map "\C-n" 'next-history-element) + (define-key map "\ev" 'tmm-goto-completions) + (define-key map [prior] 'tmm-goto-completions) + (define-key map [pageup] 'tmm-goto-completions) + ;; Previous menu shortcut (see `tmm-prompt') + (define-key map "^" 'self-insert-and-exit) + (use-local-map (append map (current-local-map))))) (defun tmm-completion-delete-prompt () (with-current-buffer standard-output @@ -374,7 +367,7 @@ tmm-remove-inactive-mouse-face (defun tmm-add-prompt () (unless tmm-c-prompt (error "No active menu entries")) - (setq tmm-old-mb-map (tmm-define-keys t)) + (tmm-define-keys) (or tmm-completion-prompt (add-hook 'completion-setup-hook #'tmm-completion-delete-prompt 'append)) -- 2.46.1