summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/syntax.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2019-05-29 15:56:14 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2019-05-29 15:56:14 -0400
commitfe0cb43fb80db52a79ef898f8de49560cc5cdd90 (patch)
tree4825956db223eb96d69583e707cbf13a4d280789 /lisp/emacs-lisp/syntax.el
parent49cdbb4a35f8d1d2139e8469bffcf33f65679094 (diff)
downloademacs-fe0cb43fb80db52a79ef898f8de49560cc5cdd90.tar.gz
emacs-fe0cb43fb80db52a79ef898f8de49560cc5cdd90.tar.bz2
emacs-fe0cb43fb80db52a79ef898f8de49560cc5cdd90.zip
* lisp/subr.el (add-hook): Turn `append` into `depth` (bug#35508)
Make it possible to control the relative ordering of functions on hooks by specifying `depth` in the same was as was possible with `add-function`. * lisp/electric.el (electric--sort-post-self-insertion-hook): Delete function. (electric-indent-mode, electric-layout-mode, electric-quote-mode): * lisp/elec-pair.el (electric-pair-mode): Use new `depth` arg instead of electric--sort-post-self-insertion-hook. * lisp/emacs-lisp/syntax.el (syntax-propertize, syntax-ppss): Use new `depth` arg to make sure noone accidentally gets added after syntax-ppss-flush-cache. * doc/lispref/modes.texi (Setting Hooks): Document new `depth` arg. * test/lisp/subr-tests.el (subr-tests-add-hook-depth): New test.
Diffstat (limited to 'lisp/emacs-lisp/syntax.el')
-rw-r--r--lisp/emacs-lisp/syntax.el13
1 files changed, 7 insertions, 6 deletions
diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el
index f1904e64efb..9c6d5b5829f 100644
--- a/lisp/emacs-lisp/syntax.el
+++ b/lisp/emacs-lisp/syntax.el
@@ -298,7 +298,7 @@ END) suitable for `syntax-propertize-function'."
;; between syntax-ppss and syntax-propertize, we also have to make
;; sure the flush function is installed here (bug#29767).
(add-hook 'before-change-functions
- #'syntax-ppss-flush-cache t t))
+ #'syntax-ppss-flush-cache 99 t))
(save-excursion
(with-silent-modifications
(make-local-variable 'syntax-propertize--done) ;Just in case!
@@ -430,7 +430,7 @@ These are valid when the buffer has no restriction.")
;; Unregister if there's no cache left. Sadly this doesn't work
;; because `before-change-functions' is temporarily bound to nil here.
;; (unless cache
- ;; (remove-hook 'before-change-functions 'syntax-ppss-flush-cache t))
+ ;; (remove-hook 'before-change-functions #'syntax-ppss-flush-cache t))
(setcar cell last)
(setcdr cell cache)))
))
@@ -534,13 +534,14 @@ running the hook."
;; Setup the before-change function if necessary.
(unless (or ppss-cache ppss-last)
- ;; We should be either the very last function on
- ;; before-change-functions or the very first on
- ;; after-change-functions.
;; Note: combine-change-calls-1 needs to be kept in sync
;; with this!
(add-hook 'before-change-functions
- 'syntax-ppss-flush-cache t t))
+ #'syntax-ppss-flush-cache
+ ;; We should be either the very last function on
+ ;; before-change-functions or the very first on
+ ;; after-change-functions.
+ 99 t))
;; Use the best of OLD-POS and CACHE.
(if (or (not old-pos) (< old-pos pt-min))