mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
Reduce use of cl in lisp/emacs-lisp/.
* lisp/emacs-lisp/timer.el, lisp/emacs-lisp/syntax.el, lisp/emacs-lisp/smie.el: * lisp/emacs-lisp/ewoc.el, lisp/emacs-lisp/cconv.el,lisp/emacs-lisp/derived.el: * lisp/emacs-lisp/byte-opt.el, lisp/emacs-lisp/autoload.el: Convert to cl-lib. * lisp/emacs-lisp/easymenu.el, lisp/emacs-lisp/easy-mmode.el: * lisp/emacs-lisp/bytecomp.el: Use pcase instead of `cl'. * lisp/emacs-lisp/cl-lib.el: Get rid of special cl-macs auto load.
This commit is contained in:
parent
31ca4639ad
commit
f80efb8695
13 changed files with 245 additions and 262 deletions
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
;; Note: PPSS stands for `parse-partial-sexp state'
|
||||
|
||||
(eval-when-compile (require 'cl))
|
||||
(eval-when-compile (require 'cl-lib))
|
||||
|
||||
(defvar font-lock-beginning-of-syntax-function)
|
||||
|
||||
|
|
@ -181,7 +181,7 @@ Note: back-references in REGEXPs do not work."
|
|||
;; If there's more than 1 rule, and the rule want to apply
|
||||
;; highlight to match 0, create an extra group to be able to
|
||||
;; tell when *this* match 0 has succeeded.
|
||||
(incf offset)
|
||||
(cl-incf offset)
|
||||
(setq re (concat "\\(" re "\\)")))
|
||||
(setq re (syntax-propertize--shift-groups re offset))
|
||||
(let ((code '())
|
||||
|
|
@ -215,7 +215,7 @@ Note: back-references in REGEXPs do not work."
|
|||
(setq offset 0)))
|
||||
;; Now construct the code for each subgroup rules.
|
||||
(dolist (case (cdr rule))
|
||||
(assert (null (cddr case)))
|
||||
(cl-assert (null (cddr case)))
|
||||
(let* ((gn (+ offset (car case)))
|
||||
(action (nth 1 case))
|
||||
(thiscode
|
||||
|
|
@ -260,7 +260,7 @@ Note: back-references in REGEXPs do not work."
|
|||
code))))
|
||||
(push (cons condition (nreverse code))
|
||||
branches))
|
||||
(incf offset (regexp-opt-depth orig-re))
|
||||
(cl-incf offset (regexp-opt-depth orig-re))
|
||||
re))
|
||||
rules
|
||||
"\\|")))
|
||||
|
|
@ -418,8 +418,8 @@ Point is at POS when this function returns."
|
|||
(* 2 (/ (cdr (aref syntax-ppss-stats 5))
|
||||
(1+ (car (aref syntax-ppss-stats 5)))))))
|
||||
(progn
|
||||
(incf (car (aref syntax-ppss-stats 0)))
|
||||
(incf (cdr (aref syntax-ppss-stats 0)) (- pos old-pos))
|
||||
(cl-incf (car (aref syntax-ppss-stats 0)))
|
||||
(cl-incf (cdr (aref syntax-ppss-stats 0)) (- pos old-pos))
|
||||
(parse-partial-sexp old-pos pos nil nil old-ppss))
|
||||
|
||||
(cond
|
||||
|
|
@ -435,8 +435,8 @@ Point is at POS when this function returns."
|
|||
(setq pt-min (or (syntax-ppss-toplevel-pos old-ppss)
|
||||
(nth 2 old-ppss)))
|
||||
(<= pt-min pos) (< (- pos pt-min) syntax-ppss-max-span))
|
||||
(incf (car (aref syntax-ppss-stats 1)))
|
||||
(incf (cdr (aref syntax-ppss-stats 1)) (- pos pt-min))
|
||||
(cl-incf (car (aref syntax-ppss-stats 1)))
|
||||
(cl-incf (cdr (aref syntax-ppss-stats 1)) (- pos pt-min))
|
||||
(setq ppss (parse-partial-sexp pt-min pos)))
|
||||
;; The OLD-* data can't be used. Consult the cache.
|
||||
(t
|
||||
|
|
@ -464,8 +464,8 @@ Point is at POS when this function returns."
|
|||
;; Use the best of OLD-POS and CACHE.
|
||||
(if (or (not old-pos) (< old-pos pt-min))
|
||||
(setq pt-best pt-min ppss-best ppss)
|
||||
(incf (car (aref syntax-ppss-stats 4)))
|
||||
(incf (cdr (aref syntax-ppss-stats 4)) (- pos old-pos))
|
||||
(cl-incf (car (aref syntax-ppss-stats 4)))
|
||||
(cl-incf (cdr (aref syntax-ppss-stats 4)) (- pos old-pos))
|
||||
(setq pt-best old-pos ppss-best old-ppss))
|
||||
|
||||
;; Use the `syntax-begin-function' if available.
|
||||
|
|
@ -490,21 +490,21 @@ Point is at POS when this function returns."
|
|||
(not (memq (get-text-property (point) 'face)
|
||||
'(font-lock-string-face font-lock-doc-face
|
||||
font-lock-comment-face))))
|
||||
(incf (car (aref syntax-ppss-stats 5)))
|
||||
(incf (cdr (aref syntax-ppss-stats 5)) (- pos (point)))
|
||||
(cl-incf (car (aref syntax-ppss-stats 5)))
|
||||
(cl-incf (cdr (aref syntax-ppss-stats 5)) (- pos (point)))
|
||||
(setq pt-best (point) ppss-best nil))
|
||||
|
||||
(cond
|
||||
;; Quick case when we found a nearby pos.
|
||||
((< (- pos pt-best) syntax-ppss-max-span)
|
||||
(incf (car (aref syntax-ppss-stats 2)))
|
||||
(incf (cdr (aref syntax-ppss-stats 2)) (- pos pt-best))
|
||||
(cl-incf (car (aref syntax-ppss-stats 2)))
|
||||
(cl-incf (cdr (aref syntax-ppss-stats 2)) (- pos pt-best))
|
||||
(setq ppss (parse-partial-sexp pt-best pos nil nil ppss-best)))
|
||||
;; Slow case: compute the state from some known position and
|
||||
;; populate the cache so we won't need to do it again soon.
|
||||
(t
|
||||
(incf (car (aref syntax-ppss-stats 3)))
|
||||
(incf (cdr (aref syntax-ppss-stats 3)) (- pos pt-min))
|
||||
(cl-incf (car (aref syntax-ppss-stats 3)))
|
||||
(cl-incf (cdr (aref syntax-ppss-stats 3)) (- pos pt-min))
|
||||
|
||||
;; If `pt-min' is too far, add a few intermediate entries.
|
||||
(while (> (- pos pt-min) (* 2 syntax-ppss-max-span))
|
||||
|
|
@ -513,7 +513,7 @@ Point is at POS when this function returns."
|
|||
nil nil ppss))
|
||||
(let ((pair (cons pt-min ppss)))
|
||||
(if cache-pred
|
||||
(push pair (cdr cache-pred))
|
||||
(cl-push pair (cdr cache-pred))
|
||||
(push pair syntax-ppss-cache))))
|
||||
|
||||
;; Compute the actual return value.
|
||||
|
|
@ -533,7 +533,7 @@ Point is at POS when this function returns."
|
|||
(let ((pair (cons pos ppss)))
|
||||
(if cache-pred
|
||||
(if (> (- (caar cache-pred) pos) syntax-ppss-max-span)
|
||||
(push pair (cdr cache-pred))
|
||||
(cl-push pair (cdr cache-pred))
|
||||
(setcar cache-pred pair))
|
||||
(if (or (null syntax-ppss-cache)
|
||||
(> (- (caar syntax-ppss-cache) pos)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue