branch: externals/auctex commit fb09c26aa539c1a3a48ccf78098ed536f48c4870 Author: Tassilo Horn <t...@gnu.org> Commit: Tassilo Horn <t...@gnu.org>
Warn about duplicate texinfo nodes * tex-info.el (Texinfo-make-node-list): Warn about duplicate nodes. Return nodes in order instead of reversed. --- ChangeLog | 5 +++++ tex-info.el | 28 ++++++++++++++++++---------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 73864da..e73fc68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-10-28 Tassilo Horn <t...@gnu.org> + + * tex-info.el (Texinfo-make-node-list): Warn about duplicate + nodes. Return nodes in order instead of reversed. + 2015-10-25 Vincent Bela�che <vincent....@hotmail.fr> * tex-info.el (Texinfo-nodename-de-escape): New defun. diff --git a/tex-info.el b/tex-info.el index 39d1d5c..b987422 100644 --- a/tex-info.el +++ b/tex-info.el @@ -318,21 +318,29 @@ commands. Return the resulting string." node-name) -(defun Texinfo-make-node-list (&optional nodes) +(defun Texinfo-make-node-list () ;; Build list of nodes in current buffer. ;; (What about using `imenu--index-alist'?) ;; FIXME: Support multi-file documents. (save-excursion (goto-char (point-min)) - (while (re-search-forward "^@node\\b" nil t) - (skip-chars-forward "[:blank:]") - (pushnew (list (Texinfo-nodename-de-escape - (buffer-substring-no-properties - (point) (progn (skip-chars-forward "^\r\n,") - (skip-chars-backward "[:blank:]") - (point))))) - nodes :test #'equal))) - nodes) + (let (nodes dups) + (while (re-search-forward "^@node\\b" nil t) + (skip-chars-forward "[:blank:]") + (pushnew (list (Texinfo-nodename-de-escape + (buffer-substring-no-properties + (point) (progn (skip-chars-forward "^\r\n,") + (skip-chars-backward "[:blank:]") + (point))))) + nodes + :test (lambda (a b) + (when (equal a b) + (push (cons a (line-number-at-pos (point))) dups) + t)))) + (message "There are duplicate nodes:") + (dolist (dup (nreverse dups)) + (message " %s on line %d" (car dup) (cdr dup))))) + (nreverse nodes)) (defun Texinfo-insert-node () "Insert a Texinfo node in the current buffer.