From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#74166: [PATCH] Fix tmm "previous menu" shortcut Date: Fri, 01 Nov 2024 19:36:00 +0100 Message-ID: <877c9m244v.fsf@ledu-giraud.fr> Reply-To: Manuel Giraud Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37609"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: 74166@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Nov 01 19:37:33 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1t6wWZ-0009dS-WE for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 01 Nov 2024 19:37:32 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6wWJ-0002mZ-W5; Fri, 01 Nov 2024 14:37:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6wW6-0002m8-SN for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2024 14:37:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t6wW6-00078k-KL for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2024 14:37:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=A5Lp2TBS2UZbBvgIgsnPQOClwtvkBGnloPzgQrMjra8=; b=UC869wPHYVnUtjBm/TMepRGfDVXDX7ZswhDeBN0CnOSL7ZRE40mWEBxMd9GwgUoxfg6krNVYY1DRiCm4oxNNw4Dq8X8BFPUg7V+/WvyjtOGKXX8RH5hX0eTrnQ6oJHQCDhYLM4Enj9Q+m9fZlKSnySbtxnNfE3b54Sk/hp2djGjw9ed/W2z8APMuUzAR1djRC4CThaSLuFheneafZWM9kmFTlG+ilaQMoTbL5RER2DRuvi3uM6LDuSvwqI11VHzwM5i2Gpx2x5jbRiWG+do5nB/k2X0OdwcDTsFYUpVYU6rD2fUIO6lK1RpPtlR1kjktFF4Y4aU5/WRJ6h9oPkRd7g==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t6wW6-0002FG-Df for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2024 14:37:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Manuel Giraud Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Nov 2024 18:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74166 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.17304861838613 (code B ref -1); Fri, 01 Nov 2024 18:37:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Nov 2024 18:36:23 +0000 Original-Received: from localhost ([127.0.0.1]:51217 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6wVS-0002Er-Pk for submit@debbugs.gnu.org; Fri, 01 Nov 2024 14:36:23 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:50106) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6wVO-0002Ef-TF for submit@debbugs.gnu.org; Fri, 01 Nov 2024 14:36:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6wVH-00025s-DC for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2024 14:36:13 -0400 Original-Received: from ledu-giraud.fr ([51.159.28.247]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6wVB-000755-Vr for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2024 14:36:09 -0400 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=coDHxkBC f/efwCbdjpAJl+XE2qHF975VAi8jPA5DuF8=; h=date:subject:to:from; d=ledu-giraud.fr; b=2CmV6rbKFPzYe3Ew7vS2wo0X6n36VkGn9SLyjVdHurlXTS9Va4 qZL4iXmxbth0726H0CZR6NFB9l0utwPfCUBA== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=coDHxkBCf/efwCbd jpAJl+XE2qHF975VAi8jPA5DuF8=; h=date:subject:to:from; d=ledu-giraud.fr; b=WmJqiJxrTAygWrv/onv1boU3+z/Em3+Cy+tcDho4Owj+1QLtjV FbQD+z7vyXHDAIzezGy6clEzAfpv2fjrf82woIUXEbsQDxxAgEL68Xew+GsgR/2ScilpTJ XTgQ3RPkoVK4T+c2h06G79eVvlQH/UDvZjZ7QIf5EuDtnoX8tKT2vdIGRbxokhlwg2gaMC 1neSepAj8fufzi++LAkVrqez6R5DsEFj48L3Tybs7eBi7N2M5m2efqdujyXgyfrX5JlRsk uAeFeSns7UeGdMHkMvM0Fz/1J1eavDZpahYx1rwsuYChVM82jZG2O6ir4RKr6IWzL3J3vd 7goP1LLNYIGg== Original-Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id d50bfc78 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Fri, 1 Nov 2024 19:36:02 +0100 (CET) Received-SPF: pass client-ip=51.159.28.247; envelope-from=manuel@ledu-giraud.fr; helo=ledu-giraud.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:294700 Archived-At: --=-=-= Content-Type: text/plain 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' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Fix-tmm-previous-menu-shortcut.patch >From 20cbb94b4c83a22d7d65578fab3a581a42836f56 Mon Sep 17 00:00:00 2001 From: Manuel Giraud 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 --=-=-= Content-Type: text/plain -- Manuel Giraud --=-=-=--