GNU bug report logs - #64684
30.0.50; Outline mode for describe-mode

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Juri Linkov <juri@HIDDEN>; Keywords: patch; dated Mon, 17 Jul 2023 17:50:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added tag(s) patch. Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 64684 <at> debbugs.gnu.org:


Received: (at 64684) by debbugs.gnu.org; 17 Jul 2023 17:57:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 17 13:57:24 2023
Received: from localhost ([127.0.0.1]:50884 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qLSTM-0004H2-DS
	for submit <at> debbugs.gnu.org; Mon, 17 Jul 2023 13:57:24 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:34948)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qLSTK-0004Gk-1R
 for 64684 <at> debbugs.gnu.org; Mon, 17 Jul 2023 13:57:22 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qLSTE-0006Iq-HC; Mon, 17 Jul 2023 13:57:16 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=0vz77gKiVQRBamOMeXTWVpT9Q+6UJdTIbUMJ2JHsAf0=; b=QR2eyta+kscG
 WMP0fHHTBYR1Z0QorzE/x7sLCC/UG7kJe2N1yZ0pCLOsgbl79CKXNnZi4GL+/+iplJAWETaY28l91
 tYkecHbfvOhk03UG8JUqJ22JWw+4tSLQ4oUg3erfhfq3Kl79GwO0iSzZ7RfCfeIU39DBStBFpMW/S
 nTggMF5gaggB8IfP7yCt1Zb5lIC3d0RwmyuJ2FfYBLrhYCmr3bm7QiUzGrRNVyv1DFloX5NheTT5A
 DoCd8xuxc2f9U+dgqm+FbXT12GMGQUiSezo6E9Kmp2ng9kfHiNVm8hg7F33rNw44Z/YQoI+rEzDEF
 nc8l2a0Ob6CoiKwXw8fWGA==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1qLST8-00056C-Ax; Mon, 17 Jul 2023 13:57:16 -0400
Date: Mon, 17 Jul 2023 20:57:37 +0300
Message-Id: <83sf9m775a.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
In-Reply-To: <86h6q28m8e.fsf_-_@HIDDEN> (message from Juri Linkov on
 Mon, 17 Jul 2023 20:46:25 +0300)
Subject: Re: bug#64684: 30.0.50; Outline mode for describe-mode
References: <86h6q28m8e.fsf_-_@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 64684
Cc: 64684 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Juri Linkov <juri@HIDDEN>
> Date: Mon, 17 Jul 2023 20:46:25 +0300
> 
> > I don't know.  We also have ^L that separate sections; can we use that
> > for Outline, or maybe add some heading after ^L?
> 
> Here is a new option 'describe-mode-outline' that doesn't require
> changing the current formatting in 'C-h m':

Thanks.  Just don't forget calling this out in NEWS.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#64684; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 17 Jul 2023 17:49:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 17 13:49:28 2023
Received: from localhost ([127.0.0.1]:50863 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qLSLg-00042g-GJ
	for submit <at> debbugs.gnu.org; Mon, 17 Jul 2023 13:49:28 -0400
Received: from lists.gnu.org ([2001:470:142::17]:33536)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1qLSLd-00042E-9z
 for submit <at> debbugs.gnu.org; Mon, 17 Jul 2023 13:49:28 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <juri@HIDDEN>) id 1qLSLM-00017p-Mp
 for bug-gnu-emacs@HIDDEN; Mon, 17 Jul 2023 13:49:11 -0400
Received: from relay3-d.mail.gandi.net ([217.70.183.195])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <juri@HIDDEN>) id 1qLSLJ-0003jf-LK
 for bug-gnu-emacs@HIDDEN; Mon, 17 Jul 2023 13:49:08 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 7734F60008
 for <bug-gnu-emacs@HIDDEN>; Mon, 17 Jul 2023 17:49:00 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 30.0.50; Outline mode for describe-mode
Organization: LINKOV.NET
Date: Mon, 17 Jul 2023 20:46:25 +0300
Message-ID: <86h6q28m8e.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-GND-Sasl: juri@HIDDEN
Received-SPF: pass client-ip=217.70.183.195; envelope-from=juri@HIDDEN;
 helo=relay3-d.mail.gandi.net
