From unknown Mon Jun 23 23:52:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#75500: [PATCH] Fix keybinding alignment in `tmm-menubar' Resent-From: Manuel Giraud Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 11 Jan 2025 17:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 75500 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 75500@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.17366174077904 (code B ref -1); Sat, 11 Jan 2025 17:44:02 +0000 Received: (at submit) by debbugs.gnu.org; 11 Jan 2025 17:43:27 +0000 Received: from localhost ([127.0.0.1]:44709 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tWfWA-00023K-O9 for submit@debbugs.gnu.org; Sat, 11 Jan 2025 12:43:27 -0500 Received: from lists.gnu.org ([2001:470:142::17]:50050) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tWfW7-00022q-Qu for submit@debbugs.gnu.org; Sat, 11 Jan 2025 12:43:24 -0500 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 1tWfW0-00086M-7e for bug-gnu-emacs@gnu.org; Sat, 11 Jan 2025 12:43:16 -0500 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 1tWfVy-00056h-Ah for bug-gnu-emacs@gnu.org; Sat, 11 Jan 2025 12:43:15 -0500 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=7P6xdeUm Xbg5xNiuZdw9zcYnwoNi6eur91xKk6yKuVE=; h=date:subject:to:from; d=ledu-giraud.fr; b=NI3catXlEtTMoUqLlRiDV/MG0q87yY0d6zdxepIzTCT9kwivC2 lz8YkiOmr1ziTW5Ns6qMITkGqMfnK14DrjDw== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=7P6xdeUmXbg5xNiu Zdw9zcYnwoNi6eur91xKk6yKuVE=; h=date:subject:to:from; d=ledu-giraud.fr; b=jnRktl87hQSbk5e5nWm9SdSdDV4S08wb8gTXXR7yzMMw8SbU9p cD7vI/Z0srEYGDZmpVfuV4nAZmTw4tRK6vbIPJa+5lgCGvIv+UY+1nDOw31UIFvV892Ju9 Bho3cqNmWwfi2tJr+IVRA1U858g0xESPbtvyp/iPIec0qFxUUM1IVvcVEst10yfKx6WF/8 ORaCpPMti1/I0aeStnclxiCUTCxCRq2cJW3bR/ku0rsYF5i8luHKDDEiNqzwCkhKLyb4IJ O49P8/t5PdA2oWh9luKUYL1rGtmAhGiwTidjK6CbKhcOd6OiDaW9yzGn4ymOKpH94PiArU 5y62HNlGMmZg== Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 18a60e0a (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Sat, 11 Jan 2025 18:43:08 +0100 (CET) From: Manuel Giraud Date: Sat, 11 Jan 2025 18:42:54 +0100 Message-ID: <87wmf19rhd.fsf@ledu-giraud.fr> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" 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-Spam-Score: 0.9 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) --=-=-= Content-Type: text/plain Tags: patch Hi, In tmm-menubar, for entries prepended by a numerical shortcut, the associated keybinding ends up being misaligned. For instance, you can see that in the eww menu for the entry "List bookmarks". This patch fixes this misalignment. In GNU Emacs 31.0.50 (build 21, x86_64-unknown-openbsd7.6, X toolkit) of 2025-01-08 built on computer Repository revision: 631f43d2bbe403e48d63d963281f1d948dee5263 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101015 System Description: OpenBSD computer 7.6 GENERIC.MP#494 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-keybinding-alignment-in-tmm-menubar.patch >From eca3e6a46b71ad016b47e03ddf4c7c8fb6a6748d Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Sat, 11 Jan 2025 18:34:49 +0100 Subject: [PATCH] Fix keybinding alignment in `tmm-menubar' * lisp/tmm.el (tmm--shorten-space-width): New function that reduces the space between the text menu entry and its keybinding. (tmm-add-one-shortcut): Use it. --- lisp/tmm.el | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lisp/tmm.el b/lisp/tmm.el index c46c477010f..63053f7c13c 100644 --- a/lisp/tmm.el +++ b/lisp/tmm.el @@ -282,6 +282,18 @@ tmm-add-shortcuts (let ((tmm-next-shortcut-digit ?0)) (mapcar #'tmm-add-one-shortcut (reverse list)))) +(defun tmm--shorten-space-width (str) + "Shorten the width between the text of the menu entry and the +keybinding by 2 spaces." + (let* ((start (next-single-property-change 0 'display str)) + (n (length str)) + (end (previous-single-property-change n 'display str)) + (curr-width (and start + (plist-get (get-display-property start 'space str) :width)))) + (when curr-width + (put-text-property start end 'display (cons 'space (list :width (- curr-width 2))) str)) + str)) + (defsubst tmm-add-one-shortcut (elt) ;; uses the free vars tmm-next-shortcut-digit and tmm-short-cuts (cond @@ -328,8 +340,9 @@ tmm-add-one-shortcut res) ;; A fallback digit character: place it in front of the ;; menu entry. - (concat (propertize (char-to-string char) 'face 'highlight) - " " str)) + (tmm--shorten-space-width + (concat (propertize (char-to-string char) 'face 'highlight) + " " str))) (make-string 2 ?\s)) (concat (if char (concat (char-to-string char) tmm-mid-prompt) ;; Keep them lined up in columns. -- 2.47.1 --=-=-= Content-Type: text/plain -- Manuel Giraud --=-=-=-- From unknown Mon Jun 23 23:52:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#75500: [PATCH] Fix keybinding alignment in `tmm-menubar' Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Jan 2025 10:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75500 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Manuel Giraud Cc: 75500@debbugs.gnu.org Received: via spool by 75500-submit@debbugs.gnu.org id=B75500.173719498124563 (code B ref 75500); Sat, 18 Jan 2025 10:10:02 +0000 Received: (at 75500) by debbugs.gnu.org; 18 Jan 2025 10:09:41 +0000 Received: from localhost ([127.0.0.1]:40269 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZ5lt-0006O6-Fd for submit@debbugs.gnu.org; Sat, 18 Jan 2025 05:09:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55672) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tZ5lo-0006Np-OI for 75500@debbugs.gnu.org; Sat, 18 Jan 2025 05:09:38 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tZ5lh-0008JZ-Nh; Sat, 18 Jan 2025 05:09:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=LILYVtxr95/8n9lMeWplNvomOOLtbFI+ymUd0vkST2E=; b=Tf0v2ntOl4TK 64NfDQgwaoNerxjFpnw39Eq/QKZL/GfgwYqV27xOWv3ZzYs3HmMl7wVBlFGjX2w7csit/yiA7P0A5 2RT7kBcSiC94NSdkyc0BAH517SMKLCUvch0wz41kgVGT4D0Z0a60CJQA3fssqaZX2EfUeJ4ZFJ8SL ijKjNPcZA4qssJ7dSKNAqtpz0ohVKZLXReR+WN0YD85FRqstsPKwJBFqNMnTMaJRz2Ee4O85oyaAY C06lx6R0KwFKn07RFqqNxHJ1FITr86/2PNTVNkqgZUWFKgn535V7uidLYielsB9ObXJIBaJXzuGKo 1eB2wxoHzO8I271jHZFonw==; Date: Sat, 18 Jan 2025 12:09:24 +0200 Message-Id: <86h65wbfhn.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87wmf19rhd.fsf@ledu-giraud.fr> (bug-gnu-emacs@gnu.org) References: <87wmf19rhd.fsf@ledu-giraud.fr> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Sat, 11 Jan 2025 18:42:54 +0100 > From: Manuel Giraud via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > In tmm-menubar, for entries prepended by a numerical shortcut, the > associated keybinding ends up being misaligned. For instance, you can > see that in the eww menu for the entry "List bookmarks". This patch > fixes this misalignment. Thanks. However, I couldn't see any misalignments in "List bookmarks". Could you perhaps show a recipe for reproducing this, starting from "emacs -Q"? From unknown Mon Jun 23 23:52:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#75500: [PATCH] Fix keybinding alignment in `tmm-menubar' Resent-From: Manuel Giraud Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Jan 2025 14:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75500 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 75500@debbugs.gnu.org Received: via spool by 75500-submit@debbugs.gnu.org id=B75500.17372094816174 (code B ref 75500); Sat, 18 Jan 2025 14:12:02 +0000 Received: (at 75500) by debbugs.gnu.org; 18 Jan 2025 14:11:21 +0000 Received: from localhost ([127.0.0.1]:40747 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZ9Xk-0001bV-7E for submit@debbugs.gnu.org; Sat, 18 Jan 2025 09:11:20 -0500 Received: from ledu-giraud.fr ([51.159.28.247]:14003) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tZ9Xg-0001bK-Fp for 75500@debbugs.gnu.org; Sat, 18 Jan 2025 09:11:17 -0500 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=n6Gohp2d 3xqTL8YDcopNoWsgJiX82enGRZeKImi1QVw=; h=date:references:in-reply-to: subject:cc:to:from; d=ledu-giraud.fr; b=MCfIVbBWc12yWA35S1RQR0HrVAung0 t6KRc4vMKWAxXMiBqSz1iCdunj6foImqP+vkoC6NP94BbWFDsuc4FfDA== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=n6Gohp2d3xqTL8YD copNoWsgJiX82enGRZeKImi1QVw=; h=date:references:in-reply-to:subject: cc:to:from; d=ledu-giraud.fr; b=v/usGeQpXBr2sSnPYSH0G6fsBaoyvv7U0HOMyf N4BHeOHaj0yyzbZoqkRECyqo1ZKWEAyKcMjgbFCeVSvFT1lKoEEwYx8MADu4Q3GbuvifxU emVSybiAmmiGKEkuzNAImmYugi+e6iD+C5jM2uPy3ZHRPpNrG2GldLusqqtMeo7Wo0AytB MqRZFXh5bM38Hd3xnHFrUMbEqYigMQeP7PeeiWOOd5ANcdEKwMx8ebZVWKOglV8WjvKNWj /0NrYp6og0eRPodQ4+pfbU9hXRpU+VguT06UT5rg7qUeeEjcLn54WrlkicNFo3buPglJ1S S/A4wJN9BAnpRZ50bXTnMMXg== Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 4e154242 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sat, 18 Jan 2025 15:11:14 +0100 (CET) From: Manuel Giraud In-Reply-To: <86h65wbfhn.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 18 Jan 2025 12:09:24 +0200") References: <87wmf19rhd.fsf@ledu-giraud.fr> <86h65wbfhn.fsf@gnu.org> Date: Sat, 18 Jan 2025 15:11:10 +0100 Message-ID: <87sepgb4ap.fsf@ledu-giraud.fr> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> Date: Sat, 11 Jan 2025 18:42:54 +0100 >> From: Manuel Giraud via "Bug reports for GNU Emacs, >> the Swiss army knife of text editors" >> >> In tmm-menubar, for entries prepended by a numerical shortcut, the >> associated keybinding ends up being misaligned. For instance, you can >> see that in the eww menu for the entry "List bookmarks". This patch >> fixes this misalignment. > > Thanks. However, I couldn't see any misalignments in "List > bookmarks". Could you perhaps show a recipe for reproducing this, > starting from "emacs -Q"? You're right. For me, the 'b' shortcut was "taken" for the "Back to previous page" entry. Anyway, you should see the misalignment for the "List cookies" entry with the following recipe: - emacs -Q - M-: (setopt tmm-shortcut-inside-entry t) - M-x eww - gnu.org - M-x tmm-menubar E -- Manuel Giraud From unknown Mon Jun 23 23:52:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#75500: [PATCH] Fix keybinding alignment in `tmm-menubar' Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Jan 2025 15:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75500 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Manuel Giraud Cc: 75500@debbugs.gnu.org Received: via spool by 75500-submit@debbugs.gnu.org id=B75500.173721349920721 (code B ref 75500); Sat, 18 Jan 2025 15:19:02 +0000 Received: (at 75500) by debbugs.gnu.org; 18 Jan 2025 15:18:19 +0000 Received: from localhost ([127.0.0.1]:43380 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZAaZ-0005O9-Bn for submit@debbugs.gnu.org; Sat, 18 Jan 2025 10:18:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43984) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tZAaX-0005Nw-45 for 75500@debbugs.gnu.org; Sat, 18 Jan 2025 10:18:17 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tZAaR-0005d3-7I; Sat, 18 Jan 2025 10:18:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=oFS8p8J7L0dJfqCxNHdQPGpbqM07XVeEhf3QLj2xTgo=; b=Xu0eHRErj3ji qbnRRbTqfZCcLm6nxJyEyLtymQIXGYcce830IFN4lK1enNMxqEDj6pTpGvl5jhbCj+FisewPo10PL QGvP/wle2v0iMBi1j5M6Y/3XUJPaIXhtP9PG87HvahQCc9TVNadXMENmHwbujfBnijIA8yW2NqbKN yN8puM4gTdgJap8X6laT3N+OAEDiD6U7lRc8xW9ecafOIoT6Wpdz1hZPcUtRQX7MYcyw/veTHGoWI 0KSVLd3hdVtjyk+l4p49bWW+ae06Q1pujVYRlP53B9mfXAr+gbgVj6BSWyh9TtsScrGttmlv9oTX8 8NY35eQ2BWBHrlUthEcJIw==; Date: Sat, 18 Jan 2025 17:18:07 +0200 Message-Id: <86ed109mmo.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87sepgb4ap.fsf@ledu-giraud.fr> (message from Manuel Giraud on Sat, 18 Jan 2025 15:11:10 +0100) References: <87wmf19rhd.fsf@ledu-giraud.fr> <86h65wbfhn.fsf@gnu.org> <87sepgb4ap.fsf@ledu-giraud.fr> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Manuel Giraud > Cc: 75500@debbugs.gnu.org > Date: Sat, 18 Jan 2025 15:11:10 +0100 > > Eli Zaretskii writes: > > >> Date: Sat, 11 Jan 2025 18:42:54 +0100 > >> From: Manuel Giraud via "Bug reports for GNU Emacs, > >> the Swiss army knife of text editors" > >> > >> In tmm-menubar, for entries prepended by a numerical shortcut, the > >> associated keybinding ends up being misaligned. For instance, you can > >> see that in the eww menu for the entry "List bookmarks". This patch > >> fixes this misalignment. > > > > Thanks. However, I couldn't see any misalignments in "List > > bookmarks". Could you perhaps show a recipe for reproducing this, > > starting from "emacs -Q"? > > You're right. For me, the 'b' shortcut was "taken" for the "Back to > previous page" entry. Anyway, you should see the misalignment for the > "List cookies" entry with the following recipe: > > - emacs -Q > - M-: (setopt tmm-shortcut-inside-entry t) > - M-x eww > - gnu.org > - M-x tmm-menubar E OK, I see it now, thanks. Coming back to the patch: please make sure the doc string of the function you are adding is according to our conventions (first line is a single complete sentence), and please explain in the comments _why_ this shortening is needed and why exactly 2 spaces. From unknown Mon Jun 23 23:52:14 2025 X-Loop: help-debbugs@gnu.org Subject: bug#75500: [PATCH] Fix keybinding alignment in `tmm-menubar' Resent-From: Manuel Giraud Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Jan 2025 16:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75500 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 75500@debbugs.gnu.org Received: via spool by 75500-submit@debbugs.gnu.org id=B75500.17372178381031 (code B ref 75500); Sat, 18 Jan 2025 16:31:01 +0000 Received: (at 75500) by debbugs.gnu.org; 18 Jan 2025 16:30:38 +0000 Received: from localhost ([127.0.0.1]:43497 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZBiX-0000GX-OQ for submit@debbugs.gnu.org; Sat, 18 Jan 2025 11:30:38 -0500 Received: from ledu-giraud.fr ([51.159.28.247]:12214) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tZBiU-0000GM-Fr for 75500@debbugs.gnu.org; Sat, 18 Jan 2025 11:30:35 -0500 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=XuOXcOlB L0uBYTzbl+ANsIWhJV4/v3R7TKDWgCHvSoE=; h=date:references:in-reply-to: subject:cc:to:from; d=ledu-giraud.fr; b=UDmWpi8zFNWdYHCndULgDVaf0i71sM u9AIcTLSkSCWO2uz520yc/UQNvXqfAZMpFN0lsgf8vFDlRRE5P64ugCg== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=XuOXcOlBL0uBYTzb l+ANsIWhJV4/v3R7TKDWgCHvSoE=; h=date:references:in-reply-to:subject: cc:to:from; d=ledu-giraud.fr; b=kRBlzyntJj/mnlAR1qpuGneuWETzs9PlQ8qnCJ U86Ox6nkAZ6u5jJSY4dQdLSysu6eTUgK+0ooQqruZEu7b8p9yThflIv+YuuJA+GD5V0gyB iAPNwKRkCn5s9R8QWsn5EBnqUelDpcFTeA6EEsH8IjWOXlZnnDHIwp9GIxwo0/lyyfkQFv rPYEohXiDMIr5F39eZ+ad/1XnD22haLIIBYsrtecDI6PtCJ8VjFLvO+Fo1JerRLKLI/qMR iIJavAKBru2a8N9sF1Fy3vrPsTe5uu7qOY0Txk8JCsjLnDUC9qk226eqhzXNhDH7rJDu05 qXUPj1b2fKO+XaFoAh+9Ddew== Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 4aabf0ed (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sat, 18 Jan 2025 17:30:30 +0100 (CET) From: Manuel Giraud In-Reply-To: <86ed109mmo.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 18 Jan 2025 17:18:07 +0200") References: <87wmf19rhd.fsf@ledu-giraud.fr> <86h65wbfhn.fsf@gnu.org> <87sepgb4ap.fsf@ledu-giraud.fr> <86ed109mmo.fsf@gnu.org> Date: Sat, 18 Jan 2025 17:30:29 +0100 Message-ID: <87jzasaxui.fsf@ledu-giraud.fr> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Manuel Giraud >> Cc: 75500@debbugs.gnu.org >> Date: Sat, 18 Jan 2025 15:11:10 +0100 >> >> Eli Zaretskii writes: >> >> >> Date: Sat, 11 Jan 2025 18:42:54 +0100 >> >> From: Manuel Giraud via "Bug reports for GNU Emacs, >> >> the Swiss army knife of text editors" >> >> >> >> In tmm-menubar, for entries prepended by a numerical shortcut, the >> >> associated keybinding ends up being misaligned. For instance, you can >> >> see that in the eww menu for the entry "List bookmarks". This patch >> >> fixes this misalignment. >> > >> > Thanks. However, I couldn't see any misalignments in "List >> > bookmarks". Could you perhaps show a recipe for reproducing this, >> > starting from "emacs -Q"? >> >> You're right. For me, the 'b' shortcut was "taken" for the "Back to >> previous page" entry. Anyway, you should see the misalignment for the >> "List cookies" entry with the following recipe: >> >> - emacs -Q >> - M-: (setopt tmm-shortcut-inside-entry t) >> - M-x eww >> - gnu.org >> - M-x tmm-menubar E > > OK, I see it now, thanks. > > Coming back to the patch: please make sure the doc string of the > function you are adding is according to our conventions (first line is > a single complete sentence), and please explain in the comments _why_ > this shortening is needed and why exactly 2 spaces. Do you meant like this? --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-keybinding-alignment-in-tmm-menubar.patch >From 91d4914ff694a18e9b3f92a74c4e310cea4226c6 Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Sat, 11 Jan 2025 18:34:49 +0100 Subject: [PATCH] Fix keybinding alignment in `tmm-menubar' * lisp/tmm.el (tmm--shorten-space-width): New function that reduces the space between the text menu entry and its keybinding to avoid a misalignement. (tmm-add-one-shortcut): Use it. --- lisp/tmm.el | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/lisp/tmm.el b/lisp/tmm.el index c46c477010f..9dcbf90b657 100644 --- a/lisp/tmm.el +++ b/lisp/tmm.el @@ -282,6 +282,17 @@ tmm-add-shortcuts (let ((tmm-next-shortcut-digit ?0)) (mapcar #'tmm-add-one-shortcut (reverse list)))) +(defun tmm--shorten-space-width (str) + "Shorten the width between the menu entry and the keybinding by 2 spaces." + (let* ((start (next-single-property-change 0 'display str)) + (n (length str)) + (end (previous-single-property-change n 'display str)) + (curr-width (and start + (plist-get (get-display-property start 'space str) :width)))) + (when curr-width + (put-text-property start end 'display (cons 'space (list :width (- curr-width 2))) str)) + str)) + (defsubst tmm-add-one-shortcut (elt) ;; uses the free vars tmm-next-shortcut-digit and tmm-short-cuts (cond @@ -327,9 +338,14 @@ tmm-add-one-shortcut (add-text-properties pos (1+ pos) '(face highlight) res) res) ;; A fallback digit character: place it in front of the - ;; menu entry. - (concat (propertize (char-to-string char) 'face 'highlight) - " " str)) + ;; menu entry. We need to shorten the spaces between + ;; the menu entry and the keybinding by two spaces + ;; because we added two characters at the front (one + ;; digit and one space) and this would cause a + ;; misalignement otherwise. + (tmm--shorten-space-width + (concat (propertize (char-to-string char) 'face 'highlight) + " " str))) (make-string 2 ?\s)) (concat (if char (concat (char-to-string char) tmm-mid-prompt) ;; Keep them lined up in columns. -- 2.47.1 --=-=-= Content-Type: text/plain -- Manuel Giraud --=-=-=-- From unknown Mon Jun 23 23:52:14 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Manuel Giraud Subject: bug#75500: closed (Re: bug#75500: [PATCH] Fix keybinding alignment in `tmm-menubar') Message-ID: References: <86v7ub6k1f.fsf@gnu.org> <87wmf19rhd.fsf@ledu-giraud.fr> X-Gnu-PR-Message: they-closed 75500 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 75500@debbugs.gnu.org Date: Sun, 19 Jan 2025 12:55:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1737291302-19181-1" This is a multi-part message in MIME format... ------------=_1737291302-19181-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #75500: [PATCH] Fix keybinding alignment in `tmm-menubar' which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 75500@debbugs.gnu.org. --=20 75500: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D75500 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1737291302-19181-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 75500-done) by debbugs.gnu.org; 19 Jan 2025 12:54:47 +0000 Received: from localhost ([127.0.0.1]:45210 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZUpC-0004yq-Nf for submit@debbugs.gnu.org; Sun, 19 Jan 2025 07:54:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34638) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tZUp9-0004yc-Lo for 75500-done@debbugs.gnu.org; Sun, 19 Jan 2025 07:54:44 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tZUp4-0000FH-3U; Sun, 19 Jan 2025 07:54:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=VNg3ekyH0Wo/PVBI6oFV2I29s+t1pb+mNFAIrpCcbhQ=; b=rO04pG1MaUn5 a7ZxxtSFj+C9rNdf6W2VSej4P16Q+QIGqLaT5pTvdD//JNecsQ/Mv32Csygar7qu9mZKNiSFNqASH XRihJHpj37UaNX+sp2QWws3g7KdWYEs7DO67P4s1lzQFrkedIOI8H++Wc3/0XZIgYE0Ym7zwLceXb F1WwD49TAfW4+EAb5H0mP+1Yh6JgtxMGhR6helQWyOLcC3vGfDzNJNniY5NXhfPx3m62RcCLYgh1Y os+px7a77yvgcqcUNjQR+RHXPENo6h1q2zWeKYrFmHYshs+Z0DnIVPfa848BxcObKOqPQ6Ba1LgN2 yKaFHSo3T1EJH41Z4w91pA==; Date: Sun, 19 Jan 2025 14:54:36 +0200 Message-Id: <86v7ub6k1f.fsf@gnu.org> From: Eli Zaretskii To: Manuel Giraud In-Reply-To: <87jzasaxui.fsf@ledu-giraud.fr> (message from Manuel Giraud on Sat, 18 Jan 2025 17:30:29 +0100) Subject: Re: bug#75500: [PATCH] Fix keybinding alignment in `tmm-menubar' References: <87wmf19rhd.fsf@ledu-giraud.fr> <86h65wbfhn.fsf@gnu.org> <87sepgb4ap.fsf@ledu-giraud.fr> <86ed109mmo.fsf@gnu.org> <87jzasaxui.fsf@ledu-giraud.fr> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75500-done Cc: 75500-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Manuel Giraud > Cc: 75500@debbugs.gnu.org > Date: Sat, 18 Jan 2025 17:30:29 +0100 > > Eli Zaretskii writes: > > >> - emacs -Q > >> - M-: (setopt tmm-shortcut-inside-entry t) > >> - M-x eww > >> - gnu.org > >> - M-x tmm-menubar E > > > > OK, I see it now, thanks. > > > > Coming back to the patch: please make sure the doc string of the > > function you are adding is according to our conventions (first line is > > a single complete sentence), and please explain in the comments _why_ > > this shortening is needed and why exactly 2 spaces. > > Do you meant like this? Yes, exactly. Now installed on the master branch, and closing the bug. Thanks. ------------=_1737291302-19181-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 11 Jan 2025 17:43:27 +0000 Received: from localhost ([127.0.0.1]:44709 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tWfWA-00023K-O9 for submit@debbugs.gnu.org; Sat, 11 Jan 2025 12:43:27 -0500 Received: from lists.gnu.org ([2001:470:142::17]:50050) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tWfW7-00022q-Qu for submit@debbugs.gnu.org; Sat, 11 Jan 2025 12:43:24 -0500 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 1tWfW0-00086M-7e for bug-gnu-emacs@gnu.org; Sat, 11 Jan 2025 12:43:16 -0500 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 1tWfVy-00056h-Ah for bug-gnu-emacs@gnu.org; Sat, 11 Jan 2025 12:43:15 -0500 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=7P6xdeUm Xbg5xNiuZdw9zcYnwoNi6eur91xKk6yKuVE=; h=date:subject:to:from; d=ledu-giraud.fr; b=NI3catXlEtTMoUqLlRiDV/MG0q87yY0d6zdxepIzTCT9kwivC2 lz8YkiOmr1ziTW5Ns6qMITkGqMfnK14DrjDw== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=7P6xdeUmXbg5xNiu Zdw9zcYnwoNi6eur91xKk6yKuVE=; h=date:subject:to:from; d=ledu-giraud.fr; b=jnRktl87hQSbk5e5nWm9SdSdDV4S08wb8gTXXR7yzMMw8SbU9p cD7vI/Z0srEYGDZmpVfuV4nAZmTw4tRK6vbIPJa+5lgCGvIv+UY+1nDOw31UIFvV892Ju9 Bho3cqNmWwfi2tJr+IVRA1U858g0xESPbtvyp/iPIec0qFxUUM1IVvcVEst10yfKx6WF/8 ORaCpPMti1/I0aeStnclxiCUTCxCRq2cJW3bR/ku0rsYF5i8luHKDDEiNqzwCkhKLyb4IJ O49P8/t5PdA2oWh9luKUYL1rGtmAhGiwTidjK6CbKhcOd6OiDaW9yzGn4ymOKpH94PiArU 5y62HNlGMmZg== Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 18a60e0a (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Sat, 11 Jan 2025 18:43:08 +0100 (CET) From: Manuel Giraud To: bug-gnu-emacs@gnu.org Subject: [PATCH] Fix keybinding alignment in `tmm-menubar' X-Debbugs-Cc: Date: Sat, 11 Jan 2025 18:42:54 +0100 Message-ID: <87wmf19rhd.fsf@ledu-giraud.fr> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" 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-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) --=-=-= Content-Type: text/plain Tags: patch Hi, In tmm-menubar, for entries prepended by a numerical shortcut, the associated keybinding ends up being misaligned. For instance, you can see that in the eww menu for the entry "List bookmarks". This patch fixes this misalignment. In GNU Emacs 31.0.50 (build 21, x86_64-unknown-openbsd7.6, X toolkit) of 2025-01-08 built on computer Repository revision: 631f43d2bbe403e48d63d963281f1d948dee5263 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101015 System Description: OpenBSD computer 7.6 GENERIC.MP#494 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-keybinding-alignment-in-tmm-menubar.patch >From eca3e6a46b71ad016b47e03ddf4c7c8fb6a6748d Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Sat, 11 Jan 2025 18:34:49 +0100 Subject: [PATCH] Fix keybinding alignment in `tmm-menubar' * lisp/tmm.el (tmm--shorten-space-width): New function that reduces the space between the text menu entry and its keybinding. (tmm-add-one-shortcut): Use it. --- lisp/tmm.el | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lisp/tmm.el b/lisp/tmm.el index c46c477010f..63053f7c13c 100644 --- a/lisp/tmm.el +++ b/lisp/tmm.el @@ -282,6 +282,18 @@ tmm-add-shortcuts (let ((tmm-next-shortcut-digit ?0)) (mapcar #'tmm-add-one-shortcut (reverse list)))) +(defun tmm--shorten-space-width (str) + "Shorten the width between the text of the menu entry and the +keybinding by 2 spaces." + (let* ((start (next-single-property-change 0 'display str)) + (n (length str)) + (end (previous-single-property-change n 'display str)) + (curr-width (and start + (plist-get (get-display-property start 'space str) :width)))) + (when curr-width + (put-text-property start end 'display (cons 'space (list :width (- curr-width 2))) str)) + str)) + (defsubst tmm-add-one-shortcut (elt) ;; uses the free vars tmm-next-shortcut-digit and tmm-short-cuts (cond @@ -328,8 +340,9 @@ tmm-add-one-shortcut res) ;; A fallback digit character: place it in front of the ;; menu entry. - (concat (propertize (char-to-string char) 'face 'highlight) - " " str)) + (tmm--shorten-space-width + (concat (propertize (char-to-string char) 'face 'highlight) + " " str))) (make-string 2 ?\s)) (concat (if char (concat (char-to-string char) tmm-mid-prompt) ;; Keep them lined up in columns. -- 2.47.1 --=-=-= Content-Type: text/plain -- Manuel Giraud --=-=-=-- ------------=_1737291302-19181-1--