all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#73675: [PATCH] Clean up tmm.el
@ 2024-10-07  8:59 Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-10-07 11:40 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-07  8:59 UTC (permalink / raw)
  To: 73675

[-- Attachment #1: Type: text/plain, Size: 679 bytes --]

Tags: patch

Hi,

Here is a patch with some clean up in "tmm.el".

Best regards,

In GNU Emacs 31.0.50 (build 15, x86_64-unknown-openbsd7.6, X toolkit) of
 2024-10-07 built on computer
Repository revision: 8c5d69998e65d3ecf5f599bd828bf3330f4f118a
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101013
System Description: OpenBSD computer 7.6 GENERIC.MP#344 amd64

Configured using:
 'configure CC=egcc CPPFLAGS=-I/usr/local/include
 LDFLAGS=-L/usr/local/lib MAKEINFO=gmakeinfo --prefix=/home/manuel/emacs
 --bindir=/home/manuel/bin --with-x-toolkit=lucid
 --with-toolkit-scroll-bars=no --without-cairo
 --without-compress-install'


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Clean-up-tmm.el.patch --]
[-- Type: text/patch, Size: 3299 bytes --]

From 2acf1e10828b760b87be3791014451cb666336c3 Mon Sep 17 00:00:00 2001
From: Manuel Giraud <manuel@ledu-giraud.fr>
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


[-- Attachment #3: Type: text/plain, Size: 18 bytes --]

-- 
Manuel Giraud

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-08  8:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-07  8:59 bug#73675: [PATCH] Clean up tmm.el Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-07 11:40 ` Eli Zaretskii
2024-10-07 12:05   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-07 18:38     ` Eli Zaretskii
2024-10-08  8:13       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.