GNU bug report logs - #78391
30.0.92; remapped command's docstring still claims to have menu invocation

Previous Next

Package: emacs;

Reported by: Jake <jforst.mailman <at> gmail.com>

Date: Mon, 12 May 2025 12:21:02 UTC

Severity: normal

Found in version 30.0.92

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

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: jforst.mailman <at> gmail.com, 78391 <at> debbugs.gnu.org
Subject: Re: bug#78391: 30.0.92; remapped command's docstring still claims
 to have menu invocation
Date: Mon, 12 May 2025 19:01:05 +0300
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: Jake <jforst.mailman <at> gmail.com>,  78391 <at> debbugs.gnu.org
> Date: Mon, 12 May 2025 10:50:26 -0400
> 
> > Thanks.  Does the patch below give good results?
> >
> > Stefan, any comments?
> >
> > diff --git a/lisp/help-fns.el b/lisp/help-fns.el
> > index e7bbd25..aacdcc5 100644
> > --- a/lisp/help-fns.el
> > +++ b/lisp/help-fns.el
> > @@ -624,8 +624,11 @@ help-fns--key-bindings
> >                (let ((start (point)))
> >                  (help-fns--insert-menu-bindings
> >                   menus
> > -                 (concat "It can " (and keys "also ")
> > -                         "be invoked from the menu: "))
> > +                 (if remapped
> > +                     (concat "Without the remapping, it could "
> > +                             (and keys "also ") "be invoked from the menu: ")
> > +                   (concat "It can " (and keys "also ")
> > +                           "be invoked from the menu: ")))
> >                  (fill-region-as-paragraph start (point))))
> >              (ensure-empty-lines)))))))
> >  
> 
> It gives a rather redundant text since the same "Without the remapping"
> is used just above for the key bindings.  As a user I'd prefer it
> integrated into that previous sentence to end up with a text along the
> lines of:
> 
>     Its keys are remapped to ‘ibuffer’.
>     Without this remapping, it would be bound to C-x C-b
>     and to the menu entry Buffers → List All Buffers

The problem with this is that there could be additional text
in-between, in which case the sentence would become a mouthful:

          (if (and (eq function 'self-insert-command)
                   (vectorp (car-safe keys))
                   (consp (aref (car keys) 0)))
              (princ "It is bound to many ordinary text characters.\n")
            ;; Which non-control non-meta keys run this command?
            (dolist (key keys)
              (if (member (event-modifiers (aref key 0)) '(nil (shift)))
                  (push key non-modified-keys)))
            (when remapped
              (princ "Its keys are remapped to ")
              (princ (if (symbolp remapped)
                         (format-message "`%s'" remapped)
		       "an anonymous command"))
              (princ ".\n"))

            (when keys
              (princ (if remapped
                         "Without this remapping, it would be bound to "
                       "It is bound to "))
              ;; If lots of ordinary text characters run this command,
              ;; don't mention them one by one.
              (if (< (length non-modified-keys) 10)
                  (with-current-buffer standard-output
                    (help-fns--insert-bindings keys))
                (dolist (key non-modified-keys)
                  (setq keys (delq key keys)))
                (if keys
                    (with-current-buffer standard-output
                      (help-fns--insert-bindings keys)
                      (insert ", and many ordinary text characters"))
                  (princ "many ordinary text characters."))))
            (when (or remapped keys non-modified-keys)
              (princ ".")
              (terpri)))

          (with-current-buffer standard-output
            (fill-region-as-paragraph pt2 (point))
            (unless (bolp)
              (insert "\n"))
            (when menus
              (let ((start (point)))
                (help-fns--insert-menu-bindings
                 menus
                 (concat "It can " (and keys "also ")
                         "be invoked from the menu: "))
                (fill-region-as-paragraph start (point))))




This bug report was last modified 27 days ago.

Previous Next


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