all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 14670@debbugs.gnu.org
Subject: bug#14670: Highlight visited links
Date: Fri, 28 Jun 2013 02:35:58 +0300	[thread overview]
Message-ID: <87wqpfdsnd.fsf@mail.jurta.org> (raw)
In-Reply-To: <jwvli5w6zsd.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Wed, 26 Jun 2013 22:41:42 -0400")

>> -	(or (Info-next-reference-or-link pat 'link)
>> +	(or (Info-next-reference-or-link pat 'shr-url)
>
> Why?

Actually there is no need to rename `link' to `shr-url' because
shr.el is flexible enough to allow arbitrary text properties for links:

  (defun info-render-node (html)
    (let ((shr-external-rendering-functions '((a . info-tag-a))))
      (shr-insert-document html)))

  (defun info-tag-a (cont)
    (let ((url (cdr (assq :href cont)))
          (start (point)))
      (shr-generic cont)
      (when url
        (add-text-properties start (point)
                             (list 'link (shr-expand-url url))))))

So without renaming link text-props, the patch to support
text-prop links in Info becomes shorter:

=== modified file 'lisp/info.el'
--- lisp/info.el	2013-06-27 09:20:04 +0000
+++ lisp/info.el	2013-06-27 23:31:27 +0000
@@ -3863,6 +3919,8 @@ (defun Info-try-follow-nearest-node (&op
 If FORK is non-nil, it is passed to `Info-goto-node'."
   (let (node)
     (cond
+     ((and (setq node (get-text-property (point) 'link)) (not (eq node t)))
+      (Info-goto-node node fork))
      ((setq node (Info-get-token (point) "[hf]t?tps?://"
 				 "\\([hf]t?tps?://[^ \t\n\"`({<>})']+\\)"))
       (browse-url node)
@@ -4701,6 +4766,18 @@ (defun Info-fontify-node ()
             (add-text-properties (1- (match-beginning 2)) (match-end 2)
                                  '(invisible t front-sticky nil rear-nonsticky t)))))
 
+      ;; Fontify links
+      (goto-char (point-min))
+      (when not-fontified-p
+	(let ((beg (next-single-property-change (point-min) 'link))
+	      (end nil))
+	  (while (and beg (setq end (next-single-property-change beg 'link)))
+	    (add-text-properties beg end
+				 '(font-lock-face info-xref
+				   mouse-face highlight
+				   help-echo "mouse-2: go to this link"))
+	    (setq beg (next-single-property-change end 'link)))))
+
       ;; Fontify cross references
       (goto-char (point-min))
       (when (or not-fontified-p fontify-visited-p)






  reply	other threads:[~2013-06-27 23:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-19 22:28 bug#14670: Highlight visited links Juri Linkov
2013-06-26 23:27 ` Juri Linkov
2013-06-27  2:41   ` Stefan Monnier
2013-06-27 23:35     ` Juri Linkov [this message]
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

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

  git send-email \
    --in-reply-to=87wqpfdsnd.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=14670@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.