unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#73734: [PATCH] Fix tmm menu layout
@ 2024-10-10 13:53 Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-10-10 16:14 ` Eli Zaretskii
  0 siblings, 1 reply; 22+ messages in thread
From: Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-10 13:53 UTC (permalink / raw)
  To: 73734

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

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:

[-- Attachment #2: 2024-10-10T15:25+0200.png --]
[-- Type: image/png, Size: 43861 bytes --]

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


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'


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0001-Fix-tmm-menu-layout.patch --]
[-- Type: text/patch, Size: 2379 bytes --]

From 309a846fc13119484ea2f910d20e79fab29c8ea9 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] 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


[-- Attachment #5: Type: text/plain, Size: 19 bytes --]


-- 
Manuel Giraud

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

end of thread, other threads:[~2024-10-15  9:46 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-10 13:53 bug#73734: [PATCH] Fix tmm menu layout Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-10 16:14 ` Eli Zaretskii
2024-10-10 18:00   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-10 18:29     ` Eli Zaretskii
2024-10-11  6:37       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-11  6:51         ` Eli Zaretskii
2024-10-11  7:45           ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-11  8:10           ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-11  9:26             ` Eli Zaretskii
2024-10-11 10:45               ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-11 16:44                 ` Eli Zaretskii
2024-10-12 14:10                   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-12 14:44                     ` Eli Zaretskii
2024-10-12 15:56                       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-12 16:26                         ` Eli Zaretskii
2024-10-12 16:40                           ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-15  8:37                             ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-15  9:46                               ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-11  7:29   ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-11  7:48     ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-11  8:15       ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-11  9:19         ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).