diff options
| -rw-r--r-- | lisp/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/emacs-lisp/syntax.el | 35 |
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 @@ | |||
| 1 | 2006-12-18 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * emacs-lisp/syntax.el (syntax-ppss-flush-cache, syntax-ppss): | ||
| 4 | Use syntax-ppss-toplevel-pos. | ||
| 5 | |||
| 1 | 2006-12-18 Carsten Dominik <dominik@science.uva.nl> | 6 | 2006-12-18 Carsten Dominik <dominik@science.uva.nl> |
| 2 | 7 | ||
| 3 | * textmodes/org.el (org-current-line): Make sure that lines are | 8 | * textmodes/org.el (org-current-line): Make sure that lines are |
| @@ -18,7 +23,7 @@ | |||
| 18 | speed) the case when open-paren-in-column-0-is-defun-start is nil. | 23 | speed) the case when open-paren-in-column-0-is-defun-start is nil. |
| 19 | Based on code by Martin Rudalics. | 24 | Based on code by Martin Rudalics. |
| 20 | 25 | ||
| 21 | * progmodes/cc-mode.el (c-basic-common-init): don't set | 26 | * progmodes/cc-mode.el (c-basic-common-init): Don't set |
| 22 | open-paren-in-column-0-is-defun-start to nil any more. | 27 | open-paren-in-column-0-is-defun-start to nil any more. |
| 23 | 28 | ||
| 24 | 2006-12-17 Richard Stallman <rms@gnu.org> | 29 | 2006-12-17 Richard Stallman <rms@gnu.org> |
| @@ -41,8 +46,8 @@ | |||
| 41 | 46 | ||
| 42 | * calendar/icalendar.el (icalendar-version): Increase to "0.14". | 47 | * calendar/icalendar.el (icalendar-version): Increase to "0.14". |
| 43 | (icalendar--rris): First try Emacs, then XEmacs. | 48 | (icalendar--rris): First try Emacs, then XEmacs. |
| 44 | (icalendar--convert-ical-to-diary): Doc fix. Insert | 49 | (icalendar--convert-ical-to-diary): Doc fix. |
| 45 | newline at end of target file. | 50 | Insert newline at end of target file. |
| 46 | 51 | ||
| 47 | 2006-12-17 Kim F. Storm <storm@cua.dk> | 52 | 2006-12-17 Kim F. Storm <storm@cua.dk> |
| 48 | 53 | ||
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: | |||
| 59 | outside of any parentheses, comments, or strings encountered in the scan. | 59 | outside of any parentheses, comments, or strings encountered in the scan. |
| 60 | If no such position is recorded in PPSS (because the end of the scan was | 60 | If no such position is recorded in PPSS (because the end of the scan was |
| 61 | itself at the outermost level), return nil." | 61 | itself at the outermost level), return nil." |
| 62 | ;; BEWARE! We rely on the undocumented 9th field. The 9th field currently | ||
| 63 | ;; contains the list of positions of the enclosing open-parens. | ||
| 64 | ;; I.e. those positions are outside of any string/comment and the first of | ||
| 65 | ;; those is outside of any paren (i.e. corresponds to a nil ppss). | ||
| 66 | ;; If this list is empty but we are in a string or comment, then the 8th | ||
| 67 | ;; field contains a similar "toplevel" position. | ||
| 62 | (or (car (nth 9 ppss)) | 68 | (or (car (nth 9 ppss)) |
| 63 | (nth 8 ppss))) | 69 | (nth 8 ppss))) |
| 64 | 70 | ||
| 65 | (defsubst syntax-ppss-context (ppss) | 71 | (defsubst syntax-ppss-context (ppss) |
| 66 | (cond | 72 | (cond |
| @@ -97,8 +103,7 @@ point (where the PPSS is equivalent to nil).") | |||
| 97 | ;; depend on the text after BEG (which is presumably changed). So if | 103 | ;; depend on the text after BEG (which is presumably changed). So if |
| 98 | ;; BEG=(car (nth 10 syntax-ppss-last)) don't reuse that data because the | 104 | ;; BEG=(car (nth 10 syntax-ppss-last)) don't reuse that data because the |
| 99 | ;; assumed nil state at BEG may not be valid any more. | 105 | ;; assumed nil state at BEG may not be valid any more. |
| 100 | (if (<= beg (or (car (nth 10 syntax-ppss-last)) | 106 | (if (<= beg (or (syntax-ppss-toplevel-pos (cdr syntax-ppss-last)) |
| 101 | (nth 9 syntax-ppss-last) | ||
| 102 | (nth 3 syntax-ppss-last) | 107 | (nth 3 syntax-ppss-last) |
| 103 | 0)) | 108 | 0)) |
| 104 | (setq syntax-ppss-last nil) | 109 | (setq syntax-ppss-last nil) |
| @@ -146,22 +151,14 @@ Point is at POS when this function returns." | |||
| 146 | (cond | 151 | (cond |
| 147 | ;; Use OLD-PPSS if possible and close enough. | 152 | ;; Use OLD-PPSS if possible and close enough. |
| 148 | ((and (not old-pos) old-ppss | 153 | ((and (not old-pos) old-ppss |
| 149 | ;; BEWARE! We rely on the undocumented 9th field. The 9th | 154 | ;; If `pt-min' is too far from `pos', we could try to use |
| 150 | ;; field currently contains the list of positions of | 155 | ;; other positions in (nth 9 old-ppss), but that doesn't |
| 151 | ;; open-parens of the enclosing parens. I.e. those | 156 | ;; seem to happen in practice and it would complicate this |
| 152 | ;; positions are outside of any string/comment | 157 | ;; code (and the before-change-function code even more). |
| 153 | ;; and the first of those is outside of any paren | 158 | ;; But maybe it would be useful in "degenerate" cases such |
| 154 | ;; (i.e. corresponds to a nil ppss). If this list is empty | 159 | ;; as when the whole file is wrapped in a set |
| 155 | ;; but we are in a string or comment, then the 8th field | 160 | ;; of parentheses. |
| 156 | ;; contains a similar "toplevel" position. If `pt-min' is | 161 | (setq pt-min (or (syntax-ppss-toplevel-pos old-ppss) |
| 157 | ;; too far from `pos', we could try to use other positions | ||
| 158 | ;; in (nth 9 old-ppss), but that doesn't seem to happen in | ||
| 159 | ;; practice and it would complicate this code (and the | ||
| 160 | ;; before-change-function code even more). But maybe it | ||
| 161 | ;; would be useful in "degenerate" cases such as when the | ||
| 162 | ;; whole file is wrapped in a set of parenthesis. | ||
| 163 | (setq pt-min (or (car (nth 9 old-ppss)) | ||
| 164 | (nth 8 old-ppss) | ||
| 165 | (nth 2 old-ppss))) | 162 | (nth 2 old-ppss))) |
| 166 | (<= pt-min pos) (< (- pos pt-min) syntax-ppss-max-span)) | 163 | (<= pt-min pos) (< (- pos pt-min) syntax-ppss-max-span)) |
| 167 | (incf (car (aref syntax-ppss-stats 1))) | 164 | (incf (car (aref syntax-ppss-stats 1))) |