* bug#74166: [PATCH] Fix tmm "previous menu" shortcut
@ 2024-11-01 18:36 Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 0 replies; only message in thread
From: Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-01 18:36 UTC (permalink / raw)
To: 74166
[-- Attachment #1: Type: text/plain, Size: 971 bytes --]
Tags: patch
Hi,
The following patch fixes the "previous menu" shortcut in tmm-menubar
when one has already used Up/Down keys into a submenu.
How to reproduce the bug:
- M-x tmm-menubar
- t ;; for the Tools menu
- Down ;; to circulate to the first entry
- ^ ;; quits tmm but should go back to toplevel instead
While here, explain a "Why?" comment.
In GNU Emacs 31.0.50 (build 86, x86_64-unknown-openbsd7.6, X toolkit) of
2024-11-01 built on computer
Repository revision: ffda8dfe847094bd8488059be2f96270fe298fa5
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101013
System Description: OpenBSD computer 7.6 GENERIC.MP#394 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-Fix-tmm-previous-menu-shortcut.patch --]
[-- Type: text/patch, Size: 1825 bytes --]
From 20cbb94b4c83a22d7d65578fab3a581a42836f56 Mon Sep 17 00:00:00 2001
From: Manuel Giraud <manuel@ledu-giraud.fr>
Date: Fri, 1 Nov 2024 19:27:31 +0100
Subject: [PATCH] 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 a why.
---
lisp/tmm.el | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/lisp/tmm.el b/lisp/tmm.el
index 80991b246b6..cf34f643c3b 100644
--- a/lisp/tmm.el
+++ b/lisp/tmm.el
@@ -336,6 +336,12 @@ tmm-add-one-shortcut
str))
(cdr elt))))))
+(defun tmm-clear-self-insert-and-exit ()
+ "Clear the minibuffer content before self insert and exit."
+ (interactive)
+ (delete-region (minibuffer-prompt-end) (point-max))
+ (self-insert-and-exit))
+
;; This returns the old map.
(defun tmm-define-keys (minibuffer)
(let ((map (make-sparse-keymap)))
@@ -354,7 +360,7 @@ tmm-define-keys
(define-key map "\C-n" 'next-history-element)
(define-key map "\C-p" 'previous-history-element)
;; 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)
(use-local-map (append map (current-local-map))))))
@@ -454,7 +460,8 @@ tmm-goto-completions
(interactive)
(let ((prompt-end (minibuffer-prompt-end)))
(setq tmm-c-prompt (buffer-substring prompt-end (point-max)))
- ;; FIXME: Why?
+ ;; Clear minibuffer old content before using *Completions* buffer
+ ;; for selection.
(delete-region prompt-end (point-max)))
(switch-to-buffer-other-window "*Completions*")
(search-forward tmm-c-prompt)
--
2.47.0
[-- Attachment #3: Type: text/plain, Size: 18 bytes --]
--
Manuel Giraud
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-11-01 18:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-01 18:36 bug#74166: [PATCH] Fix tmm "previous menu" shortcut 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.