unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: iswitchb
Date: Tue, 13 Mar 2018 17:42:35 +0100	[thread overview]
Message-ID: <87fu54apvo.fsf@gmail.com> (raw)
In-Reply-To: <87zi3di3e0.fsf@gmail.com> (Robert Pluim's message of "Mon, 12 Mar 2018 18:56:39 +0100")

[-- Attachment #1: Type: text/plain, Size: 518 bytes --]

Robert Pluim <rpluim@gmail.com> 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.

Robert


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Hide-URL-and-Info-node-markup-in-help-buffers.patch --]
[-- Type: text/x-diff, Size: 3923 bytes --]

From b374d99ae7e9d16a99ce6a178ab06ab3d5634044 Mon Sep 17 00:00:00 2001
From: Robert Pluim <rpluim@gmail.com>
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
  'help-mode-hide-markup'
---
 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
 `https://www.gnu.org/').
 @end smallexample
 
+@vindex 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
+@code{nil}.
+
 @item
 Don't write key sequences directly in documentation strings.  Instead,
 use the @samp{\\[@dots{}]} 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
+buffers."
+  :version "27.1"
+  :type 'boolean
+  :group 'help)
 \f
 ;; Button types used by help
 
@@ -470,17 +478,25 @@ help-make-xrefs
                 ;; Info references
                 (save-excursion
                   (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)))
                       (save-match-data
                         (unless (string-match "^([^)]+)" data)
                           (setq data (concat "(emacs)" data)))
 			(setq data ;; possible newlines if para filled
-			      (replace-regexp-in-string "[ \t\n]+" " " data t t)))
+			      (replace-regexp-in-string "[ \t\n]+" " " data t t))
+                        (when help-mode-hide-markup
+                          (put-text-property beg end 'invisible t)))
                       (help-xref-button 2 'help-info data))))
                 ;; URLs
                 (save-excursion
                   (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
-- 
2.16.1.72.g5be1f00a9


  reply	other threads:[~2018-03-13 16:42 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180311031648.8003.90161@vcs0.savannah.gnu.org>
     [not found] ` <20180311031649.A9FBF20F52@vcs0.savannah.gnu.org>
2018-03-11  3:21   ` [Emacs-diffs] master f1c48b0: Remove many items obsolete since Emacs 22.1 Daniel Colascione
2018-03-11  3:40     ` iswitchb (was: [Emacs-diffs] master f1c48b0: Remove many items obsolete since Emacs 22.1) Stefan Monnier
2018-03-12 10:22       ` iswitchb Robert Pluim
2018-03-12 11:21         ` iswitchb Eli Zaretskii
2018-03-12 11:44           ` iswitchb Eli Zaretskii
2018-03-12 13:57             ` iswitchb Robert Pluim
2018-03-12 14:41               ` iswitchb Noam Postavsky
2018-03-12 16:56                 ` iswitchb Robert Pluim
2018-03-12 17:36                   ` iswitchb Eli Zaretskii
2018-03-12 17:56                     ` iswitchb Robert Pluim
2018-03-13 16:42                       ` Robert Pluim [this message]
2018-03-14 15:54                         ` iswitchb Eli Zaretskii
2008-03-19 21:44 iswitchb Richard Stallman
2008-03-19 22:31 ` iswitchb paul r
2008-03-20  2:51   ` iswitchb Don Armstrong
2008-03-20  3:08     ` iswitchb Daniel Colascione
2008-03-20  8:43     ` iswitchb paul r
2008-03-20 14:22       ` iswitchb Stefan Monnier
2008-03-20 14:44         ` iswitchb paul r
2008-03-20 18:37     ` iswitchb Richard Stallman
2008-03-20 20:17       ` iswitchb Don Armstrong
2008-03-22  3:24         ` iswitchb Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fu54apvo.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).