summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2006-12-18 14:34:01 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2006-12-18 14:34:01 +0000
commit6bddffd0e319ecc118e73bc34f6cdbfa038257ff (patch)
tree722e216f63deeedfb1d6d0ba70f2422c4f78e084
parentbe357779dd7449dcbaf05a66feb966a92ff97123 (diff)
downloademacs-6bddffd0e319ecc118e73bc34f6cdbfa038257ff.tar.gz
(syntax-ppss-flush-cache, syntax-ppss): Use syntax-ppss-toplevel-pos.
-rw-r--r--lisp/ChangeLog11
-rw-r--r--lisp/emacs-lisp/syntax.el35
2 files changed, 24 insertions, 22 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 69f8fd29589..fb995172060 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2006-12-18 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * emacs-lisp/syntax.el (syntax-ppss-flush-cache, syntax-ppss):
+ Use syntax-ppss-toplevel-pos.
+
2006-12-18 Carsten Dominik <dominik@science.uva.nl>
* textmodes/org.el (org-current-line): Make sure that lines are
@@ -18,7 +23,7 @@
speed) the case when open-paren-in-column-0-is-defun-start is nil.
Based on code by Martin Rudalics.
- * progmodes/cc-mode.el (c-basic-common-init): don't set
+ * progmodes/cc-mode.el (c-basic-common-init): Don't set
open-paren-in-column-0-is-defun-start to nil any more.
2006-12-17 Richard Stallman <rms@gnu.org>
@@ -41,8 +46,8 @@
* calendar/icalendar.el (icalendar-version): Increase to "0.14".
(icalendar--rris): First try Emacs, then XEmacs.
- (icalendar--convert-ical-to-diary): Doc fix. Insert
- newline at end of target file.
+ (icalendar--convert-ical-to-diary): Doc fix.
+ Insert newline at end of target file.
2006-12-17 Kim F. Storm <storm@cua.dk>
diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el
index 619fa18e91f..0937076a7f4 100644
--- a/lisp/emacs-lisp/syntax.el
+++ b/lisp/emacs-lisp/syntax.el
@@ -59,8 +59,14 @@ An \"outermost position\" means one that it is outside of any syntactic entity:
outside of any parentheses, comments, or strings encountered in the scan.
If no such position is recorded in PPSS (because the end of the scan was
itself at the outermost level), return nil."
+ ;; BEWARE! We rely on the undocumented 9th field. The 9th field currently
+ ;; contains the list of positions of the enclosing open-parens.
+ ;; I.e. those positions are outside of any string/comment and the first of
+ ;; those is outside of any paren (i.e. corresponds to a nil ppss).
+ ;; If this list is empty but we are in a string or comment, then the 8th
+ ;; field contains a similar "toplevel" position.
(or (car (nth 9 ppss))
- (nth 8 ppss)))
+ (nth 8 ppss)))
(defsubst syntax-ppss-context (ppss)
(cond
@@ -97,8 +103,7 @@ point (where the PPSS is equivalent to nil).")
;; 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)
+ (if (<= beg (or (syntax-ppss-toplevel-pos (cdr syntax-ppss-last))
(nth 3 syntax-ppss-last)
0))
(setq syntax-ppss-last nil)
@@ -146,22 +151,14 @@ Point is at POS when this function returns."
(cond
;; Use OLD-PPSS if possible and close enough.
((and (not old-pos) old-ppss
- ;; BEWARE! We rely on the undocumented 9th field. The 9th
- ;; field currently contains the list of positions of
- ;; open-parens of the enclosing parens. I.e. those
- ;; positions are outside of any string/comment
- ;; and the first of those is outside of any paren
- ;; (i.e. corresponds to a nil ppss). If this list is empty
- ;; but we are in a string or comment, then the 8th field
- ;; contains a similar "toplevel" position. If `pt-min' is
- ;; 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
- ;; 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))
- (nth 8 old-ppss)
+ ;; If `pt-min' is 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 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 parentheses.
+ (setq pt-min (or (syntax-ppss-toplevel-pos old-ppss)
(nth 2 old-ppss)))
(<= pt-min pos) (< (- pos pt-min) syntax-ppss-max-span))
(incf (car (aref syntax-ppss-stats 1)))