unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: 14670@debbugs.gnu.org
Subject: bug#14670: Highlight visited links
Date: Thu, 20 Jun 2013 01:28:48 +0300	[thread overview]
Message-ID: <87r4fx20rj.fsf@mail.jurta.org> (raw)

Severity: wishlist
Tags: patch

Visiting a URL link from Info doesn't highlight it as visited.

I'm afraid that adding a visited URL to the existing variable
`Info-history' might break other functions that expect it containing
only visited Info nodes in the format `(FILENAME NODENAME BUFFERPOS)'.
So I created a new variable `Info-url-history':

=== modified file 'lisp/info.el'
--- lisp/info.el	2013-06-17 23:57:07 +0000
+++ lisp/info.el	2013-06-19 22:28:22 +0000
@@ -50,6 +50,9 @@ (defvar Info-history-list nil
   "List of all Info nodes user has visited.
 Each element of the list is a list (FILENAME NODENAME).")
 
+(defvar Info-url-history nil
+  "List of all URLs user has visited.")
+
 (defcustom Info-history-skip-intermediate-nodes t
   "Non-nil means don't record intermediate Info nodes to the history.
 Intermediate Info nodes are nodes visited by Info internally in the process of
@@ -3882,6 +3885,9 @@ (defun Info-try-follow-nearest-node (&op
     (cond
      ((setq node (Info-get-token (point) "[hf]t?tps?://"
 				 "\\([hf]t?tps?://[^ \t\n\"`({<>})']+\\)"))
+      (when Info-fontify-visited-nodes
+	(setq Info-url-history (cons node (remove node Info-url-history)))
+	(Info-fontify-node))
       (browse-url node)
       (setq node t))
      ((setq node (Info-get-token (point) "\\*note[ \n\t]+"
@@ -4972,11 +4978,16 @@ (defun Info-fontify-node ()
 
       ;; Fontify http and ftp references
       (goto-char (point-min))
-      (when not-fontified-p
+      (when (or not-fontified-p fontify-visited-p)
         (while (re-search-forward "\\(https?\\|ftp\\)://[^ \t\n\"`({<>})']+"
                                   nil t)
           (add-text-properties (match-beginning 0) (match-end 0)
-                               '(font-lock-face info-xref
+                               `(font-lock-face
+				 ,(if (and Info-fontify-visited-nodes
+					   (member (buffer-substring-no-properties
+						    (match-beginning 0) (match-end 0))
+						   Info-url-history))
+				      'info-xref-visited 'info-xref)
                                  mouse-face highlight
                                  help-echo "mouse-2: go to this URL"))))
 





             reply	other threads:[~2013-06-19 22:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-19 22:28 Juri Linkov [this message]
2013-06-26 23:27 ` bug#14670: Highlight visited links Juri Linkov
2013-06-27  2:41   ` Stefan Monnier
2013-06-27 23:35     ` Juri Linkov
2016-02-24  4:56       ` Lars Ingebrigtsen
2019-06-27 11:13         ` Lars Ingebrigtsen

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=87r4fx20rj.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=14670@debbugs.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).