comparison lisp/emacs-lisp/syntax.el @ 66266:f15e775dfb97

(syntax-ppss-flush-cache): Fix corner boundary case. Suggested by Martin Rudalics <rudalics@gmx.at>.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 21 Oct 2005 06:01:22 +0000
parents 364fe66bab84
children 2b7c12a97893
comparison
equal deleted inserted replaced
66265:d077f2d7aa12 66266:f15e775dfb97
81 ;; Flush invalid cache entries. 81 ;; Flush invalid cache entries.
82 (while (and syntax-ppss-cache (> (caar syntax-ppss-cache) beg)) 82 (while (and syntax-ppss-cache (> (caar syntax-ppss-cache) beg))
83 (setq syntax-ppss-cache (cdr syntax-ppss-cache))) 83 (setq syntax-ppss-cache (cdr syntax-ppss-cache)))
84 ;; Throw away `last' value if made invalid. 84 ;; Throw away `last' value if made invalid.
85 (when (< beg (or (car syntax-ppss-last) 0)) 85 (when (< beg (or (car syntax-ppss-last) 0))
86 (if (< beg (or (car (nth 10 syntax-ppss-last)) 86 ;; If syntax-begin-function jumped to BEG, then the old state at BEG can
87 (nth 9 syntax-ppss-last) 87 ;; depend on the text after BEG (which is presumably changed). So if
88 (nth 2 syntax-ppss-last) 88 ;; BEG=(car (nth 10 syntax-ppss-last)) don't reuse that data because the
89 0)) 89 ;; assumed nil state at BEG may not be valid any more.
90 (if (<= beg (or (car (nth 10 syntax-ppss-last))
91 (nth 9 syntax-ppss-last)
92 (nth 2 syntax-ppss-last)
93 0))
90 (setq syntax-ppss-last nil) 94 (setq syntax-ppss-last nil)
91 (setcar syntax-ppss-last nil))) 95 (setcar syntax-ppss-last nil)))
92 ;; Unregister if there's no cache left. Sadly this doesn't work 96 ;; Unregister if there's no cache left. Sadly this doesn't work
93 ;; because `after-change-functions' is temporarily bound to nil here. 97 ;; because `after-change-functions' is temporarily bound to nil here.
94 ;; (unless syntax-ppss-cache 98 ;; (unless syntax-ppss-cache
291 ;; (with-current-buffer (or buffer (current-buffer)) 295 ;; (with-current-buffer (or buffer (current-buffer))
292 ;; (syntax-ppss-depth (syntax-ppss)))) 296 ;; (syntax-ppss-depth (syntax-ppss))))
293 297
294 (provide 'syntax) 298 (provide 'syntax)
295 299
296 ;;; arch-tag: 302f1eeb-e77c-4680-a8c5-c543e01161a5 300 ;; arch-tag: 302f1eeb-e77c-4680-a8c5-c543e01161a5
297 ;;; syntax.el ends here 301 ;;; syntax.el ends here