This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU AUCTeX".

The branch, master has been updated
       via  fb09c26aa539c1a3a48ccf78098ed536f48c4870 (commit)
      from  d56502e7dcba118c62d38f6fe2f5a855834e6816 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit fb09c26aa539c1a3a48ccf78098ed536f48c4870
Author: Tassilo Horn <[email protected]>
Date:   Wed Oct 28 08:40:24 2015 +0100

    Warn about duplicate texinfo nodes
    
    * tex-info.el (Texinfo-make-node-list): Warn about duplicate
    nodes.  Return nodes in order instead of reversed.

diff --git a/ChangeLog b/ChangeLog
index 73864da..e73fc68 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-28  Tassilo Horn  <[email protected]>
+
+       * tex-info.el (Texinfo-make-node-list): Warn about duplicate
+       nodes.  Return nodes in order instead of reversed.
+
 2015-10-25  Vincent Belaïche  <[email protected]>
 
        * 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.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog   |    5 +++++
 tex-info.el |   28 ++++++++++++++++++----------
 2 files changed, 23 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX

_______________________________________________
auctex-diffs mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex-diffs

Reply via email to