GNU bug report logs -
#13989
Make Info support footnotes
Previous Next
Reported by: Xue Fuqiao <xfq.free <at> gmail.com>
Date: Mon, 18 Mar 2013 10:27:01 UTC
Severity: wishlist
Done: Juri Linkov <juri <at> jurta.org>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 13989 <at> debbugs.gnu.org (full text, mbox):
> It would be nice if Info supports footnotes, just like
> `org-footnote-action' in Org:
> (1) When at a footnote reference, jump to the definition.
> (2) When at a definition, jump to the references if they exist, offer
> to create them otherwise.
>
> Or another choice: make footnote.el support Info.
Thanks for the suggestion. Footnotes like in Org and Wikipedia
would be nice to have. And it's pretty straightforward to implement:
=== modified file 'lisp/info.el'
--- lisp/info.el 2013-02-21 06:55:19 +0000
+++ lisp/info.el 2013-03-18 22:34:07 +0000
@@ -3840,7 +3861,21 @@ (defun Info-try-follow-nearest-node (&op
((setq node (Info-get-token (point) "File: " "File: \\([^,\n\t]*\\)"))
(Info-goto-node "Top" fork))
((setq node (Info-get-token (point) "Prev: " "Prev: \\([^,\n\t]*\\)"))
- (Info-goto-node node fork)))
+ (Info-goto-node node fork))
+ ;; footnote
+ ((setq node (Info-get-token (point) "(" "\\(([0-9]+)\\)"))
+ (let ((old-point (point)) new-point)
+ (save-excursion
+ (goto-char (point-min))
+ (when (re-search-forward "^[ \t]*-+ Footnotes -+$" nil t)
+ (setq new-point (if (< old-point (point))
+ ;; Go to footnote reference
+ (search-forward node nil t)
+ ;; Go to footnote definition
+ (search-backward node nil t)))))
+ (when new-point
+ (goto-char new-point)
+ (setq node t)))))
node))
(defun Info-mouse-follow-link (click)
@@ -4896,6 +4931,20 @@ (defun Info-fontify-node ()
mouse-face highlight
help-echo "mouse-2: go to this URL"))))
+ ;; Fontify footnotes
+ (goto-char (point-min))
+ (when (and not-fontified-p (re-search-forward "^[ \t]*-+ Footnotes -+$" nil t))
+ (let ((limit (point)))
+ (goto-char (point-min))
+ (while (re-search-forward "\\(([0-9]+)\\)" nil t)
+ (add-text-properties (match-beginning 0) (match-end 0)
+ `(font-lock-face info-xref
+ mouse-face highlight
+ help-echo
+ ,(if (< (point) limit)
+ "mouse-2: go to footnote definition"
+ "mouse-2: go to footnote reference"))))))
+
;; Hide empty lines at the end of the node.
(goto-char (point-max))
(skip-chars-backward "\n")
This bug report was last modified 12 years and 124 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.