summaryrefslogtreecommitdiff
path: root/lisp/info-xref.el
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-07-06 23:18:58 -0600
committerTom Tromey <tromey@redhat.com>2013-07-06 23:18:58 -0600
commit6dacdad5fcb278e5a16b38bb81786aac9ca27be4 (patch)
treef5f331ea361ba0f99e0f9b638d183ad492a7da31 /lisp/info-xref.el
parent0a6f2ff0c8ceb29703e76cddd46ea3f176dd873a (diff)
parent219afb88d9d484393418820d1c08dc93299110ec (diff)
downloademacs-6dacdad5fcb278e5a16b38bb81786aac9ca27be4.tar.gz
merge from trunk
this merges frmo trunk and fixes various build issues. this needed a few ugly tweaks. this hangs in "make check" now
Diffstat (limited to 'lisp/info-xref.el')
-rw-r--r--lisp/info-xref.el44
1 files changed, 39 insertions, 5 deletions
diff --git a/lisp/info-xref.el b/lisp/info-xref.el
index 90a8d4968de..21fb592ff19 100644
--- a/lisp/info-xref.el
+++ b/lisp/info-xref.el
@@ -45,7 +45,25 @@
;;; Code:
(require 'info)
-(eval-when-compile (require 'cl-lib)) ;; for `incf'
+(eval-when-compile (require 'cl-lib)) ; for `cl-incf'
+
+(defgroup info-xref nil
+ "Check external cross-references in Info documents."
+ :group 'docs) ; FIXME right parent?
+
+;; Should this even be an option?
+(defcustom info-xref-case-fold nil
+ "Non-nil means node checks should ignore case.
+When following cross-references, the Emacs Info reader first tries a
+case-sensitive match, then if that fails a case-insensitive one.
+The standalone Info reader does not do this, nor does this work
+for links in the html versions of Texinfo manuals. Therefore
+to ensure your cross-references work on the widest range of platforms,
+you should set this variable to nil."
+ :group 'info-xref
+ :type 'boolean
+ :version "24.4")
+
;;-----------------------------------------------------------------------------
;; vaguely generic
@@ -204,7 +222,8 @@ buffer's line and column of point."
(Info-goto-node node
(when (get-buffer "*info*")
(set-buffer "*info*")
- "xref - temporary"))
+ "xref - temporary")
+ (not info-xref-case-fold))
t)
(error nil))
(unless (equal (current-buffer) oldbuf)
@@ -367,13 +386,28 @@ in the path."
(forward-line)))
(info-xref-check-buffer))))))))
+(defconst info-xref-node-re "\\(?1:\\(([^)]*)\\)[^.,]+\\)"
+ "Regexp with subexp 1 matching (manual)node.")
+
+;; "@xref{node,crossref,manual}." produces:
+;; texinfo 4 or 5:
+;; *Note crossref: (manual)node.
+;; "@xref{node,,manual}." produces:
+;; texinfo 4:
+;; *Note node: (manual)node.
+;; texinfo 5:
+;; *Note (manual)node::.
+(defconst info-xref-note-re
+ (concat "\\*[Nn]ote[ \n\t]+\\(?:"
+ "[^:]*:[ \n\t]+" info-xref-node-re "\\|"
+ info-xref-node-re "::\\)[.,]")
+ "Regexp matching a \"*note...\" link.")
+
(defun info-xref-check-buffer ()
"Check external references in the info file in the current buffer.
This should be the raw file contents, not `Info-mode'."
(goto-char (point-min))
- (while (re-search-forward
- "\\*[Nn]ote[ \n\t]+[^:]*:[ \n\t]+\\(\\(([^)]*)\\)[^.,]+\\)[.,]"
- nil t)
+ (while (re-search-forward info-xref-note-re nil t)
(save-excursion
(goto-char (match-beginning 1)) ;; start of nodename as error position
(info-xref-check-node (match-string 1)))))