aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Oteiza2016-11-19 13:34:24 -0500
committerMark Oteiza2016-11-19 13:41:09 -0500
commitb19e05b13192f72991b65b4b352e09c807fd581c (patch)
treece0ef9ef2f92c7740b7f75410a7c387717ee557f
parent92b3528cf3e6d366086e89b9a909f0c81614a064 (diff)
downloademacs-b19e05b13192f72991b65b4b352e09c807fd581c.tar.gz
emacs-b19e05b13192f72991b65b4b352e09c807fd581c.zip
Port RefTeX to cl-lib
* lisp/textmodes/reftex-auc.el: * lisp/textmodes/reftex-cite.el: Use cl-lib. (reftex-do-citation, reftex-create-bibtex-file): Substitute cl-lib macros. * lisp/textmodes/reftex-dcr.el: Use cl-lib. (reftex-view-regexp-match): Substitute cl-lib macro. * lisp/textmodes/reftex-global.el: Use cl-lib. (reftex-find-duplicate-labels, reftex-renumber-simple-labels): (reftex-translate): Substitute cl-lib macros. * lisp/textmodes/reftex-index.el: Use cl-lib. (reftex-index, reftex-index-select-tag, reftex-index-mode-map): (reftex-index-next-phrase, reftex-index-phrases-info): (reftex-query-index-phrase): Substitute cl-lib macros. * lisp/textmodes/reftex-parse.el: Use cl-lib. (reftex-parse-from-file, reftex-where-am-I, reftex-what-macro): (reftex-nth-arg, reftex-init-section-numbers, reftex-section-number): Substitute cl-lib macros. * lisp/textmodes/reftex-ref.el: Use cl-lib. (reftex-uniquify-label, reftex-offer-label-menu): Substitute cl-lib macros. * lisp/textmodes/reftex-sel.el: Use cl-lib. (reftex-select-shared-map): Set keymap parent to special-mode-map. Flatten loop and remove digits and hyphen definitions from the map. (reftex-select-label-mode-map): (reftex-select-bib-mode-map): Use cl-lib macro, and flatten other loop. (reftex-insert-docstruct, reftex-select-unmark): Use cl-lib macros. * lisp/textmodes/reftex-vars.el (reftex-vref-is-default): Use cl-pushnew. * lisp/textmodes/reftex.el: Use cl-lib. (reftex-docstruct-symbol): Use cl-incf. (reftex-ref-style-toggle): Replace add-to-list with append. (reftex-compile-variables): Use cl-lib macros, and functions with compiler macros. cl-first is just an alias. (reftex-parse-args, reftex-scanning-info-available-p): (reftex-select-external-document, reftex-get-file-buffer-force): Use cl-lib macros. (reftex-isearch-minor-mode): Replace add-to-list with append.
-rw-r--r--lisp/textmodes/reftex-auc.el2
-rw-r--r--lisp/textmodes/reftex-cite.el6
-rw-r--r--lisp/textmodes/reftex-dcr.el4
-rw-r--r--lisp/textmodes/reftex-global.el8
-rw-r--r--lisp/textmodes/reftex-index.el30
-rw-r--r--lisp/textmodes/reftex-parse.el24
-rw-r--r--lisp/textmodes/reftex-ref.el6
-rw-r--r--lisp/textmodes/reftex-sel.el102
-rw-r--r--lisp/textmodes/reftex-vars.el6
-rw-r--r--lisp/textmodes/reftex.el66
10 files changed, 121 insertions, 133 deletions
diff --git a/lisp/textmodes/reftex-auc.el b/lisp/textmodes/reftex-auc.el
index 505df5d3424..8efe8a2ec19 100644
--- a/lisp/textmodes/reftex-auc.el
+++ b/lisp/textmodes/reftex-auc.el
@@ -24,7 +24,7 @@
24 24
25;;; Code: 25;;; Code:
26 26
27(eval-when-compile (require 'cl)) 27(eval-when-compile (require 'cl-lib))
28 28
29(require 'reftex) 29(require 'reftex)
30 30
diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el
index 20cfedc503d..fd7915ccc76 100644
--- a/lisp/textmodes/reftex-cite.el
+++ b/lisp/textmodes/reftex-cite.el
@@ -24,7 +24,7 @@
24 24
25;;; Code: 25;;; Code:
26 26
27(eval-when-compile (require 'cl)) 27(eval-when-compile (require 'cl-lib))
28 28
29(require 'reftex) 29(require 'reftex)
30 30
@@ -744,7 +744,7 @@ While entering the regexp, completion on knows citation keys is possible.
744 (if (> arg 1) 744 (if (> arg 1)
745 (progn 745 (progn
746 (skip-chars-backward "}") 746 (skip-chars-backward "}")
747 (decf arg) 747 (cl-decf arg)
748 (reftex-do-citation arg)) 748 (reftex-do-citation arg))
749 (forward-char 1))) 749 (forward-char 1)))
750 750
@@ -1210,7 +1210,7 @@ created files in the variables `reftex-create-bibtex-header' or
1210 ;; check for crossref entries 1210 ;; check for crossref entries
1211 (let* ((attr-list (reftex-parse-bibtex-entry nil beg end)) 1211 (let* ((attr-list (reftex-parse-bibtex-entry nil beg end))
1212 (xref-key (cdr (assoc "crossref" attr-list)))) 1212 (xref-key (cdr (assoc "crossref" attr-list))))
1213 (if xref-key (pushnew xref-key keys))) 1213 (if xref-key (cl-pushnew xref-key keys)))
1214 ;; check for string references 1214 ;; check for string references
1215 (let* ((raw-fields (reftex-parse-bibtex-entry nil beg end t)) 1215 (let* ((raw-fields (reftex-parse-bibtex-entry nil beg end t))
1216 (string-fields (reftex-get-string-refs raw-fields))) 1216 (string-fields (reftex-get-string-refs raw-fields)))
diff --git a/lisp/textmodes/reftex-dcr.el b/lisp/textmodes/reftex-dcr.el
index f1d4d6fcba8..65742f36f78 100644
--- a/lisp/textmodes/reftex-dcr.el
+++ b/lisp/textmodes/reftex-dcr.el
@@ -24,7 +24,7 @@
24 24
25;;; Code: 25;;; Code:
26 26
27(eval-when-compile (require 'cl)) 27(eval-when-compile (require 'cl-lib))
28 28
29(declare-function bibtex-beginning-of-entry "bibtex" ()) 29(declare-function bibtex-beginning-of-entry "bibtex" ())
30 30
@@ -424,7 +424,7 @@ Calling this function several times find successive citation locations."
424 (if match 424 (if match
425 (progn 425 (progn
426 (put 'reftex-view-regexp-match :props newprop) 426 (put 'reftex-view-regexp-match :props newprop)
427 (put 'reftex-view-regexp-match :cnt (incf cnt)) 427 (put 'reftex-view-regexp-match :cnt (cl-incf cnt))
428 (reftex-highlight 0 (match-beginning highlight-group) 428 (reftex-highlight 0 (match-beginning highlight-group)
429 (match-end highlight-group)) 429 (match-end highlight-group))
430 (add-hook 'pre-command-hook 'reftex-highlight-shall-die) 430 (add-hook 'pre-command-hook 'reftex-highlight-shall-die)
diff --git a/lisp/textmodes/reftex-global.el b/lisp/textmodes/reftex-global.el
index d2500510443..c8c62a0d944 100644
--- a/lisp/textmodes/reftex-global.el
+++ b/lisp/textmodes/reftex-global.el
@@ -24,7 +24,7 @@
24 24
25;;; Code: 25;;; Code:
26 26
27(eval-when-compile (require 'cl)) 27(eval-when-compile (require 'cl-lib))
28(provide 'reftex-global) 28(provide 'reftex-global)
29(require 'reftex) 29(require 'reftex)
30;;; 30;;;
@@ -154,7 +154,7 @@ No active TAGS table is required."
154 (while dlist 154 (while dlist
155 (when (and (car (car dlist)) 155 (when (and (car (car dlist))
156 (cdr (car dlist))) 156 (cdr (car dlist)))
157 (incf cnt) 157 (cl-incf cnt)
158 (insert (mapconcat 'identity (car dlist) "\n ") "\n")) 158 (insert (mapconcat 'identity (car dlist) "\n ") "\n"))
159 (pop dlist)) 159 (pop dlist))
160 (goto-char (point-min)) 160 (goto-char (point-min))
@@ -223,7 +223,7 @@ one with the `xr' package."
223 (if (assoc label translate-alist) 223 (if (assoc label translate-alist)
224 (error "Duplicate label %s" label)) 224 (error "Duplicate label %s" label))
225 (setq new-label (concat (match-string 1 (car entry)) 225 (setq new-label (concat (match-string 1 (car entry))
226 (int-to-string (incf (cdr nr-cell))))) 226 (int-to-string (cl-incf (cdr nr-cell)))))
227 (push (cons label new-label) translate-alist) 227 (push (cons label new-label) translate-alist)
228 (or (string= label new-label) (setq changed-sequence t)))) 228 (or (string= label new-label) (setq changed-sequence t))))
229 229
@@ -302,7 +302,7 @@ one with the `xr' package."
302 (error "Abort"))) 302 (error "Abort")))
303 (reftex-unhighlight 1))) 303 (reftex-unhighlight 1)))
304 ((and test cell) 304 ((and test cell)
305 (incf n)) 305 (cl-incf n))
306 ((and (not test) cell) 306 ((and (not test) cell)
307 ;; Replace 307 ;; Replace
308 (goto-char (match-beginning 1)) 308 (goto-char (match-beginning 1))
diff --git a/lisp/textmodes/reftex-index.el b/lisp/textmodes/reftex-index.el
index 3cea589a9cf..4dd190d2b0f 100644
--- a/lisp/textmodes/reftex-index.el
+++ b/lisp/textmodes/reftex-index.el
@@ -24,7 +24,7 @@
24 24
25;;; Code: 25;;; Code:
26 26
27(eval-when-compile (require 'cl)) 27(eval-when-compile (require 'cl-lib))
28(declare-function texmathp "ext:texmathp" ()) 28(declare-function texmathp "ext:texmathp" ())
29 29
30(require 'reftex) 30(require 'reftex)
@@ -128,7 +128,7 @@ will prompt for other arguments."
128 128
129 ;; Insert the macro and ask for any additional args 129 ;; Insert the macro and ask for any additional args
130 (insert macro) 130 (insert macro)
131 (loop for i from 1 to nargs do 131 (cl-loop for i from 1 to nargs do
132 (setq opt (member i opt-args) 132 (setq opt (member i opt-args)
133 value (cond ((= nindex i) key) 133 value (cond ((= nindex i) key)
134 ((equal ntag i) tag1) 134 ((equal ntag i) tag1)
@@ -214,16 +214,16 @@ will prompt for other arguments."
214 i -1 214 i -1
215 val nil) 215 val nil)
216 (catch 'exit 216 (catch 'exit
217 (while (and (< (incf i) len) (null val)) 217 (while (and (< (cl-incf i) len) (null val))
218 (unless (assq (aref tag i) tag-alist) 218 (unless (assq (aref tag i) tag-alist)
219 (push (list (aref tag i) 219 (push (list (aref tag i)
220 tag 220 tag
221 (concat (substring tag 0 i) 221 (concat (substring tag 0 i)
222 "[" (substring tag i (incf i)) "]" 222 "[" (substring tag i (cl-incf i)) "]"
223 (substring tag i))) 223 (substring tag i)))
224 tag-alist) 224 tag-alist)
225 (throw 'exit t))) 225 (throw 'exit t)))
226 (push (list (+ ?0 (incf cnt)) tag 226 (push (list (+ ?0 (cl-incf cnt)) tag
227 (concat "[" (int-to-string cnt) "]:" tag)) 227 (concat "[" (int-to-string cnt) "]:" tag))
228 tag-alist))) 228 tag-alist)))
229 (setq tag-alist (nreverse tag-alist)) 229 (setq tag-alist (nreverse tag-alist))
@@ -317,10 +317,10 @@ will prompt for other arguments."
317 (define-key map "c" 'reftex-index-toggle-context) 317 (define-key map "c" 'reftex-index-toggle-context)
318 318
319 ;; The capital letters and the exclamation mark 319 ;; The capital letters and the exclamation mark
320 (loop for key across (concat "!" reftex-index-section-letters) do 320 (cl-loop for key across (concat "!" reftex-index-section-letters) do
321 (define-key map (vector (list key)) 321 (define-key map (vector (list key))
322 (list 'lambda '() '(interactive) 322 (list 'lambda '() '(interactive)
323 (list 'reftex-index-goto-letter key)))) 323 (list 'reftex-index-goto-letter key))))
324 324
325 (easy-menu-define reftex-index-menu map 325 (easy-menu-define reftex-index-menu map
326 "Menu for Index buffer" 326 "Menu for Index buffer"
@@ -1426,7 +1426,7 @@ Here are all local bindings.
1426 (interactive "p") 1426 (interactive "p")
1427 (reftex-index-phrases-parse-header t) 1427 (reftex-index-phrases-parse-header t)
1428 (while (> arg 0) 1428 (while (> arg 0)
1429 (decf arg) 1429 (cl-decf arg)
1430 (end-of-line) 1430 (end-of-line)
1431 (if (re-search-forward reftex-index-phrases-phrase-regexp12 nil t) 1431 (if (re-search-forward reftex-index-phrases-phrase-regexp12 nil t)
1432 (progn 1432 (progn
@@ -1655,11 +1655,11 @@ this function repeatedly."
1655 (widen) 1655 (widen)
1656 (goto-char (point-min)) 1656 (goto-char (point-min))
1657 (while (re-search-forward re1 nil t) 1657 (while (re-search-forward re1 nil t)
1658 (incf ntimes1)) 1658 (cl-incf ntimes1))
1659 (goto-char (point-min)) 1659 (goto-char (point-min))
1660 (while (re-search-forward re2 nil t) 1660 (while (re-search-forward re2 nil t)
1661 (push (cons (count-lines 1 (point)) (match-string 1)) superphrases) 1661 (push (cons (count-lines 1 (point)) (match-string 1)) superphrases)
1662 (incf ntimes2)))) 1662 (cl-incf ntimes2))))
1663 (save-current-buffer 1663 (save-current-buffer
1664 (while (setq file (pop files)) 1664 (while (setq file (pop files))
1665 (setq buf (reftex-get-file-buffer-force file)) 1665 (setq buf (reftex-get-file-buffer-force file))
@@ -1672,7 +1672,7 @@ this function repeatedly."
1672 (let ((case-fold-search reftex-index-phrases-case-fold-search)) 1672 (let ((case-fold-search reftex-index-phrases-case-fold-search))
1673 (while (re-search-forward re nil t) 1673 (while (re-search-forward re nil t)
1674 (or (reftex-in-comment) 1674 (or (reftex-in-comment)
1675 (incf nmatches))))))))) 1675 (cl-incf nmatches)))))))))
1676 (with-output-to-temp-buffer "*Help*" 1676 (with-output-to-temp-buffer "*Help*"
1677 (princ (format " Phrase: %s\n" phrase)) 1677 (princ (format " Phrase: %s\n" phrase))
1678 (princ (format " Macro key: %s\n" char)) 1678 (princ (format " Macro key: %s\n" char))
@@ -1682,7 +1682,7 @@ this function repeatedly."
1682 (index-key 1682 (index-key
1683 (let ((iks index-keys) (cnt 0) ik) 1683 (let ((iks index-keys) (cnt 0) ik)
1684 (while (setq ik (pop iks)) 1684 (while (setq ik (pop iks))
1685 (princ (format "Index entry %d: %s\n" (incf cnt) ik))))) 1685 (princ (format "Index entry %d: %s\n" (cl-incf cnt) ik)))))
1686 (repeat 1686 (repeat
1687 (princ (format " Index entry: %s\n" phrase))) 1687 (princ (format " Index entry: %s\n" phrase)))
1688 (t 1688 (t
@@ -1943,7 +1943,7 @@ both ends."
1943 (cond ((member char '(?y ?Y ?\ )) 1943 (cond ((member char '(?y ?Y ?\ ))
1944 ;; Yes! 1944 ;; Yes!
1945 (replace-match rpl t t) 1945 (replace-match rpl t t)
1946 (incf replace-count) 1946 (cl-incf replace-count)
1947 ;; See if we should insert newlines to shorten lines 1947 ;; See if we should insert newlines to shorten lines
1948 (and reftex-index-phrases-wrap-long-lines 1948 (and reftex-index-phrases-wrap-long-lines
1949 (reftex-index-phrases-fixup-line beg end)) 1949 (reftex-index-phrases-fixup-line beg end))
diff --git a/lisp/textmodes/reftex-parse.el b/lisp/textmodes/reftex-parse.el
index 1d6fa311d5f..9180bea3d3b 100644
--- a/lisp/textmodes/reftex-parse.el
+++ b/lisp/textmodes/reftex-parse.el
@@ -24,7 +24,7 @@
24 24
25;;; Code: 25;;; Code:
26 26
27(eval-when-compile (require 'cl)) 27(eval-when-compile (require 'cl-lib))
28 28
29(require 'reftex) 29(require 'reftex)
30 30
@@ -306,7 +306,7 @@ of master file."
306 (when reftex-support-index 306 (when reftex-support-index
307 (setq index-entry (reftex-index-info file)) 307 (setq index-entry (reftex-index-info file))
308 (when index-entry 308 (when index-entry
309 (add-to-list 'reftex--index-tags (nth 1 index-entry)) 309 (cl-pushnew (nth 1 index-entry) reftex--index-tags :test #'equal)
310 (push index-entry docstruct)))) 310 (push index-entry docstruct))))
311 311
312 ((match-end 11) 312 ((match-end 11)
@@ -608,7 +608,7 @@ if the information is exact (t) or approximate (nil)."
608 found) 608 found)
609 (save-excursion 609 (save-excursion
610 (while (not rtn) 610 (while (not rtn)
611 (incf cnt) 611 (cl-incf cnt)
612 (setq found (re-search-backward (reftex-everything-regexp) nil t)) 612 (setq found (re-search-backward (reftex-everything-regexp) nil t))
613 (setq rtn 613 (setq rtn
614 (cond 614 (cond
@@ -672,7 +672,7 @@ if the information is exact (t) or approximate (nil)."
672 (when (and (eq (car (car list)) 'index) 672 (when (and (eq (car (car list)) 'index)
673 (string= (nth 2 index-info) 673 (string= (nth 2 index-info)
674 (nth 2 (car list)))) 674 (nth 2 (car list))))
675 (incf n) 675 (cl-incf n)
676 (setq dist (abs (- (point) (nth 4 (car list))))) 676 (setq dist (abs (- (point) (nth 4 (car list)))))
677 (if (or (not last-dist) (< dist last-dist)) 677 (if (or (not last-dist) (< dist last-dist))
678 (setq last-dist dist last (car list)))) 678 (setq last-dist dist last (car list))))
@@ -841,8 +841,8 @@ considered an argument of macro \\macro."
841 (let ((forward-sexp-function nil)) 841 (let ((forward-sexp-function nil))
842 (backward-sexp) t) 842 (backward-sexp) t)
843 (error nil))) 843 (error nil)))
844 (if (eq (following-char) ?\[) (incf cnt-opt)) 844 (if (eq (following-char) ?\[) (cl-incf cnt-opt))
845 (incf cnt)) 845 (cl-incf cnt))
846 (setq pos (point)) 846 (setq pos (point))
847 (when (and (or (= (following-char) ?\[) 847 (when (and (or (= (following-char) ?\[)
848 (= (following-char) ?\{)) 848 (= (following-char) ?\{))
@@ -984,18 +984,18 @@ OPT-ARGS is a list of argument numbers which are optional."
984 (while (< cnt n) 984 (while (< cnt n)
985 (while (and (member cnt opt-args) 985 (while (and (member cnt opt-args)
986 (eq (following-char) ?\{)) 986 (eq (following-char) ?\{))
987 (incf cnt)) 987 (cl-incf cnt))
988 (when (< cnt n) 988 (when (< cnt n)
989 (unless (and (condition-case nil 989 (unless (and (condition-case nil
990 (or (forward-list 1) t) 990 (or (forward-list 1) t)
991 (error nil)) 991 (error nil))
992 (reftex-move-to-next-arg) 992 (reftex-move-to-next-arg)
993 (incf cnt)) 993 (cl-incf cnt))
994 (setq cnt 1000)))) 994 (setq cnt 1000))))
995 995
996 (while (and (memq cnt opt-args) 996 (while (and (memq cnt opt-args)
997 (eq (following-char) ?\{)) 997 (eq (following-char) ?\{))
998 (incf cnt))) 998 (cl-incf cnt)))
999 (if (and (= n cnt) 999 (if (and (= n cnt)
1000 (> (skip-chars-forward "{\\[") 0)) 1000 (> (skip-chars-forward "{\\[") 0))
1001 (reftex-context-substring) 1001 (reftex-context-substring)
@@ -1057,7 +1057,7 @@ When point is just after a { or [, limit string to matching parenthesis"
1057 (- (string-to-char number-string) ?A -1)) 1057 (- (string-to-char number-string) ?A -1))
1058 (aset reftex-section-numbers i (string-to-number number-string))) 1058 (aset reftex-section-numbers i (string-to-number number-string)))
1059 (pop numbers)) 1059 (pop numbers))
1060 (decf i))) 1060 (cl-decf i)))
1061 (put 'reftex-section-numbers 'appendix appendix)) 1061 (put 'reftex-section-numbers 'appendix appendix))
1062 1062
1063;;;###autoload 1063;;;###autoload
@@ -1081,7 +1081,7 @@ When LEVEL is non-nil, increase section numbers on that level."
1081 (if (or (not partspecial) 1081 (if (or (not partspecial)
1082 (not (= idx 1))) 1082 (not (= idx 1)))
1083 (aset reftex-section-numbers idx 0)) 1083 (aset reftex-section-numbers idx 0))
1084 (incf idx)))) 1084 (cl-incf idx))))
1085 (if partspecial 1085 (if partspecial
1086 (setq string (concat "Part " (reftex-roman-number 1086 (setq string (concat "Part " (reftex-roman-number
1087 (aref reftex-section-numbers 0)))) 1087 (aref reftex-section-numbers 0))))
@@ -1091,7 +1091,7 @@ When LEVEL is non-nil, increase section numbers on that level."
1091 (if (not (and partspecial (not (equal string "")))) 1091 (if (not (and partspecial (not (equal string ""))))
1092 (setq string (concat string (if (not (string= string "")) "." "") 1092 (setq string (concat string (if (not (string= string "")) "." "")
1093 (int-to-string n)))) 1093 (int-to-string n))))
1094 (incf idx)) 1094 (cl-incf idx))
1095 (save-match-data 1095 (save-match-data
1096 (if (string-match "\\`\\([@0]\\.\\)+" string) 1096 (if (string-match "\\`\\([@0]\\.\\)+" string)
1097 (setq string (replace-match "" nil nil string))) 1097 (setq string (replace-match "" nil nil string)))
diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el
index f5a784bf63d..fdde4aa0541 100644
--- a/lisp/textmodes/reftex-ref.el
+++ b/lisp/textmodes/reftex-ref.el
@@ -24,7 +24,7 @@
24 24
25;;; Code: 25;;; Code:
26 26
27(eval-when-compile (require 'cl)) 27(eval-when-compile (require 'cl-lib))
28 28
29(require 'reftex) 29(require 'reftex)
30(require 'reftex-parse) 30(require 'reftex-parse)
@@ -374,7 +374,7 @@ also applies `reftex-translate-to-ascii-function' to the string."
374 (sep (or separator ""))) 374 (sep (or separator "")))
375 (while (assoc (concat label sep (int-to-string num)) 375 (while (assoc (concat label sep (int-to-string num))
376 (symbol-value reftex-docstruct-symbol)) 376 (symbol-value reftex-docstruct-symbol))
377 (incf num)) 377 (cl-incf num))
378 (setcdr cell num) 378 (setcdr cell num)
379 (concat label sep (int-to-string num)))))) 379 (concat label sep (int-to-string num))))))
380 380
@@ -566,7 +566,7 @@ When called with 2 C-u prefix args, disable magic word recognition."
566 (reftex-erase-buffer)) 566 (reftex-erase-buffer))
567 (unless (eq major-mode 'reftex-select-label-mode) 567 (unless (eq major-mode 'reftex-select-label-mode)
568 (reftex-select-label-mode)) 568 (reftex-select-label-mode))
569 (add-to-list 'selection-buffers (current-buffer)) 569 (cl-pushnew (current-buffer) selection-buffers)
570 (setq truncate-lines t) 570 (setq truncate-lines t)
571 (setq mode-line-format 571 (setq mode-line-format
572 (list "---- " 'mode-line-buffer-identification 572 (list "---- " 'mode-line-buffer-identification
diff --git a/lisp/textmodes/reftex-sel.el b/lisp/textmodes/reftex-sel.el
index 02caa67e9a8..d3a7ee49804 100644
--- a/lisp/textmodes/reftex-sel.el
+++ b/lisp/textmodes/reftex-sel.el
@@ -24,7 +24,7 @@
24 24
25;;; Code: 25;;; Code:
26 26
27(eval-when-compile (require 'cl)) 27(eval-when-compile (require 'cl-lib))
28 28
29(require 'reftex) 29(require 'reftex)
30 30
@@ -32,6 +32,7 @@
32;; and reftex-select-bib-mode-map. 32;; and reftex-select-bib-mode-map.
33(defvar reftex-select-shared-map 33(defvar reftex-select-shared-map
34 (let ((map (make-sparse-keymap))) 34 (let ((map (make-sparse-keymap)))
35 (set-keymap-parent map special-mode-map)
35 (substitute-key-definition 36 (substitute-key-definition
36 'next-line 'reftex-select-next map global-map) 37 'next-line 'reftex-select-next map global-map)
37 (substitute-key-definition 38 (substitute-key-definition
@@ -41,31 +42,23 @@
41 (substitute-key-definition 42 (substitute-key-definition
42 'newline 'reftex-select-accept map global-map) 43 'newline 'reftex-select-accept map global-map)
43 44
44 (loop for x in 45 (define-key map " " 'reftex-select-callback)
45 '((" " . reftex-select-callback) 46 (define-key map "n" 'reftex-select-next)
46 ("n" . reftex-select-next) 47 (define-key map [(down)] 'reftex-select-next)
47 ([(down)] . reftex-select-next) 48 (define-key map "p" 'reftex-select-previous)
48 ("p" . reftex-select-previous) 49 (define-key map [(up)] 'reftex-select-previous)
49 ([(up)] . reftex-select-previous) 50 (define-key map "f" 'reftex-select-toggle-follow)
50 ("f" . reftex-select-toggle-follow) 51 (define-key map "\C-m" 'reftex-select-accept)
51 ("\C-m" . reftex-select-accept) 52 (define-key map [(return)] 'reftex-select-accept)
52 ([(return)] . reftex-select-accept) 53 (define-key map "q" 'reftex-select-quit)
53 ("q" . reftex-select-quit) 54 (define-key map "." 'reftex-select-show-insertion-point)
54 ("." . reftex-select-show-insertion-point) 55 (define-key map "?" 'reftex-select-help)
55 ("?" . reftex-select-help))
56 do (define-key map (car x) (cdr x)))
57 56
58 ;; The mouse-2 binding 57 ;; The mouse-2 binding
59 (if (featurep 'xemacs) 58 (if (featurep 'xemacs)
60 (define-key map [(button2)] 'reftex-select-mouse-accept) 59 (define-key map [(button2)] 'reftex-select-mouse-accept)
61 (define-key map [(mouse-2)] 'reftex-select-mouse-accept) 60 (define-key map [(mouse-2)] 'reftex-select-mouse-accept)
62 (define-key map [follow-link] 'mouse-face)) 61 (define-key map [follow-link] 'mouse-face))
63
64
65 ;; Digit arguments
66 (loop for key across "0123456789" do
67 (define-key map (vector (list key)) 'digit-argument))
68 (define-key map "-" 'negative-argument)
69 map)) 62 map))
70 63
71(define-obsolete-variable-alias 64(define-obsolete-variable-alias
@@ -74,28 +67,25 @@
74 (let ((map (make-sparse-keymap))) 67 (let ((map (make-sparse-keymap)))
75 (set-keymap-parent map reftex-select-shared-map) 68 (set-keymap-parent map reftex-select-shared-map)
76 69
77 (loop for key across "aAcgFlrRstx#%" do 70 (cl-loop for key across "aAcgFlrRstx#%" do
78 (define-key map (vector (list key)) 71 (define-key map (vector (list key))
79 (list 'lambda '() 72 (list 'lambda '()
80 "Press `?' during selection to find out about this key." 73 "Press `?' during selection to find out about this key."
81 '(interactive) (list 'throw '(quote myexit) key)))) 74 '(interactive) (list 'throw '(quote myexit) key))))
82 75
83 (loop for x in 76 (define-key map "b" 'reftex-select-jump-to-previous)
84 '(("b" . reftex-select-jump-to-previous) 77 (define-key map "z" 'reftex-select-jump)
85 ("z" . reftex-select-jump) 78 (define-key map "v" 'reftex-select-cycle-ref-style-forward)
86 ("v" . reftex-select-cycle-ref-style-forward) 79 (define-key map "V" 'reftex-select-cycle-ref-style-backward)
87 ("V" . reftex-select-cycle-ref-style-backward) 80 (define-key map "m" 'reftex-select-mark)
88 ("m" . reftex-select-mark) 81 (define-key map "u" 'reftex-select-unmark)
89 ("u" . reftex-select-unmark) 82 (define-key map "," 'reftex-select-mark-comma)
90 ("," . reftex-select-mark-comma) 83 (define-key map "-" 'reftex-select-mark-to)
91 ("-" . reftex-select-mark-to) 84 (define-key map "+" 'reftex-select-mark-and)
92 ("+" . reftex-select-mark-and) 85 (define-key map [(tab)] 'reftex-select-read-label)
93 ([(tab)] . reftex-select-read-label) 86 (define-key map "\C-i" 'reftex-select-read-label)
94 ("\C-i" . reftex-select-read-label) 87 (define-key map "\C-c\C-n" 'reftex-select-next-heading)
95 ("\C-c\C-n" . reftex-select-next-heading) 88 (define-key map "\C-c\C-p" 'reftex-select-previous-heading)
96 ("\C-c\C-p" . reftex-select-previous-heading))
97 do
98 (define-key map (car x) (cdr x)))
99 89
100 map) 90 map)
101 "Keymap used for *RefTeX Select* buffer, when selecting a label. 91 "Keymap used for *RefTeX Select* buffer, when selecting a label.
@@ -130,18 +120,16 @@ During a selection process, these are the local bindings.
130 (let ((map (make-sparse-keymap))) 120 (let ((map (make-sparse-keymap)))
131 (set-keymap-parent map reftex-select-shared-map) 121 (set-keymap-parent map reftex-select-shared-map)
132 122
133 (loop for key across "grRaAeE" do 123 (cl-loop for key across "grRaAeE" do
134 (define-key map (vector (list key)) 124 (define-key map (vector (list key))
135 (list 'lambda '() 125 (list 'lambda '()
136 "Press `?' during selection to find out about this key." 126 "Press `?' during selection to find out about this key."
137 '(interactive) (list 'throw '(quote myexit) key)))) 127 '(interactive) (list 'throw '(quote myexit) key))))
138 128
139 (loop for x in 129 (define-key map "\C-i" 'reftex-select-read-cite)
140 '(("\C-i" . reftex-select-read-cite) 130 (define-key map [(tab)] 'reftex-select-read-cite)
141 ([(tab)] . reftex-select-read-cite) 131 (define-key map "m" 'reftex-select-mark)
142 ("m" . reftex-select-mark) 132 (define-key map "u" 'reftex-select-unmark)
143 ("u" . reftex-select-unmark))
144 do (define-key map (car x) (cdr x)))
145 133
146 map) 134 map)
147 "Keymap used for *RefTeX Select* buffer, when selecting a BibTeX entry. 135 "Keymap used for *RefTeX Select* buffer, when selecting a BibTeX entry.
@@ -272,7 +260,7 @@ During a selection process, these are the local bindings.
272 ;; Walk the docstruct and insert the appropriate stuff 260 ;; Walk the docstruct and insert the appropriate stuff
273 (while (setq cell (pop all)) 261 (while (setq cell (pop all))
274 262
275 (incf index) 263 (cl-incf index)
276 (setq from (point)) 264 (setq from (point))
277 265
278 (cond 266 (cond
@@ -342,7 +330,7 @@ During a selection process, these are the local bindings.
342 (or show-commented (null comment))) 330 (or show-commented (null comment)))
343 331
344 ;; Yes we want this one 332 ;; Yes we want this one
345 (incf cnt) 333 (cl-incf cnt)
346 (setq prev-inserted cell) 334 (setq prev-inserted cell)
347; (if (eq offset 'attention) (setq offset cell)) 335; (if (eq offset 'attention) (setq offset cell))
348 336
@@ -728,8 +716,8 @@ Cycle in reverse order if optional argument REVERSE is non-nil."
728 (setq sep (nth 2 c)) 716 (setq sep (nth 2 c))
729 (reftex-overlay-put (nth 1 c) 'before-string 717 (reftex-overlay-put (nth 1 c) 'before-string
730 (if sep 718 (if sep
731 (format "*%c%d* " sep (decf cnt)) 719 (format "*%c%d* " sep (cl-decf cnt))
732 (format "*%d* " (decf cnt))))) 720 (format "*%d* " (cl-decf cnt)))))
733 reftex-select-marked) 721 reftex-select-marked)
734 (message "Entry no longer marked"))) 722 (message "Entry no longer marked")))
735 723
diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el
index d1a6b87da2e..d6de53b2466 100644
--- a/lisp/textmodes/reftex-vars.el
+++ b/lisp/textmodes/reftex-vars.el
@@ -24,7 +24,7 @@
24 24
25;;; Code: 25;;; Code:
26(defvar reftex-tables-dirty) 26(defvar reftex-tables-dirty)
27(eval-when-compile (require 'cl)) 27(eval-when-compile (require 'cl-lib))
28(eval-and-compile 28(eval-and-compile
29 (defun reftex-set-dirty (symbol value) 29 (defun reftex-set-dirty (symbol value)
30 (setq reftex-tables-dirty t) 30 (setq reftex-tables-dirty t)
@@ -1076,9 +1076,9 @@ used in the variable `reftex-ref-style-alist'."
1076 1076
1077;; Compatibility with obsolete variables. 1077;; Compatibility with obsolete variables.
1078(when reftex-vref-is-default 1078(when reftex-vref-is-default
1079 (add-to-list 'reftex-ref-style-default-list "Varioref")) 1079 (cl-pushnew "Varioref" reftex-ref-style-default-list :test #'equal))
1080(when reftex-fref-is-default 1080(when reftex-fref-is-default
1081 (add-to-list 'reftex-ref-style-default-list "Fancyref")) 1081 (cl-pushnew "Fancyref" reftex-ref-style-default-list :test #'equal))
1082 1082
1083(defcustom reftex-level-indent 2 1083(defcustom reftex-level-indent 2
1084 "Number of spaces to be used for indentation per section level." 1084 "Number of spaces to be used for indentation per section level."
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el
index 24fa0d145e8..adc5076daf1 100644
--- a/lisp/textmodes/reftex.el
+++ b/lisp/textmodes/reftex.el
@@ -50,7 +50,7 @@
50 50
51;;; Code: 51;;; Code:
52 52
53(eval-when-compile (require 'cl)) 53(eval-when-compile (require 'cl-lib))
54 54
55;; Stuff that needs to be there when we use defcustom 55;; Stuff that needs to be there when we use defcustom
56(require 'custom) 56(require 'custom)
@@ -290,7 +290,7 @@ on the menu bar.
290 290
291(defun reftex-next-multifile-index () 291(defun reftex-next-multifile-index ()
292 ;; Return the next free index for multifile symbols. 292 ;; Return the next free index for multifile symbols.
293 (incf reftex-multifile-index)) 293 (cl-incf reftex-multifile-index))
294 294
295(defun reftex-tie-multifile-symbols () 295(defun reftex-tie-multifile-symbols ()
296 "Tie the buffer-local symbols to globals connected with the master file. 296 "Tie the buffer-local symbols to globals connected with the master file.
@@ -479,7 +479,7 @@ will deactivate it."
479 (unless (member style list) 479 (unless (member style list)
480 (setq reftex-tables-dirty t 480 (setq reftex-tables-dirty t
481 changed t) 481 changed t)
482 (add-to-list 'list style t))) 482 (setq list (append list (list style)))))
483 ((eq action 'deactivate) 483 ((eq action 'deactivate)
484 (when (member style list) 484 (when (member style list)
485 (setq reftex-tables-dirty t 485 (setq reftex-tables-dirty t
@@ -488,7 +488,7 @@ will deactivate it."
488 (t 488 (t
489 (if (member style list) 489 (if (member style list)
490 (delete style list) 490 (delete style list)
491 (add-to-list 'list style t)) 491 (setq list (append list (list style))))
492 (setq reftex-tables-dirty t 492 (setq reftex-tables-dirty t
493 changed t))) 493 changed t)))
494 (when changed 494 (when changed
@@ -831,15 +831,15 @@ This enforces rescanning the buffer on next use."
831 reffmt (nth 1 fmt)) 831 reffmt (nth 1 fmt))
832 ;; Note a new typekey 832 ;; Note a new typekey
833 (if typekey 833 (if typekey
834 (add-to-list 'reftex-typekey-list typekey)) 834 (cl-pushnew typekey reftex-typekey-list :test #'equal))
835 (if (and typekey prefix 835 (if (and typekey prefix
836 (not (assoc prefix reftex-prefix-to-typekey-alist))) 836 (not (assoc prefix reftex-prefix-to-typekey-alist)))
837 (add-to-list 'reftex-prefix-to-typekey-alist 837 (cl-pushnew (cons prefix typekey) reftex-prefix-to-typekey-alist
838 (cons prefix typekey))) 838 :test #'equal))
839 (if (and typekey prefix 839 (if (and typekey prefix
840 (not (assoc typekey reftex-typekey-to-prefix-alist))) 840 (not (assoc typekey reftex-typekey-to-prefix-alist)))
841 (add-to-list 'reftex-typekey-to-prefix-alist 841 (cl-pushnew (cons typekey prefix) reftex-typekey-to-prefix-alist
842 (cons typekey prefix))) 842 :test #'equal))
843 ;; Check if this is a macro or environment 843 ;; Check if this is a macro or environment
844 (cond 844 (cond
845 ((symbolp env-or-mac) 845 ((symbolp env-or-mac)
@@ -848,17 +848,17 @@ This enforces rescanning the buffer on next use."
848 (message "Warning: %s does not seem to be a valid function" 848 (message "Warning: %s does not seem to be a valid function"
849 env-or-mac)) 849 env-or-mac))
850 (setq nargs nil nlabel nil opt-args nil) 850 (setq nargs nil nlabel nil opt-args nil)
851 (add-to-list 'reftex-special-env-parsers env-or-mac) 851 (cl-pushnew env-or-mac reftex-special-env-parsers)
852 (setq env-or-mac (symbol-name env-or-mac))) 852 (setq env-or-mac (symbol-name env-or-mac)))
853 ((string-match "\\`\\\\" env-or-mac) 853 ((string-match "\\`\\\\" env-or-mac)
854 ;; It's a macro 854 ;; It's a macro
855 (let ((result (reftex-parse-args env-or-mac))) 855 (let ((result (reftex-parse-args env-or-mac)))
856 (setq env-or-mac (or (first result) env-or-mac) 856 (setq env-or-mac (or (cl-first result) env-or-mac)
857 nargs (second result) 857 nargs (cl-second result)
858 nlabel (third result) 858 nlabel (cl-third result)
859 opt-args (fourth result)) 859 opt-args (cl-fourth result))
860 (if nlabel (add-to-list 'macros-with-labels env-or-mac))) 860 (if nlabel (cl-pushnew env-or-mac macros-with-labels :test #'equal)))
861 (if typekey (add-to-list 'reftex-label-mac-list env-or-mac))) 861 (if typekey (cl-pushnew env-or-mac reftex-label-mac-list :test #'equal)))
862 (t 862 (t
863 ;; It's an environment 863 ;; It's an environment
864 (setq nargs nil nlabel nil opt-args nil) 864 (setq nargs nil nlabel nil opt-args nil)
@@ -866,7 +866,7 @@ This enforces rescanning the buffer on next use."
866 ((string= env-or-mac "")) 866 ((string= env-or-mac ""))
867 ((string= env-or-mac "section")) 867 ((string= env-or-mac "section"))
868 (t 868 (t
869 (add-to-list 'reftex-label-env-list env-or-mac) 869 (cl-pushnew env-or-mac reftex-label-env-list :test #'equal)
870 (if toc-level 870 (if toc-level
871 (let ((string (format "begin{%s}" env-or-mac))) 871 (let ((string (format "begin{%s}" env-or-mac)))
872 (or (assoc string toc-levels) 872 (or (assoc string toc-levels)
@@ -950,7 +950,7 @@ This enforces rescanning the buffer on next use."
950 (not (member (aref fmt i) '(?%)))) 950 (not (member (aref fmt i) '(?%))))
951 (setq word (concat word "\\|" (regexp-quote 951 (setq word (concat word "\\|" (regexp-quote
952 (substring fmt 0 (1+ i))))) 952 (substring fmt 0 (1+ i)))))
953 (incf i)) 953 (cl-incf i))
954 (cons (concat word "\\)\\=") typekey)) 954 (cons (concat word "\\)\\=") typekey))
955 (nreverse reftex-words-to-typekey-alist))) 955 (nreverse reftex-words-to-typekey-alist)))
956 956
@@ -976,10 +976,10 @@ This enforces rescanning the buffer on next use."
976 (t t)) 976 (t t))
977 all-index (cdr all-index)) 977 all-index (cdr all-index))
978 (let ((result (reftex-parse-args macro))) 978 (let ((result (reftex-parse-args macro)))
979 (setq macro (or (first result) macro) 979 (setq macro (or (cl-first result) macro)
980 nargs (second result) 980 nargs (cl-second result)
981 nindex (third result) 981 nindex (cl-third result)
982 opt-args (fourth result)) 982 opt-args (cl-fourth result))
983 (unless (member macro reftex-macros-with-index) 983 (unless (member macro reftex-macros-with-index)
984 ;; 0 1 2 3 4 5 6 7 984 ;; 0 1 2 3 4 5 6 7
985 (push (list macro tag prefix verify nargs nindex opt-args repeat) 985 (push (list macro tag prefix verify nargs nindex opt-args repeat)
@@ -1003,7 +1003,7 @@ This enforces rescanning the buffer on next use."
1003 (mapconcat 1003 (mapconcat
1004 (lambda(x) 1004 (lambda(x)
1005 (format "[%c] %-20.20s%s" (car x) (nth 1 x) 1005 (format "[%c] %-20.20s%s" (car x) (nth 1 x)
1006 (if (= 0 (mod (incf i) 3)) "\n" ""))) 1006 (if (= 0 (mod (cl-incf i) 3)) "\n" "")))
1007 reftex-key-to-index-macro-alist ""))) 1007 reftex-key-to-index-macro-alist "")))
1008 1008
1009 ;; Make the full list of section levels 1009 ;; Make the full list of section levels
@@ -1093,7 +1093,7 @@ This enforces rescanning the buffer on next use."
1093 (args (substring macro (match-beginning 0))) 1093 (args (substring macro (match-beginning 0)))
1094 opt-list nlabel (cnt 0)) 1094 opt-list nlabel (cnt 0))
1095 (while (string-match "\\`[[{]\\(\\*\\)?[]}]" args) 1095 (while (string-match "\\`[[{]\\(\\*\\)?[]}]" args)
1096 (incf cnt) 1096 (cl-incf cnt)
1097 (when (eq ?\[ (string-to-char args)) 1097 (when (eq ?\[ (string-to-char args))
1098 (push cnt opt-list)) 1098 (push cnt opt-list))
1099 (when (and (match-end 1) 1099 (when (and (match-end 1)
@@ -1158,7 +1158,7 @@ This enforces rescanning the buffer on next use."
1158 1158
1159(defun reftex-silence-toc-markers (list n) 1159(defun reftex-silence-toc-markers (list n)
1160 ;; Set all toc markers in the first N entries in list to nil 1160 ;; Set all toc markers in the first N entries in list to nil
1161 (while (and list (> (decf n) -1)) 1161 (while (and list (> (cl-decf n) -1))
1162 (and (eq (car (car list)) 'toc) 1162 (and (eq (car (car list)) 'toc)
1163 (markerp (nth 4 (car list))) 1163 (markerp (nth 4 (car list)))
1164 (set-marker (nth 4 (car list)) nil)) 1164 (set-marker (nth 4 (car list)) nil))
@@ -1289,7 +1289,7 @@ Valid actions are: readable, restore, read, kill, write."
1289 "SELECT EXTERNAL DOCUMENT\n------------------------\n" 1289 "SELECT EXTERNAL DOCUMENT\n------------------------\n"
1290 (mapconcat 1290 (mapconcat
1291 (lambda (x) 1291 (lambda (x)
1292 (format fmt (incf n) (or (car x) "") 1292 (format fmt (cl-incf n) (or (car x) "")
1293 (abbreviate-file-name (cdr x)))) 1293 (abbreviate-file-name (cdr x))))
1294 xr-alist "")) 1294 xr-alist ""))
1295 nil t)) 1295 nil t))
@@ -1793,11 +1793,11 @@ When DIE is non-nil, throw an error if file not found."
1793 ;; with limited Magic 1793 ;; with limited Magic
1794 1794
1795 ;; The magic goes away 1795 ;; The magic goes away
1796 (letf ((format-alist nil) 1796 (cl-letf ((format-alist nil)
1797 (auto-mode-alist (reftex-auto-mode-alist)) 1797 (auto-mode-alist (reftex-auto-mode-alist))
1798 ((default-value 'major-mode) 'fundamental-mode) 1798 ((default-value 'major-mode) 'fundamental-mode)
1799 (enable-local-variables nil) 1799 (enable-local-variables nil)
1800 (after-insert-file-functions nil)) 1800 (after-insert-file-functions nil))
1801 (setq buf (find-file-noselect file))) 1801 (setq buf (find-file-noselect file)))
1802 1802
1803 ;; Is there a hook to run? 1803 ;; Is there a hook to run?
@@ -1807,7 +1807,7 @@ When DIE is non-nil, throw an error if file not found."
1807 1807
1808 ;; Let's see if we got a license to kill :-| 1808 ;; Let's see if we got a license to kill :-|
1809 (and mark-to-kill 1809 (and mark-to-kill
1810 (add-to-list 'reftex-buffers-to-kill buf)) 1810 (cl-pushnew buf reftex-buffers-to-kill))
1811 1811
1812 ;; Return the new buffer 1812 ;; Return the new buffer
1813 buf) 1813 buf)
@@ -2265,7 +2265,7 @@ IGNORE-WORDS List of words which should be removed from the string."
2265 :style 'toggle 2265 :style 'toggle
2266 :selected `(member ,elt (reftex-ref-style-list)))) 2266 :selected `(member ,elt (reftex-ref-style-list))))
2267 (unless (member item list) 2267 (unless (member item list)
2268 (add-to-list 'list item t))) 2268 (setq list (append list (list item)))))
2269 list)) 2269 list))
2270 ("Citation Style" 2270 ("Citation Style"
2271 ,@(mapcar 2271 ,@(mapcar