Function: reftex-find-duplicate-labels
reftex-find-duplicate-labels is an autoloaded, interactive and
byte-compiled function defined in reftex-global.el.gz.
Signature
(reftex-find-duplicate-labels)
Documentation
Produce a list of all duplicate labels in the document.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/reftex-global.el.gz
;;;###autoload
(defun reftex-find-duplicate-labels ()
"Produce a list of all duplicate labels in the document."
(interactive)
;; Rescan the document to make sure
(reftex-access-scan-info t)
(let ((master (reftex-TeX-master-file))
(cnt 0)
(dlist
(mapcar
(lambda (x)
(let (x1)
(cond
((memq (car x)
'(toc bof eof bib thebib label-numbers xr xr-doc
master-dir file-error bibview-cache appendix
is-multi index))
nil)
(t
(setq x1 (reftex-all-assoc-string
(car x) (symbol-value reftex-docstruct-symbol)))
(if (< 1 (length x1))
(append (list (car x))
(mapcar (lambda(x)
(reftex--abbreviate-name (nth 3 x)))
x1))
(list nil))))))
(reftex-uniquify-by-car (symbol-value reftex-docstruct-symbol)))))
(setq dlist (reftex-uniquify-by-car dlist))
(if (null dlist) (error "No duplicate labels in document"))
(switch-to-buffer-other-window "*Duplicate Labels*")
(setq-local TeX-master master)
(erase-buffer)
(insert " MULTIPLE LABELS IN CURRENT DOCUMENT:\n")
(insert
(substitute-command-keys
" Move point to label and type \\`r' to run a query-replace on the label\n")
(substitute-command-keys
" and its references. Type \\`q' to exit this buffer.\n\n"))
(insert " LABEL FILE\n")
(insert " -------------------------------------------------------------\n")
(use-local-map (make-sparse-keymap))
(local-set-key [?q] (lambda () "Kill this buffer." (interactive)
(kill-buffer (current-buffer)) (delete-window)))
(local-set-key [?r] 'reftex-change-label)
(while dlist
(when (and (car (car dlist))
(cdr (car dlist)))
(incf cnt)
(insert (mapconcat #'identity (car dlist) "\n ") "\n"))
(pop dlist))
(goto-char (point-min))
(when (= cnt 0)
(kill-buffer (current-buffer))
(delete-window)
(message "Document does not contain duplicate labels."))))