GNU bug report logs -
#14670
Highlight visited links
Previous Next
Reported by: Juri Linkov <juri <at> jurta.org>
Date: Wed, 19 Jun 2013 22:38:02 UTC
Severity: wishlist
Tags: patch
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 14670 in the body.
You can then email your comments to 14670 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14670
; Package
emacs
.
(Wed, 19 Jun 2013 22:38:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juri Linkov <juri <at> jurta.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 19 Jun 2013 22:38:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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"))))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14670
; Package
emacs
.
(Wed, 26 Jun 2013 23:35:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 14670 <at> debbugs.gnu.org (full text, mbox):
This patch adds the support for links in virtual Info nodes
rendered by shr.el. A virtual Info node function can just
call `shr-insert-document' and this patch supports the
fontification and navigation for links added by the renderer.
=== modified file 'lisp/info.el'
--- lisp/info.el 2013-05-27 22:42:11 +0000
+++ lisp/info.el 2013-06-24 22:30:15 +0000
@@ -3114,10 +3145,10 @@ (defun Info-next-reference (&optional re
(old-pt (point))
(case-fold-search t))
(or (eobp) (forward-char 1))
- (or (Info-next-reference-or-link pat 'link)
+ (or (Info-next-reference-or-link pat 'shr-url)
(progn
(goto-char (point-min))
- (or (Info-next-reference-or-link pat 'link)
+ (or (Info-next-reference-or-link pat 'shr-url)
(progn
(goto-char old-pt)
(user-error "No cross references in this node")))))
@@ -3141,10 +3172,10 @@ (defun Info-prev-reference (&optional re
(let ((pat "\\*note[ \n\t]+\\([^:]+\\):\\|^\\* .*:\\|[hf]t?tps?://")
(old-pt (point))
(case-fold-search t))
- (or (Info-prev-reference-or-link pat 'link)
+ (or (Info-prev-reference-or-link pat 'shr-url)
(progn
(goto-char (point-max))
- (or (Info-prev-reference-or-link pat 'link)
+ (or (Info-prev-reference-or-link pat 'shr-url)
(progn
(goto-char old-pt)
(user-error "No cross references in this node")))))
@@ -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) 'shr-url))
+ (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 +4764,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 (or not-fontified-p fontify-visited-p)
+ (let ((beg (next-single-property-change (point-min) 'shr-url))
+ (end nil))
+ (while (and beg (setq end (next-single-property-change beg 'shr-url)))
+ (add-text-properties beg end
+ `(font-lock-face info-xref
+ mouse-face highlight
+ help-echo "mouse-2: go to this node"))
+ (setq beg (next-single-property-change end 'shr-url)))))
+
;; Fontify cross references
(goto-char (point-min))
(when (or not-fontified-p fontify-visited-p)
@@ -4969,7 +5053,7 @@ (defun Info-fontify-node ()
(while (re-search-forward "\\(([0-9]+)\\)" nil t)
(add-text-properties (match-beginning 0) (match-end 0)
`(font-lock-face info-xref
- link t
+ shr-url t
mouse-face highlight
help-echo
,(if (< (point) limit)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14670
; Package
emacs
.
(Thu, 27 Jun 2013 02:42:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 14670 <at> debbugs.gnu.org (full text, mbox):
> - (or (Info-next-reference-or-link pat 'link)
> + (or (Info-next-reference-or-link pat 'shr-url)
Why?
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14670
; Package
emacs
.
(Fri, 28 Jun 2013 00:20:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 14670 <at> debbugs.gnu.org (full text, mbox):
>> - (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)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14670
; Package
emacs
.
(Wed, 24 Feb 2016 04:57:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 14670 <at> debbugs.gnu.org (full text, mbox):
Juri Linkov <juri <at> jurta.org> writes:
> So without renaming link text-props, the patch to support
> text-prop links in Info becomes shorter:
I tried applying the patch and then going to an Info node that had an
URL, and I didn't really see any difference... Is this patch still
applicable?
>
> === 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)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14670
; Package
emacs
.
(Thu, 27 Jun 2019 11:14:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 14670 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> Juri Linkov <juri <at> jurta.org> writes:
>
>> So without renaming link text-props, the patch to support
>> text-prop links in Info becomes shorter:
>
> I tried applying the patch and then going to an Info node that had an
> URL, and I didn't really see any difference... Is this patch still
> applicable?
I asked that three years ago and got no response, so I'm closing this
bug report. Please reopen if this is still an issue.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
bug closed, send any further explanations to
14670 <at> debbugs.gnu.org and Juri Linkov <juri <at> jurta.org>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Thu, 27 Jun 2019 11:15:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 25 Jul 2019 11:24:11 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 128 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.