Subject: bug#73734: closed (Re: bug#73734: [PATCH] Fix tmm menu layout)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 19 Oct 2024 08:37:02 +0000

Your bug report

#73734: [PATCH] Fix tmm menu layout

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 [email-masked].

-- 
73734: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73734
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#73734: [PATCH] Fix tmm menu layout
From: Eli Zaretskii <[email-masked]>
To: Manuel Giraud <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Sat, 19 Oct 2024 11:35:43 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Manuel Giraud <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Tue, 15 Oct 2024 10:37:08 +0200
> 
> Hi,
> 
> I don't think there is fix that will work for everyone on this issue.  I
> thought that this was due to the fixed 30 value for colwidth but even
> when always using computed value (using frame-width for instance), there
> is always some frame-width that will exhibit the « confusion ».
> 
> I have tested with set-frame-width and decrementing it one by one.
> 
> My conclusion is that the last patch could still go in but does not
> really solve the original issue.

OK, I've now installed that patch on master, and I'm closing this bug.

Thanks.

Subject: [PATCH] Fix tmm menu layout
From: Manuel Giraud <[email-masked]>
To: [email-masked]
Date: Thu, 10 Oct 2024 15:53:12 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Tags: patch

Hi,

Depending on the frame and font size, some tmm menus could be somewhat
hard to read.  Here is what I get with the "Mark" menu from a Dired
buffer:

The selection character could be mistaken for part of another
keybinding.

This patch tries to solves this issue.  I tested it a bit with different
frame sizes and different fonts and get good enough results.

Here, how I justify the modification of `colwidth':

      - I don't think we need the "(min 30)" part since, if the frame is
        wide enough, we always get a colwidth of 30.
        
      - I don't think "(window-width)" is what we need since, by
        default, the *Completions* buffer will use the full frame width.

      - I tried to set the layout on three columns because "why not?"

While here, I had some clean up.

In GNU Emacs 31.0.50 (build 18, x86_64-unknown-openbsd7.6, X toolkit) of
 2024-10-09 built on computer
Repository revision: 9ed82c26a36caf9a9a85779cbb3a58b7ccd3dffb
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'

>From 309a846fc13119484ea2f910d20e79fab29c8ea9 Mon Sep 17 00:00:00 2001
From: Manuel Giraud <[email-masked]>
Date: Mon, 7 Oct 2024 10:52:03 +0200
Subject: [PATCH] Fix tmm menu layout

* lisp/tmm.el (tmm-mb-map): Remove unused and unset keymap
variable.
* lisp/tmm.el (tmm-get-keymap): Fix menu layout.
---
 lisp/tmm.el | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/lisp/tmm.el b/lisp/tmm.el
index ed74c307009..1e3942761a1 100644
--- a/lisp/tmm.el
+++ b/lisp/tmm.el
@@ -82,9 +82,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
@@ -325,14 +322,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)))
+    (when minibuffer
+      (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)
+      ;; Previous menu shortcut (see `tmm-prompt')
+      (define-key map "^" 'self-insert-and-exit))
     (prog1 (current-local-map)
       (use-local-map (append map (current-local-map))))))
 
@@ -487,7 +484,7 @@ tmm-get-keymap
             (when binding
               (setq binding (key-description binding))
               ;; Try to align the keybindings.
-              (let ((colwidth (min 30 (- (/ (window-width) 2) 10))))
+              (let ((colwidth (- (/ (frame-width) 3) 15)))
                 (setq str
                       (concat str
                               (make-string (max 2 (- colwidth
-- 
2.46.1

-- 
Manuel Giraud