mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
Replace some uses of cl with cl-lib
* lisp/progmodes/idlw-toolbar.el: No need for cl. * lisp/progmodes/antlr-mode.el, lisp/progmodes/idlw-shell.el: * lisp/progmodes/idlwave.el: Replace cl with cl-lib.
This commit is contained in:
parent
07e340daaf
commit
c5a363080c
4 changed files with 45 additions and 48 deletions
|
|
@ -82,8 +82,7 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'cl))
|
||||
(eval-when-compile (require 'cl-lib))
|
||||
|
||||
(require 'easymenu)
|
||||
(require 'cc-mode)
|
||||
|
|
@ -1066,7 +1065,7 @@ Used for `antlr-slow-syntactic-context'.")
|
|||
(buffer-syntactic-context-depth)
|
||||
nil)
|
||||
:EMACS
|
||||
;;; (incf antlr-statistics-inval)
|
||||
;;; (cl-incf antlr-statistics-inval)
|
||||
(setq antlr-slow-context-cache nil))
|
||||
|
||||
(defunx antlr-syntactic-context ()
|
||||
|
|
@ -1096,9 +1095,9 @@ WARNING: this may alter `match-data'."
|
|||
(if (>= orig antlr-slow-cache-diff-threshold)
|
||||
(beginning-of-defun)
|
||||
(goto-char (point-min)))
|
||||
;;; (cond ((and diff (< diff 0)) (incf antlr-statistics-full-neg))
|
||||
;;; ((and diff (>= diff 3000)) (incf antlr-statistics-full-diff))
|
||||
;;; (t (incf antlr-statistics-full-other)))
|
||||
;;; (cond ((and diff (< diff 0)) (cl-incf antlr-statistics-full-neg))
|
||||
;;; ((and diff (>= diff 3000)) (cl-incf antlr-statistics-full-diff))
|
||||
;;; (t (cl-incf antlr-statistics-full-other)))
|
||||
(setq state (parse-partial-sexp (point) orig)))
|
||||
(goto-char orig)
|
||||
(if antlr-slow-context-cache
|
||||
|
|
@ -1110,12 +1109,12 @@ WARNING: this may alter `match-data'."
|
|||
((nth 4 state) 'comment) ; block-comment? -- we don't care
|
||||
(t (car state)))))
|
||||
|
||||
;;; (incf (aref antlr-statistics 2))
|
||||
;;; (cl-incf (aref antlr-statistics 2))
|
||||
;;; (unless (and (eq (current-buffer)
|
||||
;;; (caar antlr-slow-context-cache))
|
||||
;;; (eq (buffer-modified-tick)
|
||||
;;; (cdar antlr-slow-context-cache)))
|
||||
;;; (incf (aref antlr-statistics 1))
|
||||
;;; (cl-incf (aref antlr-statistics 1))
|
||||
;;; (setq antlr-slow-context-cache nil))
|
||||
;;; (let* ((orig (point))
|
||||
;;; (base (cadr antlr-slow-context-cache))
|
||||
|
|
@ -1124,7 +1123,7 @@ WARNING: this may alter `match-data'."
|
|||
;;; ((eq orig (car base)) (cdr base))))
|
||||
;;; diff diff2)
|
||||
;;; (unless state
|
||||
;;; (incf (aref antlr-statistics 3))
|
||||
;;; (cl-incf (aref antlr-statistics 3))
|
||||
;;; (when curr
|
||||
;;; (if (< (setq diff (abs (- orig (car curr))))
|
||||
;;; (setq diff2 (abs (- orig (car base)))))
|
||||
|
|
@ -1137,7 +1136,7 @@ WARNING: this may alter `match-data'."
|
|||
;;; (setq state
|
||||
;;; (parse-partial-sexp (car state) orig nil nil (cdr state)))
|
||||
;;; (if (>= orig 3000) (beginning-of-defun) (goto-char (point-min)))
|
||||
;;; (incf (aref antlr-statistics 4))
|
||||
;;; (cl-incf (aref antlr-statistics 4))
|
||||
;;; (setq cw (list orig (point) base curr))
|
||||
;;; (setq state (parse-partial-sexp (point) orig)))
|
||||
;;; (goto-char orig)
|
||||
|
|
@ -1348,10 +1347,10 @@ is non-nil, move to beginning of the rule."
|
|||
(antlr-skip-exception-part skip-comment))
|
||||
(antlr-skip-file-prelude skip-comment))
|
||||
(if (< arg 0)
|
||||
(unless (and (< (point) pos) (zerop (incf arg)))
|
||||
(unless (and (< (point) pos) (zerop (cl-incf arg)))
|
||||
;; if we have moved backward, we already moved one defun backward
|
||||
(goto-char beg) ; rewind (to ";" / point)
|
||||
(while (and arg (<= (incf arg) 0))
|
||||
(while (and arg (<= (cl-incf arg) 0))
|
||||
(if (antlr-search-backward ";")
|
||||
(setq beg (point))
|
||||
(when (>= arg -1)
|
||||
|
|
@ -1368,9 +1367,9 @@ is non-nil, move to beginning of the rule."
|
|||
(antlr-skip-exception-part skip-comment)))
|
||||
(if (<= (point) pos) ; moved backward?
|
||||
(goto-char pos) ; rewind
|
||||
(decf arg)) ; already moved one defun forward
|
||||
(cl-decf arg)) ; already moved one defun forward
|
||||
(unless (zerop arg)
|
||||
(while (>= (decf arg) 0)
|
||||
(while (>= (cl-decf arg) 0)
|
||||
(antlr-search-forward ";"))
|
||||
(antlr-skip-exception-part skip-comment)))))
|
||||
|
||||
|
|
@ -1465,7 +1464,7 @@ If non-nil, TRANSFORM is used on literals instead of `downcase-region'."
|
|||
(antlr-invalidate-context-cache)
|
||||
(while (antlr-re-search-forward "\"\\(\\sw\\(\\sw\\|-\\)*\\)\"" nil)
|
||||
(funcall transform (match-beginning 0) (match-end 0))
|
||||
(incf literals))))
|
||||
(cl-incf literals))))
|
||||
(message "Transformed %d literals" literals)))
|
||||
|
||||
(defun antlr-upcase-literals ()
|
||||
|
|
@ -2131,7 +2130,7 @@ its export vocabulary is used as an import vocabulary."
|
|||
(or (null ivocab)
|
||||
(member ivocab import-vocabs) (push ivocab import-vocabs)))))
|
||||
(if classes
|
||||
(list* (file-name-nondirectory buffer-file-name)
|
||||
(cl-list* (file-name-nondirectory buffer-file-name)
|
||||
(cons (nreverse classes) (nreverse superclasses))
|
||||
(cons (nreverse export-vocabs) (nreverse import-vocabs))
|
||||
antlr-language))))
|
||||
|
|
@ -2277,7 +2276,7 @@ command `antlr-show-makefile-rules' for detail."
|
|||
(dolist (dep deps)
|
||||
(let ((supers (cdadr dep))
|
||||
(lang (cdr (assoc (cdddr dep) antlr-file-formats-alist))))
|
||||
(if n (incf n))
|
||||
(if n (cl-incf n))
|
||||
(antlr-makefile-insert-variable n "" " =")
|
||||
(if supers
|
||||
(insert " "
|
||||
|
|
@ -2313,7 +2312,7 @@ command `antlr-show-makefile-rules' for detail."
|
|||
(if n
|
||||
(let ((i 0))
|
||||
(antlr-makefile-insert-variable nil "" " =")
|
||||
(while (<= (incf i) n)
|
||||
(while (<= (cl-incf i) n)
|
||||
(antlr-makefile-insert-variable i " $(" ")"))
|
||||
(insert "\n" (car antlr-makefile-specification))))
|
||||
(if (string-equal (car antlr-makefile-specification) "\n")
|
||||
|
|
@ -2442,8 +2441,8 @@ to a lesser extent, `antlr-tab-offset-alist'."
|
|||
(goto-char boi)
|
||||
(unless (symbolp syntax) ; direct indentation
|
||||
;;(antlr-invalidate-context-cache)
|
||||
(incf indent (antlr-syntactic-context))
|
||||
(and (> indent 0) (looking-at antlr-indent-item-regexp) (decf indent))
|
||||
(cl-incf indent (antlr-syntactic-context))
|
||||
(and (> indent 0) (looking-at antlr-indent-item-regexp) (cl-decf indent))
|
||||
(setq indent (* indent c-basic-offset)))
|
||||
;; the usual major-mode indent stuff ---------------------------------
|
||||
(setq orig (- (point-max) orig))
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@
|
|||
(require 'comint)
|
||||
(require 'idlwave)
|
||||
|
||||
(eval-when-compile (require 'cl))
|
||||
(eval-when-compile (require 'cl-lib))
|
||||
|
||||
(defvar idlwave-shell-have-new-custom nil)
|
||||
|
||||
|
|
@ -2261,12 +2261,12 @@ overlays."
|
|||
(defun idlwave-shell-stack-up ()
|
||||
"Display the source code one step up the calling stack."
|
||||
(interactive)
|
||||
(incf idlwave-shell-calling-stack-index)
|
||||
(cl-incf idlwave-shell-calling-stack-index)
|
||||
(idlwave-shell-display-level-in-calling-stack 'hide))
|
||||
(defun idlwave-shell-stack-down ()
|
||||
"Display the source code one step down the calling stack."
|
||||
(interactive)
|
||||
(decf idlwave-shell-calling-stack-index)
|
||||
(cl-decf idlwave-shell-calling-stack-index)
|
||||
(idlwave-shell-display-level-in-calling-stack 'hide))
|
||||
|
||||
(defun idlwave-shell-goto-frame (&optional frame)
|
||||
|
|
@ -3597,7 +3597,7 @@ Existing overlays are recycled, in order to minimize consumption."
|
|||
(if ov-alist
|
||||
(while (setq ov-list (pop ov-alist))
|
||||
(while (setq ov (pop (cdr ov-list)))
|
||||
(pushnew (overlay-buffer ov) old-buffers)
|
||||
(cl-pushnew (overlay-buffer ov) old-buffers)
|
||||
(delete-overlay ov))))
|
||||
|
||||
(setq ov-alist idlwave-shell-bp-overlays
|
||||
|
|
|
|||
|
|
@ -34,8 +34,6 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile (require 'cl))
|
||||
|
||||
(defun idlwave-toolbar-make-button (image)
|
||||
(if (featurep 'xemacs)
|
||||
(toolbar-make-button-list image)
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@
|
|||
;;; Code:
|
||||
|
||||
|
||||
(eval-when-compile (require 'cl))
|
||||
(eval-when-compile (require 'cl-lib))
|
||||
(require 'idlw-help)
|
||||
|
||||
;; For XEmacs
|
||||
|
|
@ -3898,7 +3898,7 @@ Buffers containing unsaved changes require confirmation before they are killed."
|
|||
(and (or (memq t reasons)
|
||||
(memq (cdr entry) reasons))
|
||||
(kill-buffer (car entry))
|
||||
(incf cnt)
|
||||
(cl-incf cnt)
|
||||
(setq idlwave-outlawed-buffers
|
||||
(delq entry idlwave-outlawed-buffers)))
|
||||
(setq idlwave-outlawed-buffers
|
||||
|
|
@ -4104,14 +4104,14 @@ blank lines."
|
|||
(idlwave-sint-classes 10 10))))
|
||||
|
||||
;; Make sure these are lists
|
||||
(loop for entry in entries
|
||||
(cl-loop for entry in entries
|
||||
for var = (car entry)
|
||||
do (if (not (consp (symbol-value var))) (set var (list nil))))
|
||||
|
||||
;; Reset the system & library hash
|
||||
(when (or (eq what t) (eq what 'syslib)
|
||||
(null (cdr idlwave-sint-routines)))
|
||||
(loop for entry in entries
|
||||
(cl-loop for entry in entries
|
||||
for var = (car entry) for size = (nth 1 entry)
|
||||
do (setcdr (symbol-value var)
|
||||
(make-hash-table ':size size ':test 'equal)))
|
||||
|
|
@ -4121,7 +4121,7 @@ blank lines."
|
|||
;; Reset the buffer & shell hash
|
||||
(when (or (eq what t) (eq what 'bufsh)
|
||||
(null (car idlwave-sint-routines)))
|
||||
(loop for entry in entries
|
||||
(cl-loop for entry in entries
|
||||
for var = (car entry) for size = (nth 1 entry)
|
||||
do (setcar (symbol-value var)
|
||||
(make-hash-table ':size size ':test 'equal))))))
|
||||
|
|
@ -4680,7 +4680,7 @@ Gets set in cached XML rinfo, or `idlw-rinfo.el'.")
|
|||
(setq pref-list
|
||||
(if (match-string 1 kwd) '("X" "Y" "Z") '("X" "Y"))
|
||||
kwd (substring kwd (match-end 0)))
|
||||
(loop for x in pref-list do
|
||||
(cl-loop for x in pref-list do
|
||||
(push (list (concat x kwd) klink) kwds)))
|
||||
(push (list kwd klink) kwds)))
|
||||
|
||||
|
|
@ -4701,7 +4701,7 @@ Gets set in cached XML rinfo, or `idlw-rinfo.el'.")
|
|||
(cons (substring name 1) link)
|
||||
(if extra-kws (setq kwds (nconc kwds extra-kws)))
|
||||
(setq kwds (idlwave-rinfo-group-keywords kwds link))
|
||||
(loop for idx from 0 to 1 do
|
||||
(cl-loop for idx from 0 to 1 do
|
||||
(if (aref syntax-vec idx)
|
||||
(push (append (list name (if (eq idx 0) 'pro 'fun)
|
||||
class '(system)
|
||||
|
|
@ -4736,7 +4736,7 @@ Gets set in cached XML rinfo, or `idlw-rinfo.el'.")
|
|||
;; Clean up the syntax of routines which are actually aliases by
|
||||
;; removing the "OR" from the statements
|
||||
(let (syntax entry)
|
||||
(loop for x in aliases do
|
||||
(cl-loop for x in aliases do
|
||||
(setq entry (assoc x idlwave-system-routines))
|
||||
(when entry
|
||||
(while (string-match " +or +" (setq syntax (nth 4 entry)))
|
||||
|
|
@ -4746,7 +4746,7 @@ Gets set in cached XML rinfo, or `idlw-rinfo.el'.")
|
|||
;; Duplicate and trim original routine aliases from rinfo list
|
||||
;; This if for, e.g. OPENR/OPENW/OPENU
|
||||
(let (alias remove-list new parts all-parts)
|
||||
(loop for x in aliases do
|
||||
(cl-loop for x in aliases do
|
||||
(when (setq parts (split-string (cdr x) "/"))
|
||||
(setq new (assoc (cdr x) all-parts))
|
||||
(unless new
|
||||
|
|
@ -4755,30 +4755,30 @@ Gets set in cached XML rinfo, or `idlw-rinfo.el'.")
|
|||
(setcdr new (delete (car x) (cdr new)))))
|
||||
|
||||
;; Add any missing aliases (separate by slashes)
|
||||
(loop for x in all-parts do
|
||||
(cl-loop for x in all-parts do
|
||||
(if (cdr x)
|
||||
(push (cons (nth 1 x) (car x)) aliases)))
|
||||
|
||||
(loop for x in aliases do
|
||||
(cl-loop for x in aliases do
|
||||
(when (setq alias (assoc (cdr x) idlwave-system-routines))
|
||||
(unless (memq alias remove-list) (push alias remove-list))
|
||||
(setq alias (copy-sequence alias))
|
||||
(setcar alias (car x))
|
||||
(push alias idlwave-system-routines)))
|
||||
(loop for x in remove-list do
|
||||
(cl-loop for x in remove-list do
|
||||
(delq x idlwave-system-routines))))
|
||||
|
||||
(defun idlwave-convert-xml-clean-sysvar-aliases (aliases)
|
||||
;; Duplicate and trim original routine aliases from rinfo list
|
||||
;; This if for, e.g. !X, !Y, !Z.
|
||||
(let (alias remove-list)
|
||||
(loop for x in aliases do
|
||||
(cl-loop for x in aliases do
|
||||
(when (setq alias (assoc (cdr x) idlwave-system-variables-alist))
|
||||
(unless (memq alias remove-list) (push alias remove-list))
|
||||
(setq alias (copy-sequence alias))
|
||||
(setcar alias (car x))
|
||||
(push alias idlwave-system-variables-alist)))
|
||||
(loop for x in remove-list do
|
||||
(cl-loop for x in remove-list do
|
||||
(delq x idlwave-system-variables-alist))))
|
||||
|
||||
|
||||
|
|
@ -4875,7 +4875,7 @@ Cache to disk for quick recovery."
|
|||
(while rinfo
|
||||
(setq elem (car rinfo)
|
||||
rinfo (cdr rinfo))
|
||||
(incf elem-cnt)
|
||||
(cl-incf elem-cnt)
|
||||
(when (listp elem)
|
||||
(setq type (car elem)
|
||||
props (car (cdr elem)))
|
||||
|
|
@ -5106,7 +5106,7 @@ Cache to disk for quick recovery."
|
|||
"Return the class alist - make it if necessary."
|
||||
(or idlwave-class-alist
|
||||
(let (class)
|
||||
(loop for x in idlwave-routines do
|
||||
(cl-loop for x in idlwave-routines do
|
||||
(when (and (setq class (nth 2 x))
|
||||
(not (assq class idlwave-class-alist)))
|
||||
(push (list class) idlwave-class-alist)))
|
||||
|
|
@ -6223,7 +6223,7 @@ If yes, return the index (>=1)."
|
|||
(let (file (cnt 0))
|
||||
(catch 'exit
|
||||
(while entries
|
||||
(incf cnt)
|
||||
(cl-incf cnt)
|
||||
(setq file (idlwave-routine-source-file (nth 3 (car entries))))
|
||||
(if (and file (idlwave-syslib-p file))
|
||||
(throw 'exit cnt)
|
||||
|
|
@ -6520,7 +6520,7 @@ ARROW: Location of the arrow"
|
|||
(progn (up-list -1) t)
|
||||
(error nil))
|
||||
(setq pos (point))
|
||||
(incf cnt)
|
||||
(cl-incf cnt)
|
||||
(when (and (= (following-char) ?\()
|
||||
(re-search-backward
|
||||
"\\(::\\|\\<\\)\\([a-zA-Z][a-zA-Z0-9$_]*\\)[ \t]*\\="
|
||||
|
|
@ -8190,7 +8190,7 @@ demand _EXTRA in the keyword list."
|
|||
(while (setq re (pop regexps))
|
||||
(if (string-match re name) (throw 'exit t))))))
|
||||
|
||||
(loop for entry in (idlwave-routines) do
|
||||
(cl-loop for entry in (idlwave-routines) do
|
||||
(and (nth 2 entry) ; non-nil class
|
||||
(memq (nth 2 entry) super-classes) ; an inherited class
|
||||
(eq (nth 1 entry) type) ; correct type
|
||||
|
|
@ -8399,7 +8399,7 @@ If we do not know about MODULE, just return KEYWORD literally."
|
|||
"")
|
||||
(if (> total 1) "- " ""))
|
||||
entry props)
|
||||
(incf cnt)
|
||||
(cl-incf cnt)
|
||||
(when (and all (> cnt idlwave-rinfo-max-source-lines))
|
||||
;; No more source lines, please
|
||||
(insert (format
|
||||
|
|
@ -8707,7 +8707,7 @@ can be used to detect possible name clashes during this process."
|
|||
(> (idlwave-count-memq 'lib (nth 2 (car dtwins))) 1)
|
||||
(> (idlwave-count-memq 'user (nth 2 (car dtwins))) 1)
|
||||
(> (idlwave-count-memq 'buffer (nth 2 (car dtwins))) 1))
|
||||
(incf cnt)
|
||||
(cl-incf cnt)
|
||||
(insert (format "\n%s%s"
|
||||
(idlwave-make-full-name (nth 2 routine)
|
||||
(car routine))
|
||||
|
|
@ -8776,7 +8776,7 @@ routines, and may have been scanned."
|
|||
(cnt 0)
|
||||
source type type-cons file alist syslibp key)
|
||||
(while (setq entry (pop entries))
|
||||
(incf cnt)
|
||||
(cl-incf cnt)
|
||||
(setq source (nth 3 entry)
|
||||
type (car source)
|
||||
type-cons (cons type (nth 3 source))
|
||||
|
|
|
|||
Loading…
Reference in a new issue