X-Spam_score_int: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7,
 RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.6 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.4 (/)

--=-=-=
Content-Type: text/plain

>> I tried to enable outline-minor-mode in the output buffer of 'C-h m',
>> and it has some problems:
>>
>> 1. outline-regexp of 'C-h b' is not suitable for 'C-h m', because the
>> output of 'C-h b' is more uniform, but the output of 'C-h m' includes
>> free-form text that causes false positives for the regexp ".*:$".
>>
>> 2. heading lines of 'C-h m' are beginning with a link, so the link faces
>> are copied to the outline indicator.
>>
>> Both these problems could be fixed by adding an asterisk to the beginning
>> of headings in 'C-h m', for example:
>>
>>   * Font-Lock minor mode (no indicator):
>>
>> Does this look nice?  Or should we try to find a regexp for existing output?
>
> I don't know.  We also have ^L that separate sections; can we use that
> for Outline, or maybe add some heading after ^L?

Here is a new option 'describe-mode-outline' that doesn't require
changing the current formatting in 'C-h m':


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=describe-mode-outline.patch

diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index b9388b45397..e8c019c0a92 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -2110,6 +2110,12 @@ describe-keymap
     (when used-gentemp
       (makunbound keymap))))
 
+(defcustom describe-mode-outline t
+  "Non-nil enables outlines in the output buffer of `describe-mode'."
+  :type 'boolean
+  :group 'help
+  :version "30.1")
+
 ;;;###autoload
 (defun describe-mode (&optional buffer)
   "Display documentation of current major mode and minor modes.
@@ -2135,7 +2141,7 @@ describe-mode
     (with-help-window (help-buffer)
       (with-current-buffer (help-buffer)
         ;; Add the local minor modes at the start.
-        (when local-minors
+        (when (and local-minors (not describe-mode-outline))
           (insert (format "Minor mode%s enabled in this buffer:"
                           (if (length> local-minors 1)
                               "s" "")))
@@ -2162,6 +2168,10 @@ describe-mode
           (insert (help-split-fundoc (documentation major) nil 'doc)
                   (with-current-buffer buffer
                     (help-fns--list-local-commands)))
+          (when describe-mode-outline
+            (save-excursion
+              (goto-char (point-min))
+              (put-text-property (pos-bol) (pos-eol) 'outline-level 1)))
           (ensure-empty-lines 1)
 
           ;; Insert the global minor modes after the major mode.
@@ -2173,6 +2183,23 @@ describe-mode
             (when (re-search-forward "^\f")
               (beginning-of-line)
               (ensure-empty-lines 1)))
+
+          (when describe-mode-outline
+            (setq-local outline-search-function #'outline-search-level)
+            (setq-local outline-level (lambda () 1))
+            (setq-local outline-minor-mode-cycle t
+                        outline-minor-mode-highlight t
+                        outline-minor-mode-use-buttons 'insert
+                        outline--cycle-buffer-state 'show-all)
+            (outline-minor-mode 1)
+            (save-excursion
+              (goto-char (point-min))
+              (let ((inhibit-read-only t))
+                ;; Hide ^Ls.
+                (while (search-forward "\n\f\n" nil t)
+		  (put-text-property (1+ (match-beginning 0)) (1- (match-end 0))
+                                     'invisible t)))))
+
           ;; For the sake of IELM and maybe others
           nil)))))
 
@@ -2208,6 +2235,10 @@ describe-mode--minor-modes
 			      "no indicator"
 			    (format "indicator%s"
 				    indicator)))))
+        (when describe-mode-outline
+          (save-excursion
+            (forward-line -1)
+            (put-text-property (pos-bol) (pos-eol) 'outline-level 1)))
 	(insert (or (help-split-fundoc (documentation mode) nil 'doc)
 	            "No docstring")))))
   (forward-line -1)

--=-=-=--




Acknowledgement sent to Juri Linkov <juri@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#64684; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 22 Sep 2023 09:00:02 UTC

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