GNU bug report logs - #79212
31.0.50; Malformed C-h m output

Previous Next

Package: emacs;

Reported by: Eshel Yaron <me <at> eshelyaron.com>

Date: Sun, 10 Aug 2025 18:33:02 UTC

Severity: normal

Found in version 31.0.50

Fixed in version 31.1

Done: Eshel Yaron <me <at> eshelyaron.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 79212 in the body.
You can then email your comments to 79212 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#79212; Package emacs. (Sun, 10 Aug 2025 18:33:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Eshel Yaron <me <at> eshelyaron.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 10 Aug 2025 18:33:02 GMT) Full text and rfc822 format available.

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

From: Eshel Yaron <me <at> eshelyaron.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 31.0.50; Malformed C-h m output
Date: Sun, 10 Aug 2025 20:32:16 +0200
Hi,

With emacs -Q, evaluate the following form:

  (define-derived-mode foo-mode nil "Foo" "Major mode for bar.")

Now switch to a new buffer (C-x b foo RET) and put it in foo-mode with
M-x foo-mode, and then hit C-h m to describe the current major mode.

The Help buffer starts with the following malformed line:

  The major mode is Foo modeMajor mode for bar.

Whereas I would expect something like:

  The major mode is Foo mode.

  Major mode for bar.

The following diff seems to do the trick:

diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 9cd30107002..5f4734fb69d 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -2252,13 +2252,14 @@ describe-mode
                    (lambda (_)
                      (describe-function major))))
           (insert " mode")
