# HG changeset patch # User Stefan Monnier # Date 1147011065 0 # Node ID 53adfd470fe447c293611dea7c3e5f257e365757 # Parent f30d66ed3e9a419aac43deaeb584da120064aacd (syntax-ppss): Flush the cache before rather than after a buffer modification. diff -r f30d66ed3e9a -r 53adfd470fe4 lisp/ChangeLog --- a/lisp/ChangeLog Sun May 07 12:09:42 2006 +0000 +++ b/lisp/ChangeLog Sun May 07 14:11:05 2006 +0000 @@ -1,3 +1,8 @@ +2006-05-07 Stefan Monnier + + * emacs-lisp/syntax.el (syntax-ppss): Flush the cache before rather + than after a buffer modification. + 2006-05-08 Nick Roberts * progmodes/gdb-ui.el (gdb-var-create-handler): Move speedbar @@ -8,9 +13,8 @@ (gdb-speedbar-update, gdb-speedbar-timer-fn): New functions. Use speedbar-timer-fn instead of speedbar-refresh (reverting earlier change). - (gdb-var-evaluate-expression-handler) - (gdb-var-list-children-handler-1, gdb-var-update-handler-1): - Use it. + (gdb-var-evaluate-expression-handler) + (gdb-var-list-children-handler-1, gdb-var-update-handler-1): Use it. * speedbar.el (speedbar-timer-fn): Remove save-window-excursion. Update localized contents for all buffers except ignored modes. @@ -29,14 +33,14 @@ 2006-05-07 John Paul Wallington - * ibuffer.el (ibuffer-compressed-file-name-regexp): Avoid - `regexp-opt'; simplify regexp for readability. + * ibuffer.el (ibuffer-compressed-file-name-regexp): + Avoid `regexp-opt'; simplify regexp for readability. 2006-05-06 Eli Zaretskii - * ldefs-boot.el (dired-do-redisplay, dired-maybe-insert-subdir): - * files.el (buffer-stale-function): - * dired-aux.el (dired-do-redisplay, dired-maybe-insert-subdir): + * ldefs-boot.el (dired-do-redisplay, dired-maybe-insert-subdir): + * files.el (buffer-stale-function): + * dired-aux.el (dired-do-redisplay, dired-maybe-insert-subdir): * autorevert.el (global-auto-revert-non-file-buffers): Point Info links to the main manual, not to emacs-xtra. diff -r f30d66ed3e9a -r 53adfd470fe4 lisp/emacs-lisp/syntax.el --- a/lisp/emacs-lisp/syntax.el Sun May 07 12:09:42 2006 +0000 +++ b/lisp/emacs-lisp/syntax.el Sun May 07 14:11:05 2006 +0000 @@ -27,9 +27,9 @@ ;; The main exported function is `syntax-ppss'. You might also need ;; to call `syntax-ppss-flush-cache' or to add it to -;; after-change-functions'(although this is automatically done by +;; before-change-functions'(although this is automatically done by ;; syntax-ppss when needed, but that might fail if syntax-ppss is -;; called in a context where after-change-functions is temporarily +;; called in a context where before-change-functions is temporarily ;; let-bound to nil). ;;; Todo: @@ -94,10 +94,9 @@ (setq syntax-ppss-last nil) (setcar syntax-ppss-last nil))) ;; Unregister if there's no cache left. Sadly this doesn't work - ;; because `after-change-functions' is temporarily bound to nil here. + ;; because `before-change-functions' is temporarily bound to nil here. ;; (unless syntax-ppss-cache - ;; (remove-hook 'after-change-functions - ;; 'syntax-ppss-after-change-function t)) + ;; (remove-hook 'before-change-functions 'syntax-ppss-flush-cache t)) ) (defvar syntax-ppss-stats @@ -148,7 +147,7 @@ ;; too far from `pos', we could try to use other positions ;; in (nth 9 old-ppss), but that doesn't seem to happen in ;; practice and it would complicate this code (and the - ;; after-change-function code even more). But maybe it + ;; before-change-function code even more). But maybe it ;; would be useful in "degenerate" cases such as when the ;; whole file is wrapped in a set of parenthesis. (setq pt-min (or (car (nth 9 old-ppss)) @@ -176,10 +175,10 @@ (setq cache (cdr cache))) (if cache (setq pt-min (caar cache) ppss (cdar cache))) - ;; Setup the after-change function if necessary. + ;; Setup the before-change function if necessary. (unless (or syntax-ppss-cache syntax-ppss-last) - (add-hook 'after-change-functions - 'syntax-ppss-flush-cache nil t)) + (add-hook 'before-change-functions + 'syntax-ppss-flush-cache t t)) ;; Use the best of OLD-POS and CACHE. (if (or (not old-pos) (< old-pos pt-min))