From 889c5dad201c98a3eefc91b1ec9f2f7595d03ec0 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 21 Oct 2005 06:01:22 +0000 Subject: [PATCH] (syntax-ppss-flush-cache): Fix corner boundary case. Suggested by Martin Rudalics . --- lisp/emacs-lisp/syntax.el | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el index 126c8d50dd9..6c897319433 100644 --- a/lisp/emacs-lisp/syntax.el +++ b/lisp/emacs-lisp/syntax.el @@ -83,10 +83,14 @@ point (where the PPSS is equivalent to nil).") (setq syntax-ppss-cache (cdr syntax-ppss-cache))) ;; Throw away `last' value if made invalid. (when (< beg (or (car syntax-ppss-last) 0)) - (if (< beg (or (car (nth 10 syntax-ppss-last)) - (nth 9 syntax-ppss-last) - (nth 2 syntax-ppss-last) - 0)) + ;; If syntax-begin-function jumped to BEG, then the old state at BEG can + ;; depend on the text after BEG (which is presumably changed). So if + ;; BEG=(car (nth 10 syntax-ppss-last)) don't reuse that data because the + ;; assumed nil state at BEG may not be valid any more. + (if (<= beg (or (car (nth 10 syntax-ppss-last)) + (nth 9 syntax-ppss-last) + (nth 2 syntax-ppss-last) + 0)) (setq syntax-ppss-last nil) (setcar syntax-ppss-last nil))) ;; Unregister if there's no cache left. Sadly this doesn't work @@ -293,5 +297,5 @@ Point is at POS when this function returns." (provide 'syntax) -;;; arch-tag: 302f1eeb-e77c-4680-a8c5-c543e01161a5 +;; arch-tag: 302f1eeb-e77c-4680-a8c5-c543e01161a5 ;;; syntax.el ends here -- 2.39.2