-          (when-let* ((file-name (find-lisp-object-file-name major nil)))
-	    (insert (format " defined in %s:\n\n"
-                            (buttonize
-                             (help-fns-short-filename file-name)
-                             (lambda (_)
-                               (help-function-def--button-function
-                                major file-name))))))
+          (if-let* ((file-name (find-lisp-object-file-name major nil)))
+	      (insert (format " defined in %s:\n\n"
+                              (buttonize
+                               (help-fns-short-filename file-name)
+                               (lambda (_)
+                                 (help-function-def--button-function
+                                  major file-name)))))
+            (insert ".\n\n"))
           (insert (help-split-fundoc (documentation major) nil 'doc)
                   (with-current-buffer buffer
                     (help-fns--list-local-commands)))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79212; Package emacs. (Mon, 11 Aug 2025 11:57:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Eshel Yaron <me <at> eshelyaron.com>
Cc: 79212 <at> debbugs.gnu.org
Subject: Re: bug#79212: 31.0.50; Malformed C-h m output
Date: Mon, 11 Aug 2025 14:56:31 +0300
> Date: Sun, 10 Aug 2025 20:32:16 +0200
> From:  Eshel Yaron via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> 
> Hi,
> 
> With emacs -Q, evaluate the following form:
> 
>   (define-derived-mode foo-mode nil "Foo" "Major mode for bar.")
> 
> Now switch to a new buffer (C-x b foo RET) and put it in foo-mode with
> M-x foo-mode, and then hit C-h m to describe the current major mode.
> 
> The Help buffer starts with the following malformed line:
> 
>   The major mode is Foo modeMajor mode for bar.
> 
> Whereas I would expect something like:
> 
>   The major mode is Foo mode.
> 
>   Major mode for bar.
> 
> The following diff seems to do the trick:
> 
> diff --git a/lisp/help-fns.el b/lisp/help-fns.el
> index 9cd30107002..5f4734fb69d 100644
> --- a/lisp/help-fns.el
> +++ b/lisp/help-fns.el
> @@ -2252,13 +2252,14 @@ describe-mode
>                     (lambda (_)
>                       (describe-function major))))
>            (insert " mode")
> -          (when-let* ((file-name (find-lisp-object-file-name major nil)))
> -	    (insert (format " defined in %s:\n\n"
> -                            (buttonize
> -                             (help-fns-short-filename file-name)
> -                             (lambda (_)
> -                               (help-function-def--button-function
> -                                major file-name))))))
> +          (if-let* ((file-name (find-lisp-object-file-name major nil)))
> +	      (insert (format " defined in %s:\n\n"
> +                              (buttonize
> +                               (help-fns-short-filename file-name)
> +                               (lambda (_)
> +                                 (help-function-def--button-function
> +                                  major file-name)))))
> +            (insert ".\n\n"))
>            (insert (help-split-fundoc (documentation major) nil 'doc)
>                    (with-current-buffer buffer
>                      (help-fns--list-local-commands)))

Thanks, but do we really need to have two copies of \n\n?  And why
there's no colon if the mode is not defined in any file?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79212; Package emacs. (Mon, 11 Aug 2025 13:02:02 GMT) Full text and rfc822 format available.

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

From: Eshel Yaron <me <at> eshelyaron.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 79212 <at> debbugs.gnu.org
Subject: Re: bug#79212: 31.0.50; Malformed C-h m output
Date: Mon, 11 Aug 2025 15:01:09 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Date: Sun, 10 Aug 2025 20:32:16 +0200
>> From:  Eshel Yaron via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>> 
>> With emacs -Q, evaluate the following form:
>> 
>>   (define-derived-mode foo-mode nil "Foo" "Major mode for bar.")
>> 
>> Now switch to a new buffer (C-x b foo RET) and put it in foo-mode with
>> M-x foo-mode, and then hit C-h m to describe the current major mode.
>> 
>> The Help buffer starts with the following malformed line:
>> 
>>   The major mode is Foo modeMajor mode for bar.
>> 
>> Whereas I would expect something like:
>> 
>>   The major mode is Foo mode.
>> 
>>   Major mode for bar.
>> 
>> The following diff seems to do the trick:
>> 
>> diff --git a/lisp/help-fns.el b/lisp/help-fns.el
>> index 9cd30107002..5f4734fb69d 100644
>> --- a/lisp/help-fns.el
>> +++ b/lisp/help-fns.el
>> @@ -2252,13 +2252,14 @@ describe-mode
>>                     (lambda (_)
>>                       (describe-function major))))
>>            (insert " mode")
>> -          (when-let* ((file-name (find-lisp-object-file-name major nil)))
>> -	    (insert (format " defined in %s:\n\n"
>> -                            (buttonize
>> -                             (help-fns-short-filename file-name)
>> -                             (lambda (_)
>> -                               (help-function-def--button-function
>> -                                major file-name))))))
>> +          (if-let* ((file-name (find-lisp-object-file-name major nil)))
>> +	      (insert (format " defined in %s:\n\n"
>> +                              (buttonize
>> +                               (help-fns-short-filename file-name)
>> +                               (lambda (_)
>> +                                 (help-function-def--button-function
>> +                                  major file-name)))))
>> +            (insert ".\n\n"))
>>            (insert (help-split-fundoc (documentation major) nil 'doc)
>>                    (with-current-buffer buffer
>>                      (help-fns--list-local-commands)))
>
> Thanks, but do we really need to have two copies of \n\n?  And why
> there's no colon if the mode is not defined in any file?

Good points, here's a slightly DRYer diff:

diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 9cd30107002..e9601d52e33 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -2253,13 +2253,14 @@ describe-mode
                      (describe-function major))))
           (insert " mode")
           (when-let* ((file-name (find-lisp-object-file-name major nil)))
-	    (insert (format " defined in %s:\n\n"
+	    (insert (format " defined in %s"
                             (buttonize
                              (help-fns-short-filename file-name)
                              (lambda (_)
                                (help-function-def--button-function
                                 major file-name))))))
-          (insert (help-split-fundoc (documentation major) nil 'doc)
+          (insert ":\n\n"
+                  (help-split-fundoc (documentation major) nil 'doc)
                   (with-current-buffer buffer
                     (help-fns--list-local-commands)))
           (ensure-empty-lines 1)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79212; Package emacs. (Mon, 11 Aug 2025 13:45:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Eshel Yaron <me <at> eshelyaron.com>, Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 79212 <at> debbugs.gnu.org
Subject: Re: bug#79212: 31.0.50; Malformed C-h m output
Date: Mon, 11 Aug 2025 16:44:41 +0300



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79212; Package emacs. (Mon, 11 Aug 2025 13:47:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Eshel Yaron <me <at> eshelyaron.com>, Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 79212 <at> debbugs.gnu.org
Subject: Re: bug#79212: 31.0.50; Malformed C-h m output
Date: Mon, 11 Aug 2025 16:45:38 +0300
> From: Eshel Yaron <me <at> eshelyaron.com>
> Cc: 79212 <at> debbugs.gnu.org
> Date: Mon, 11 Aug 2025 15:01:09 +0200
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > Thanks, but do we really need to have two copies of \n\n?  And why
> > there's no colon if the mode is not defined in any file?
> 
> Good points, here's a slightly DRYer diff:
> 
> diff --git a/lisp/help-fns.el b/lisp/help-fns.el
> index 9cd30107002..e9601d52e33 100644
> --- a/lisp/help-fns.el
> +++ b/lisp/help-fns.el
> @@ -2253,13 +2253,14 @@ describe-mode
>                       (describe-function major))))
>            (insert " mode")
>            (when-let* ((file-name (find-lisp-object-file-name major nil)))
> -	    (insert (format " defined in %s:\n\n"
> +	    (insert (format " defined in %s"
>                              (buttonize
>                               (help-fns-short-filename file-name)
>                               (lambda (_)
>                                 (help-function-def--button-function
>                                  major file-name))))))
> -          (insert (help-split-fundoc (documentation major) nil 'doc)
> +          (insert ":\n\n"
> +                  (help-split-fundoc (documentation major) nil 'doc)
>                    (with-current-buffer buffer
>                      (help-fns--list-local-commands)))
>            (ensure-empty-lines 1)
> 

Thanks, LGTM.

Stefan, any comments or suggestions?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79212; Package emacs. (Tue, 12 Aug 2025 08:15:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 79212 <at> debbugs.gnu.org, Eshel Yaron <me <at> eshelyaron.com>
Subject: Re: bug#79212: 31.0.50; Malformed C-h m output
Date: Tue, 12 Aug 2025 04:14:11 -0400
>> Good points, here's a slightly DRYer diff:
>> 
>> diff --git a/lisp/help-fns.el b/lisp/help-fns.el
>> index 9cd30107002..e9601d52e33 100644
>> --- a/lisp/help-fns.el
>> +++ b/lisp/help-fns.el
>> @@ -2253,13 +2253,14 @@ describe-mode
>>                       (describe-function major))))
>>            (insert " mode")
>>            (when-let* ((file-name (find-lisp-object-file-name major nil)))
>> -	    (insert (format " defined in %s:\n\n"
>> +	    (insert (format " defined in %s"
>>                              (buttonize
>>                               (help-fns-short-filename file-name)
>>                               (lambda (_)
>>                                 (help-function-def--button-function
>>                                  major file-name))))))
>> -          (insert (help-split-fundoc (documentation major) nil 'doc)
>> +          (insert ":\n\n"
>> +                  (help-split-fundoc (documentation major) nil 'doc)
>>                    (with-current-buffer buffer
>>                      (help-fns--list-local-commands)))
>>            (ensure-empty-lines 1)
>> 
>
> Thanks, LGTM.

+1


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79212; Package emacs. (Tue, 12 Aug 2025 11:58:02 GMT) Full text and rfc822 format available.

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

From: Eshel Yaron <me <at> eshelyaron.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 79212 <at> debbugs.gnu.org
Subject: Re: bug#79212: 31.0.50; Malformed C-h m output
Date: Tue, 12 Aug 2025 13:57:31 +0200
close 79212 31.1
quit

Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>>> Good points, here's a slightly DRYer diff:
>>> 
>>> diff --git a/lisp/help-fns.el b/lisp/help-fns.el
>>> index 9cd30107002..e9601d52e33 100644
>>> --- a/lisp/help-fns.el
>>> +++ b/lisp/help-fns.el
>>> @@ -2253,13 +2253,14 @@ describe-mode
>>>                       (describe-function major))))
>>>            (insert " mode")
>>>            (when-let* ((file-name (find-lisp-object-file-name major nil)))
>>> -	    (insert (format " defined in %s:\n\n"
>>> +	    (insert (format " defined in %s"
>>>                              (buttonize
>>>                               (help-fns-short-filename file-name)
>>>                               (lambda (_)
>>>                                 (help-function-def--button-function
>>>                                  major file-name))))))
>>> -          (insert (help-split-fundoc (documentation major) nil 'doc)
>>> +          (insert ":\n\n"
>>> +                  (help-split-fundoc (documentation major) nil 'doc)
>>>                    (with-current-buffer buffer
>>>                      (help-fns--list-local-commands)))
>>>            (ensure-empty-lines 1)
>>> 
>>
>> Thanks, LGTM.
>
> +1

Great, now pushed to master in commit ae5287c37b7.  Closing.


Thanks,

Eshel







bug marked as fixed in version 31.1, send any further explanations to 79212 <at> debbugs.gnu.org and Eshel Yaron <me <at> eshelyaron.com> Request was from Eshel Yaron <me <at> eshelyaron.com> to control <at> debbugs.gnu.org. (Tue, 12 Aug 2025 11:59:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 10 Sep 2025 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 day ago.

Previous Next


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