GNU bug report logs - #73734
[PATCH] Fix tmm menu layout

Previous Next

Package: emacs;

Reported by: Manuel Giraud <manuel <at> ledu-giraud.fr>

Date: Thu, 10 Oct 2024 13:54:01 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #44 received at 73734 <at> debbugs.gnu.org (full text, mbox):

From: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: rudalics <at> gmx.at, 73734 <at> debbugs.gnu.org
Subject: Re: bug#73734: [PATCH] Fix tmm menu layout
Date: Fri, 11 Oct 2024 12:45:21 +0200
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

[...]

>> The result is even worse because now there is wrapping involved:
>
> This is not what I suggested.  I suggested to leave the spaces in the
> string intact and just put on each of them a display property whose
> value is '(space . (:width 1)).  This cannot possibly cause wrapping,
> unless the original string already does, because we don't change how
> many SPC characters are used, we just force each one of them to take
> exactly one canonical column.

Sorry, I did not understand that.  Do you mean something like this:
[my.patch (text/x-patch, inline)]
diff --git a/lisp/tmm.el b/lisp/tmm.el
index 1e3942761a1..4ddf61cc9b3 100644
--- a/lisp/tmm.el
+++ b/lisp/tmm.el
@@ -484,13 +484,16 @@ tmm-get-keymap
             (when binding
               (setq binding (key-description binding))
               ;; Try to align the keybindings.
-              (let ((colwidth (- (/ (frame-width) 3) 15)))
+              (let* ((colwidth (min 30 (- (/ (window-width) 2) 10)))
+                     (spaces (make-string (max 2 (- colwidth
+                                                    (string-width str)
+                                                    (string-width binding)))
+                                          ?\s)))
+                (dotimes (i (length spaces))
+                  (put-text-property i (1+ i) 'display '(space . (:width 1)) spaces))
                 (setq str
                       (concat str
-                              (make-string (max 2 (- colwidth
-                                                     (string-width str)
-                                                     (string-width binding)))
-                                           ?\s)
+                              spaces
                               binding)))))))
       (and km (stringp km) (setq str km))
       ;; Verify that the command is enabled;
[Message part 3 (text/plain, inline)]
But then, the result is that, now, the keybinding is placed just *one*
space after its menu entry's name.  So yes, the confusion I was talking
about is gone but we completly loose the spacing between entry name and
keybinding as well as the vertical alignment of keybindings.
-- 
Manuel Giraud

This bug report was last modified 270 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.