summaryrefslogtreecommitdiff
path: root/lisp/textmodes/reftex.el
diff options
context:
space:
mode:
authorMark Oteiza <mvoteiza@udel.edu>2016-11-19 13:34:24 -0500
committerMark Oteiza <mvoteiza@udel.edu>2016-11-19 13:41:09 -0500
commitb19e05b13192f72991b65b4b352e09c807fd581c (patch)
treece0ef9ef2f92c7740b7f75410a7c387717ee557f /lisp/textmodes/reftex.el
parent92b3528cf3e6d366086e89b9a909f0c81614a064 (diff)
downloademacs-b19e05b13192f72991b65b4b352e09c807fd581c.tar.gz
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.
Diffstat (limited to 'lisp/textmodes/reftex.el')
-rw-r--r--lisp/textmodes/reftex.el66
1 files changed, 33 insertions, 33 deletions
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 @@
;;; Code:
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
;; Stuff that needs to be there when we use defcustom
(require 'custom)
@@ -290,7 +290,7 @@ on the menu bar.
(defun reftex-next-multifile-index ()
;; Return the next free index for multifile symbols.
- (incf reftex-multifile-index))
+ (cl-incf reftex-multifile-index))
(defun reftex-tie-multifile-symbols ()
"Tie the buffer-local symbols to globals connected with the master file.
@@ -479,7 +479,7 @@ will deactivate it."
(unless (member style list)
(setq reftex-tables-dirty t
changed t)
- (add-to-list 'list style t)))
+ (setq list (append list (list style)))))
((eq action 'deactivate)
(when (member style list)
(setq reftex-tables-dirty t
@@ -488,7 +488,7 @@ will deactivate it."
(t
(if (member style list)
(delete style list)
- (add-to-list 'list style t))
+ (setq list (append list (list style))))
(setq reftex-tables-dirty t
changed t)))
(when changed
@@ -831,15 +831,15 @@ This enforces rescanning the buffer on next use."
reffmt (nth 1 fmt))
;; Note a new typekey
(if typekey
- (add-to-list 'reftex-typekey-list typekey))
+ (cl-pushnew typekey reftex-typekey-list :test #'equal))
(if (and typekey prefix
(not (assoc prefix reftex-prefix-to-typekey-alist)))
- (add-to-list 'reftex-prefix-to-typekey-alist
- (cons prefix typekey)))
+ (cl-pushnew (cons prefix typekey) reftex-prefix-to-typekey-alist
+ :test #'equal))
(if (and typekey prefix
(not (assoc typekey reftex-typekey-to-prefix-alist)))
- (add-to-list 'reftex-typekey-to-prefix-alist
- (cons typekey prefix)))
+ (cl-pushnew (cons typekey prefix) reftex-typekey-to-prefix-alist
+ :test #'equal))
;; Check if this is a macro or environment
(cond
((symbolp env-or-mac)
@@ -848,17 +848,17 @@ This enforces rescanning the buffer on next use."
(message "Warning: %s does not seem to be a valid function"
env-or-mac))
(setq nargs nil nlabel nil opt-args nil)
- (add-to-list 'reftex-special-env-parsers env-or-mac)
+ (cl-pushnew env-or-mac reftex-special-env-parsers)
(setq env-or-mac (symbol-name env-or-mac)))
((string-match "\\`\\\\" env-or-mac)
;; It's a macro
(let ((result (reftex-parse-args env-or-mac)))
- (setq env-or-mac (or (first result) env-or-mac)
- nargs (second result)
- nlabel (third result)
- opt-args (fourth result))
- (if nlabel (add-to-list 'macros-with-labels env-or-mac)))
- (if typekey (add-to-list 'reftex-label-mac-list env-or-mac)))
+ (setq env-or-mac (or (cl-first result) env-or-mac)
+ nargs (cl-second result)
+ nlabel (cl-third result)
+ opt-args (cl-fourth result))
+ (if nlabel (cl-pushnew env-or-mac macros-with-labels :test #'equal)))
+ (if typekey (cl-pushnew env-or-mac reftex-label-mac-list :test #'equal)))
(t
;; It's an environment
(setq nargs nil nlabel nil opt-args nil)
@@ -866,7 +866,7 @@ This enforces rescanning the buffer on next use."
((string= env-or-mac ""))
((string= env-or-mac "section"))
(t
- (add-to-list 'reftex-label-env-list env-or-mac)
+ (cl-pushnew env-or-mac reftex-label-env-list :test #'equal)
(if toc-level
(let ((string (format "begin{%s}" env-or-mac)))
(or (assoc string toc-levels)
@@ -950,7 +950,7 @@ This enforces rescanning the buffer on next use."
(not (member (aref fmt i) '(?%))))
(setq word (concat word "\\|" (regexp-quote
(substring fmt 0 (1+ i)))))
- (incf i))
+ (cl-incf i))
(cons (concat word "\\)\\=") typekey))
(nreverse reftex-words-to-typekey-alist)))
@@ -976,10 +976,10 @@ This enforces rescanning the buffer on next use."
(t t))
all-index (cdr all-index))
(let ((result (reftex-parse-args macro)))
- (setq macro (or (first result) macro)
- nargs (second result)
- nindex (third result)
- opt-args (fourth result))
+ (setq macro (or (cl-first result) macro)
+ nargs (cl-second result)
+ nindex (cl-third result)
+ opt-args (cl-fourth result))
(unless (member macro reftex-macros-with-index)
;; 0 1 2 3 4 5 6 7
(push (list macro tag prefix verify nargs nindex opt-args repeat)
@@ -1003,7 +1003,7 @@ This enforces rescanning the buffer on next use."
(mapconcat
(lambda(x)
(format "[%c] %-20.20s%s" (car x) (nth 1 x)
- (if (= 0 (mod (incf i) 3)) "\n" "")))
+ (if (= 0 (mod (cl-incf i) 3)) "\n" "")))
reftex-key-to-index-macro-alist "")))
;; Make the full list of section levels
@@ -1093,7 +1093,7 @@ This enforces rescanning the buffer on next use."
(args (substring macro (match-beginning 0)))
opt-list nlabel (cnt 0))
(while (string-match "\\`[[{]\\(\\*\\)?[]}]" args)
- (incf cnt)
+ (cl-incf cnt)
(when (eq ?\[ (string-to-char args))
(push cnt opt-list))
(when (and (match-end 1)
@@ -1158,7 +1158,7 @@ This enforces rescanning the buffer on next use."
(defun reftex-silence-toc-markers (list n)
;; Set all toc markers in the first N entries in list to nil
- (while (and list (> (decf n) -1))
+ (while (and list (> (cl-decf n) -1))
(and (eq (car (car list)) 'toc)
(markerp (nth 4 (car list)))
(set-marker (nth 4 (car list)) nil))
@@ -1289,7 +1289,7 @@ Valid actions are: readable, restore, read, kill, write."
"SELECT EXTERNAL DOCUMENT\n------------------------\n"
(mapconcat
(lambda (x)
- (format fmt (incf n) (or (car x) "")
+ (format fmt (cl-incf n) (or (car x) "")
(abbreviate-file-name (cdr x))))
xr-alist ""))
nil t))
@@ -1793,11 +1793,11 @@ When DIE is non-nil, throw an error if file not found."
;; with limited Magic
;; The magic goes away
- (letf ((format-alist nil)
- (auto-mode-alist (reftex-auto-mode-alist))
- ((default-value 'major-mode) 'fundamental-mode)
- (enable-local-variables nil)
- (after-insert-file-functions nil))
+ (cl-letf ((format-alist nil)
+ (auto-mode-alist (reftex-auto-mode-alist))
+ ((default-value 'major-mode) 'fundamental-mode)
+ (enable-local-variables nil)
+ (after-insert-file-functions nil))
(setq buf (find-file-noselect file)))
;; Is there a hook to run?
@@ -1807,7 +1807,7 @@ When DIE is non-nil, throw an error if file not found."
;; Let's see if we got a license to kill :-|
(and mark-to-kill
- (add-to-list 'reftex-buffers-to-kill buf))
+ (cl-pushnew buf reftex-buffers-to-kill))
;; Return the new buffer
buf)
@@ -2265,7 +2265,7 @@ IGNORE-WORDS List of words which should be removed from the string."
:style 'toggle
:selected `(member ,elt (reftex-ref-style-list))))
(unless (member item list)
- (add-to-list 'list item t)))
+ (setq list (append list (list item)))))
list))
("Citation Style"
,@(mapcar