[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iswitchb

From: Robert Pluim
Subject: Re: iswitchb
Date: Tue, 13 Mar 2018 17:42:35 +0100

Robert Pluim <address@hidden> writes:

>> Not unless you provide an option to get back old behavior (which I
>> think you should, if we accept this change).  Personally, I'm not so
>> sure it's a good idea to install that, as having Info called out
>> explicitly has its merits.

Proposed patch attached. I've boldly defaulted the functionality to
enabled, but we can flip that if people feel strongly about it. I
documented it in the lisp reference manual, but we can put it in the
user manual as well.


>From b374d99ae7e9d16a99ce6a178ab06ab3d5634044 Mon Sep 17 00:00:00 2001
From: Robert Pluim <address@hidden>
Date: Tue, 13 Mar 2018 17:03:11 +0100
Subject: [PATCH] Hide URL and Info node markup in help buffers

* lisp/help-mode.el (help-mode-hide-markup): New custom variable.
(help-make-xrefs): Make URL and Info node markup invisible.
* etc/NEWS: Describe help markup hiding changes.
* doc/lispref/tips.texi (Documentation Tips): Document
 doc/lispref/tips.texi |  7 +++++++
 etc/NEWS              |  5 +++++
 lisp/help-mode.el     | 22 +++++++++++++++++++---
 3 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi
index c62cfcfa8f..3a623541e5 100644
--- a/doc/lispref/tips.texi
+++ b/doc/lispref/tips.texi
@@ -756,6 +756,13 @@ Documentation Tips
 @end smallexample
address@hidden help-mode-hide-markup
+By default, the prefixes that are used to indicate Info and URL
+hyperlinks (such as @samp{Info node} and @samp{URL}) are hidden when
+the documentation string is displayed.  This behavior can be changed
+by customizing  @code{help-mode-hide-markup} to
 Don't write key sequences directly in documentation strings.  Instead,
 use the @address@hidden construct to stand for them.  For example,
diff --git a/etc/NEWS b/etc/NEWS
index 57236b52f0..bdefc0970c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -202,6 +202,11 @@ and commands in the same format as the edit buffer of
 the buffer generated by 'view-lossage' to the "*Edit Macro*" buffer
 created by 'edit-last-kbd-macro', and to save the macro by 'C-c C-c'.
+*** New variable 'help-mode-hide-markup'.
+When non-nil, help-mode buffers will not display the 'Info node' and
+'URL' prefixes to hyperlinks.  Default is t.
 ** Ibuffer
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index 4fb3fb85c9..bca160a7d2 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -98,6 +98,14 @@ help-mode-hook
   "Hook run by `help-mode'."
   :type 'hook
   :group 'help)
+(defcustom help-mode-hide-markup t
+  "If non-nil, hide markup used for Info and URL links.
+Otherwise, show explicit 'Info node' and 'URL' markup in help
+  :version "27.1"
+  :type 'boolean
+  :group 'help)
 ;; Button types used by help
@@ -470,17 +478,25 @@ help-make-xrefs
                 ;; Info references
                   (while (re-search-forward help-xref-info-regexp nil t)
-                    (let ((data (match-string 2)))
+                    (let ((data (match-string 2))
+                          (beg (match-beginning 0))
+                          (end (match-beginning 2)))
                         (unless (string-match "^([^)]+)" data)
                           (setq data (concat "(emacs)" data)))
                        (setq data ;; possible newlines if para filled
-                             (replace-regexp-in-string "[ \t\n]+" " " data t 
+                             (replace-regexp-in-string "[ \t\n]+" " " data t 
+                        (when help-mode-hide-markup
+                          (put-text-property beg end 'invisible t)))
                       (help-xref-button 2 'help-info data))))
                 ;; URLs
                   (while (re-search-forward help-xref-url-regexp nil t)
-                    (let ((data (match-string 1)))
+                    (let ((data (match-string 1))
+                          (beg (match-beginning 0))
+                          (end (match-beginning 1)))
+                      (when help-mode-hide-markup
+                        (put-text-property beg end 'invisible t))
                       (help-xref-button 1 'help-url data))))
                 ;; Mule related keywords.  Do this before trying
                 ;; `help-xref-symbol-regexp' because some of Mule

reply via email to

[Prev in Thread] Current Thread [Next in Thread]