1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00

* lisp/progmodes/cc-cmds.el: Don't use local vars as symbols

(c--call-post-self-insert-hook-more-safely-1): Avoid `add-hook` and
`run-hooks` on local vars.  Avoid O(n^2) while we're at it.
This commit is contained in:
Stefan Monnier 2020-01-20 09:50:32 -05:00
parent b3ad638a60
commit cdede988b4

View File

@ -512,11 +512,11 @@ function to control that."
(let ((src (default-value 'post-self-insert-hook)))
(while src
(unless (memq (car src) c--unsafe-post-self-insert-hook-functions)
(add-hook 'dest (car src) t)) ; Preserve the order of the functions.
(push (car src) dest))
(setq src (cdr src)))))
(t (add-hook 'dest (car src) t))) ; Preserve the order of the functions.
(t (push (car src) dest)))
(setq src (cdr src)))
(run-hooks 'dest)))
(mapc #'funcall (nreverse dest)))) ; Preserve the order of the functions.
(defmacro c--call-post-self-insert-hook-more-safely ()
;; Call post-self-insert-hook, if such exists. See comment for