aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorPaul Eggert2011-06-15 11:52:30 -0700
committerPaul Eggert2011-06-15 11:52:30 -0700
commitdfc926249a7d14f037a01acba7a69339661e5107 (patch)
tree4c5eeba568589c013f3df53a779c2bd780cd0675 /lisp
parentff672d2c8785de6faba84a400fb8153e9fa07cd2 (diff)
parent8c9b210626493dd93f236d7fb312c4f6dba62892 (diff)
downloademacs-dfc926249a7d14f037a01acba7a69339661e5107.tar.gz
emacs-dfc926249a7d14f037a01acba7a69339661e5107.zip
Merge from trunk.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog84
-rw-r--r--lisp/abbrev.el3
-rw-r--r--lisp/emacs-lisp/debug.el9
-rw-r--r--lisp/emacs-lisp/smie.el20
-rw-r--r--lisp/pcmpl-rpm.el6
-rw-r--r--lisp/progmodes/cc-fonts.el204
6 files changed, 177 insertions, 149 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 622831cb31f..3ee020f33c5 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,6 +1,20 @@
12011-06-15 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * pcmpl-rpm.el (pcomplete/rpm): Minor simplification.
4
5 * emacs-lisp/debug.el (debug): Don't leave the buffer in Debugger.
6
7 * abbrev.el (define-abbrev-table): Don't add a table multiple times.
8
92011-06-15 Alan Mackenzie <acm@muc.de>
10
11 * progmodes/cc-fonts.el (c-font-lock-declarations): 1: Whilst checking
12 for declarators, disable knr checking to speed up for normal files.
13 2: Refactor, replacing a sequence of nested if forms by a cond form.
14
12011-06-15 Lars Magne Ingebrigtsen <larsi@gnus.org> 152011-06-15 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 16
3 * subr.el (process-live-p): Renamed from `process-alive-p' for 17 * subr.el (process-live-p): Rename from `process-alive-p' for
4 consistency with other `-live-p' functions. 18 consistency with other `-live-p' functions.
5 19
62011-06-15 Stefan Monnier <monnier@iro.umontreal.ca> 202011-06-15 Stefan Monnier <monnier@iro.umontreal.ca>
@@ -68,8 +82,8 @@
68 (view-return-to-alist-update): Make obsolete. 82 (view-return-to-alist-update): Make obsolete.
69 (view-mode-enter): Rename second argument to QUIT-RESTORE. 83 (view-mode-enter): Rename second argument to QUIT-RESTORE.
70 Rewrite using quit-restore window parameters. 84 Rewrite using quit-restore window parameters.
71 (view-mode-exit): Rename second argument to EXIT-ONLY. Rewrite 85 (view-mode-exit): Rename second argument to EXIT-ONLY.
72 using quit-restore-window. 86 Rewrite using quit-restore-window.
73 (View-exit, View-exit-and-edit, View-leave, View-quit) 87 (View-exit, View-exit-and-edit, View-leave, View-quit)
74 (View-quit-all, View-kill-and-leave): Call view-mode-exit with 88 (View-quit-all, View-kill-and-leave): Call view-mode-exit with
75 appropriate arguments. 89 appropriate arguments.
@@ -89,8 +103,8 @@
89 (display-buffer-in-side-window, normalize-buffer-to-display) 103 (display-buffer-in-side-window, normalize-buffer-to-display)
90 (display-buffer-normalize-specifiers-1) 104 (display-buffer-normalize-specifiers-1)
91 (display-buffer-normalize-specifiers-2) 105 (display-buffer-normalize-specifiers-2)
92 (display-buffer-normalize-specifiers, display-buffer-frame): New 106 (display-buffer-normalize-specifiers, display-buffer-frame):
93 functions. 107 New functions.
94 (display-buffer): Major rewrite. 108 (display-buffer): Major rewrite.
95 (display-buffer-other-window, display-buffer-other-frame) 109 (display-buffer-other-window, display-buffer-other-frame)
96 (pop-to-buffer, switch-to-buffer-other-window) 110 (pop-to-buffer, switch-to-buffer-other-window)
@@ -126,8 +140,8 @@
126 was inadvertently removed in change from 2011-06-11. Declare as 140 was inadvertently removed in change from 2011-06-11. Declare as
127 obsolete. 141 obsolete.
128 142
129 * calendar/calendar.el (calendar-generate-window): Use 143 * calendar/calendar.el (calendar-generate-window):
130 window-iso-combined-p instead of combination of one-window-p and 144 Use window-iso-combined-p instead of combination of one-window-p and
131 window-safely-shrinkable-p. 145 window-safely-shrinkable-p.
132 146
1332011-06-12 Glenn Morris <rgm@gnu.org> 1472011-06-12 Glenn Morris <rgm@gnu.org>
@@ -172,15 +186,15 @@
172 (bw-adjust-window): Remove. 186 (bw-adjust-window): Remove.
173 (balance-windows-area-adjust): New function with functionality of 187 (balance-windows-area-adjust): New function with functionality of
174 bw-adjust-window but using resize-window. 188 bw-adjust-window but using resize-window.
175 (set-window-text-height): Rewrite doc-string. Use 189 (set-window-text-height): Rewrite doc-string.
176 normalize-live-window and resize-window. 190 Use normalize-live-window and resize-window.
177 (enlarge-window-horizontally, shrink-window-horizontally): Rename 191 (enlarge-window-horizontally, shrink-window-horizontally):
178 argument to DELTA. 192 Rename argument to DELTA.
179 (window-buffer-height): New function. 193 (window-buffer-height): New function.
180 (fit-window-to-buffer, shrink-window-if-larger-than-buffer): 194 (fit-window-to-buffer, shrink-window-if-larger-than-buffer):
181 Rewrite using new window resize routines. 195 Rewrite using new window resize routines.
182 (kill-buffer-and-window, mouse-autoselect-window-select): Use 196 (kill-buffer-and-window, mouse-autoselect-window-select):
183 ignore-errors instead of condition-case. 197 Use ignore-errors instead of condition-case.
184 (quit-window): Call delete-frame instead of delete-windows-on 198 (quit-window): Call delete-frame instead of delete-windows-on
185 for the only buffer on frame. 199 for the only buffer on frame.
186 200
@@ -191,8 +205,8 @@
191 205
192 * files.el (read-buffer-to-switch) 206 * files.el (read-buffer-to-switch)
193 (switch-to-buffer-other-window) 207 (switch-to-buffer-other-window)
194 (switch-to-buffer-other-frame, display-buffer-other-frame): Move 208 (switch-to-buffer-other-frame, display-buffer-other-frame):
195 to window.el. 209 Move to window.el.
196 210
197 * simple.el (get-next-valid-buffer, last-buffer, next-buffer) 211 * simple.el (get-next-valid-buffer, last-buffer, next-buffer)
198 (previous-buffer): Move to window.el. 212 (previous-buffer): Move to window.el.
@@ -208,8 +222,8 @@
208 (switch-to-next-buffer): New functions. 222 (switch-to-next-buffer): New functions.
209 (get-next-valid-buffer, last-buffer, next-buffer): Move here 223 (get-next-valid-buffer, last-buffer, next-buffer): Move here
210 from simple.el. Call switch-to-next-buffer. 224 from simple.el. Call switch-to-next-buffer.
211 (previous-buffer): Move here from simple.el. Call 225 (previous-buffer): Move here from simple.el.
212 switch-to-prev-buffer. 226 Call switch-to-prev-buffer.
213 (bury-buffer): Move here from buffer.c. Switch to previous 227 (bury-buffer): Move here from buffer.c. Switch to previous
214 buffer when window cannot be deleted. 228 buffer when window cannot be deleted.
215 (unbury-buffer): Move here from bindings.el. 229 (unbury-buffer): Move here from bindings.el.
@@ -218,8 +232,8 @@
218 (read-buffer-to-switch, switch-to-buffer-other-window) 232 (read-buffer-to-switch, switch-to-buffer-other-window)
219 (switch-to-buffer-other-frame): Move here from files.el. 233 (switch-to-buffer-other-frame): Move here from files.el.
220 (normalize-buffer-to-switch-to): New functions. 234 (normalize-buffer-to-switch-to): New functions.
221 (switch-to-buffer): Move here from buffer.c. Use 235 (switch-to-buffer): Move here from buffer.c.
222 read-buffer-to-switch and normalize-buffer-to-switch-to. 236 Use read-buffer-to-switch and normalize-buffer-to-switch-to.
223 237
2242011-06-10 Martin Rudalics <rudalics@gmx.at> 2382011-06-10 Martin Rudalics <rudalics@gmx.at>
225 239
@@ -234,8 +248,8 @@
234 (window-split-min-size): New function. 248 (window-split-min-size): New function.
235 (split-window-keep-point): Mention split-window-above-each-other 249 (split-window-keep-point): Mention split-window-above-each-other
236 instead of split-window-vertically. 250 instead of split-window-vertically.
237 (split-window-above-each-other, split-window-vertically): Rename 251 (split-window-above-each-other, split-window-vertically):
238 split-window-vertically to split-window-above-each-other and 252 Rename split-window-vertically to split-window-above-each-other and
239 provide defalias for old definition. 253 provide defalias for old definition.
240 (split-window-side-by-side, split-window-horizontally): Rename 254 (split-window-side-by-side, split-window-horizontally): Rename
241 split-window-horizontally to split-window-side-by-side and provide 255 split-window-horizontally to split-window-side-by-side and provide
@@ -294,10 +308,10 @@
294 308
2952011-06-08 Martin Rudalics <rudalics@gmx.at> 3092011-06-08 Martin Rudalics <rudalics@gmx.at>
296 310
297 * window.el (one-window-p): Move down in code. Rewrite 311 * window.el (one-window-p): Move down in code.
298 doc-string. 312 Rewrite doc-string.
299 (window-current-scroll-bars): Rewrite doc-string. Normalize 313 (window-current-scroll-bars): Rewrite doc-string.
300 live window argument. 314 Normalize live window argument.
301 (walk-windows, get-window-with-predicate, count-windows): 315 (walk-windows, get-window-with-predicate, count-windows):
302 Rewrite doc-string. Use window-list-1. 316 Rewrite doc-string. Use window-list-1.
303 (window-in-direction-2, window-in-direction, get-mru-window): 317 (window-in-direction-2, window-in-direction, get-mru-window):
@@ -336,20 +350,20 @@
336 (image-transform-properties): Return quickly in the normal case. 350 (image-transform-properties): Return quickly in the normal case.
337 (image-animate-loop): Rename from image-animate-max-time. 351 (image-animate-loop): Rename from image-animate-max-time.
338 352
339 * image.el (image-animate-max-time): Moved to image-mode.el. 353 * image.el (image-animate-max-time): Move to image-mode.el.
340 (create-animated-image): Remove unnecessary function. 354 (create-animated-image): Remove unnecessary function.
341 (image-animate): Rename from image-animate-start. New arg. 355 (image-animate): Rename from image-animate-start. New arg.
342 (image-animate-stop): Removed; just use image-animate-timer. 356 (image-animate-stop): Remove; just use image-animate-timer.
343 (image-animate-timer): Use car-safe. 357 (image-animate-timer): Use car-safe.
344 (image-animate-timeout): Rename argument. 358 (image-animate-timeout): Rename argument.
345 359
3462011-06-07 Martin Rudalics <rudalics@gmx.at> 3602011-06-07 Martin Rudalics <rudalics@gmx.at>
347 361
348 * window.el (get-lru-window, get-largest-window): Move here from 362 * window.el (get-lru-window, get-largest-window): Move here from
349 window.c. Rename first argument to ALL-FRAMES. Rephrase 363 window.c. Rename first argument to ALL-FRAMES.
350 doc-strings. 364 Rephrase doc-strings.
351 (get-buffer-window-list): Rewrite using window-list-1. Rephrase 365 (get-buffer-window-list): Rewrite using window-list-1.
352 doc-string. 366 Rephrase doc-string.
353 (window-safe-min-height, window-safe-min-width): New constants. 367 (window-safe-min-height, window-safe-min-width): New constants.
354 (window-size-ignore, window-min-size, window-min-size-1) 368 (window-size-ignore, window-min-size, window-min-size-1)
355 (window-sizable, window-sizable-p, window-size-fixed-1) 369 (window-sizable, window-sizable-p, window-size-fixed-1)
@@ -372,8 +386,8 @@
372 (walk-window-tree-1, walk-window-tree, walk-window-subtree) 386 (walk-window-tree-1, walk-window-tree, walk-window-subtree)
373 (windows-with-parameter, window-with-parameter) 387 (windows-with-parameter, window-with-parameter)
374 (window-atom-root, make-window-atom, window-atom-check-1) 388 (window-atom-root, make-window-atom, window-atom-check-1)
375 (window-atom-check, window-side-check, window-check): New 389 (window-atom-check, window-side-check, window-check):
376 functions. 390 New functions.
377 (ignore-window-parameters, window-sides, window-sides-vertical) 391 (ignore-window-parameters, window-sides, window-sides-vertical)
378 (window-sides-slots): New variables. 392 (window-sides-slots): New variables.
379 (window-size-fixed): Move down in code. Minor doc-string fix. 393 (window-size-fixed): Move down in code. Minor doc-string fix.
@@ -411,8 +425,8 @@
411 425
4122011-06-05 Roland Winkler <winkler@gnu.org> 4262011-06-05 Roland Winkler <winkler@gnu.org>
413 427
414 * textmodes/bibtex.el (bibtex-search-entry-globally): New 428 * textmodes/bibtex.el (bibtex-search-entry-globally):
415 variable. 429 New variable.
416 (bibtex-search-entry): Use it. 430 (bibtex-search-entry): Use it.
417 431
4182011-06-05 Roland Winkler <winkler@gnu.org> 4322011-06-05 Roland Winkler <winkler@gnu.org>
diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index b2cd2064da2..9445cf9675c 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -935,7 +935,8 @@ Properties with special meaning:
935 (unless table 935 (unless table
936 (setq table (make-abbrev-table)) 936 (setq table (make-abbrev-table))
937 (set tablename table) 937 (set tablename table)
938 (push tablename abbrev-table-name-list)) 938 (unless (memq tablename abbrev-table-name-list)
939 (push tablename abbrev-table-name-list)))
939 ;; We used to just pass them to `make-abbrev-table', but that fails 940 ;; We used to just pass them to `make-abbrev-table', but that fails
940 ;; if the table was pre-existing as is the case if it was created by 941 ;; if the table was pre-existing as is the case if it was created by
941 ;; loading the user's abbrev file. 942 ;; loading the user's abbrev file.
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el
index 28962595ace..2fa339e62fe 100644
--- a/lisp/emacs-lisp/debug.el
+++ b/lisp/emacs-lisp/debug.el
@@ -238,13 +238,14 @@ first will be printed into the backtrace buffer."
238 (kill-buffer debugger-buffer))) 238 (kill-buffer debugger-buffer)))
239 ;; Restore the previous state of the debugger-buffer, in case we were 239 ;; Restore the previous state of the debugger-buffer, in case we were
240 ;; in a recursive invocation of the debugger. 240 ;; in a recursive invocation of the debugger.
241 (when (and debugger-previous-state 241 (when (buffer-live-p debugger-buffer)
242 (buffer-live-p debugger-buffer))
243 (with-current-buffer debugger-buffer 242 (with-current-buffer debugger-buffer
244 (let ((inhibit-read-only t)) 243 (let ((inhibit-read-only t))
245 (erase-buffer) 244 (erase-buffer)
246 (insert (nth 1 debugger-previous-state)) 245 (if (null debugger-previous-state)
247 (funcall (nth 0 debugger-previous-state))))) 246 (fundamental-mode)
247 (insert (nth 1 debugger-previous-state))
248 (funcall (nth 0 debugger-previous-state))))))
248 (with-timeout-unsuspend debugger-with-timeout-suspend) 249 (with-timeout-unsuspend debugger-with-timeout-suspend)
249 (set-match-data debugger-outer-match-data))) 250 (set-match-data debugger-outer-match-data)))
250 ;; Put into effect the modified values of these variables 251 ;; Put into effect the modified values of these variables
diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el
index 2701d6b940b..17cc5668b5f 100644
--- a/lisp/emacs-lisp/smie.el
+++ b/lisp/emacs-lisp/smie.el
@@ -84,6 +84,26 @@
84;; - Maybe accept two juxtaposed non-terminals in the BNF under the condition 84;; - Maybe accept two juxtaposed non-terminals in the BNF under the condition
85;; that the first always ends with a terminal, or that the second always 85;; that the first always ends with a terminal, or that the second always
86;; starts with a terminal. 86;; starts with a terminal.
87;; - Permit EBNF-style notation.
88;; - If the grammar has conflicts, the only way is to make the lexer return
89;; different tokens for the different cases. This extra work performed by
90;; the lexer can be costly and unnecessary: we perform this extra work every
91;; time we find the conflicting token, regardless of whether or not the
92;; difference between the various situations is relevant to the current
93;; situation. E.g. we may try to determine whether a ";" is a ";-operator"
94;; or a ";-separator" in a case where we're skipping over a "begin..end" pair
95;; where the difference doesn't matter. For frequently occurring tokens and
96;; rarely occurring conflicts, this can be a significant performance problem.
97;; We could try and let the lexer return a "set of possible tokens
98;; plus a refinement function" and then let parser call the refinement
99;; function if needed.
100;; - Make it possible to better specify the behavior in the face of
101;; syntax errors. IOW provide some control over the choice of precedence
102;; levels within the limits of the constraints. E.g. make it possible for
103;; the grammar to specify that "begin..end" has lower precedence than
104;; "Module..EndModule", so that if a "begin" is missing, scanning from the
105;; "end" will stop at "Module" rather than going past it (and similarly,
106;; scanning from "Module" should not stop at a spurious "end").
87 107
88;;; Code: 108;;; Code:
89 109
diff --git a/lisp/pcmpl-rpm.el b/lisp/pcmpl-rpm.el
index 475215b1622..716b0a59555 100644
--- a/lisp/pcmpl-rpm.el
+++ b/lisp/pcmpl-rpm.el
@@ -313,9 +313,9 @@
313 (if (pcomplete-match "^-" 0) 313 (if (pcomplete-match "^-" 0)
314 (pcomplete-opt "v") 314 (pcomplete-opt "v")
315 (pcomplete-here 315 (pcomplete-here
316 (if (eq mode 'test) 316 (pcomplete-dirs-or-entries (if (eq mode 'test)
317 (pcomplete-dirs-or-entries "\\.tar\\'") 317 "\\.tar\\'"
318 (pcomplete-dirs-or-entries "\\.spec\\'")))))) 318 "\\.spec\\'"))))))
319 (t 319 (t
320 (error "You must select a mode: -q, -i, -U, --verify, etc")))))) 320 (error "You must select a mode: -q, -i, -U, --verify, etc"))))))
321 321
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index c7bb93f73e7..600bbc76e9a 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -1045,12 +1045,6 @@ casts and declarations are fontified. Used on level 2 and higher."
1045 ;; The position of the next token after the closing paren of 1045 ;; The position of the next token after the closing paren of
1046 ;; the last detected cast. 1046 ;; the last detected cast.
1047 last-cast-end 1047 last-cast-end
1048 ;; Start of containing declaration (if any); limit for searching
1049 ;; backwards for it.
1050 decl-start decl-search-lim
1051 ;; Start of containing declaration (if any); limit for searching
1052 ;; backwards for it.
1053 decl-start decl-search-lim
1054 ;; The result from `c-forward-decl-or-cast-1'. 1048 ;; The result from `c-forward-decl-or-cast-1'.
1055 decl-or-cast 1049 decl-or-cast
1056 ;; The maximum of the end positions of all the checked type 1050 ;; The maximum of the end positions of all the checked type
@@ -1188,109 +1182,107 @@ casts and declarations are fontified. Used on level 2 and higher."
1188 (setq decl-or-cast (c-forward-decl-or-cast-1 1182 (setq decl-or-cast (c-forward-decl-or-cast-1
1189 match-pos context last-cast-end)) 1183 match-pos context last-cast-end))
1190 1184
1191 (if (not decl-or-cast) 1185 (cond
1192 ;; Are we at a declarator? Try to go back to the declaration 1186 ((eq decl-or-cast 'cast)
1193 ;; to check this. Note that `c-beginning-of-decl-1' is slow, 1187 ;; Save the position after the previous cast so we can feed
1194 ;; so we cache its result between calls. 1188 ;; it to `c-forward-decl-or-cast-1' in the next round. That
1195 (let (paren-state bod-res encl-pos is-typedef) 1189 ;; helps it discover cast chains like "(a) (b) c".
1196 (goto-char start-pos) 1190 (setq last-cast-end (point))
1197 (save-excursion 1191 (c-fontify-recorded-types-and-refs)
1198 (unless (and decl-search-lim 1192 nil)
1199 (eq decl-search-lim
1200 (save-excursion
1201 (c-syntactic-skip-backward "^;" nil t)
1202 (point))))
1203 (setq decl-search-lim
1204 (and (c-syntactic-skip-backward "^;" nil t) (point)))
1205 (setq bod-res (car (c-beginning-of-decl-1 decl-search-lim)))
1206 (if (and (eq bod-res 'same)
1207 (progn
1208 (c-backward-syntactic-ws)
1209 (eq (char-before) ?\})))
1210 (c-beginning-of-decl-1 decl-search-lim))
1211 (setq decl-start (point))))
1212 1193
1194 (decl-or-cast
1195 ;; We've found a declaration.
1196
1197 ;; Set `max-type-decl-end' or `max-type-decl-end-before-token'
1198 ;; under the assumption that we're after the first type decl
1199 ;; expression in the declaration now. That's not really true;
1200 ;; we could also be after a parenthesized initializer
1201 ;; expression in C++, but this is only used as a last resort
1202 ;; to slant ambiguous expression/declarations, and overall
1203 ;; it's worth the risk to occasionally fontify an expression
1204 ;; as a declaration in an initializer expression compared to
1205 ;; getting ambiguous things in normal function prototypes
1206 ;; fontified as expressions.
1207 (if inside-macro
1208 (when (> (point) max-type-decl-end-before-token)
1209 (setq max-type-decl-end-before-token (point)))
1210 (when (> (point) max-type-decl-end)
1211 (setq max-type-decl-end (point))))
1212
1213 ;; Back up to the type to fontify the declarator(s).
1214 (goto-char (car decl-or-cast))
1215
1216 (let ((decl-list
1217 (if context
1218 ;; Should normally not fontify a list of
1219 ;; declarators inside an arglist, but the first
1220 ;; argument in the ';' separated list of a "for"
1221 ;; statement is an exception.
1222 (when (eq (char-before match-pos) ?\()
1223 (save-excursion
1224 (goto-char (1- match-pos))
1225 (c-backward-syntactic-ws)
1226 (and (c-simple-skip-symbol-backward)
1227 (looking-at c-paren-stmt-key))))
1228 t)))
1229
1230 ;; Fix the `c-decl-id-start' or `c-decl-type-start' property
1231 ;; before the first declarator if it's a list.
1232 ;; `c-font-lock-declarators' handles the rest.
1233 (when decl-list
1213 (save-excursion 1234 (save-excursion
1214 (goto-char decl-start) 1235 (c-backward-syntactic-ws)
1215 ;; We're now putatively at the declaration. 1236 (unless (bobp)
1216 (setq paren-state (c-parse-state)) 1237 (c-put-char-property (1- (point)) 'c-type
1217 ;; At top level or inside a "{"? 1238 (if (cdr decl-or-cast)
1218 (if (or (not (setq encl-pos 1239 'c-decl-type-start
1219 (c-most-enclosing-brace paren-state))) 1240 'c-decl-id-start)))))
1220 (eq (char-after encl-pos) ?\{)) 1241
1221 (progn 1242 (c-font-lock-declarators
1222 (when (looking-at c-typedef-key) ; "typedef" 1243 (point-max) decl-list (cdr decl-or-cast)))
1223 (setq is-typedef t) 1244
1224 (goto-char (match-end 0)) 1245 ;; A declaration has been successfully identified, so do all the
1225 (c-forward-syntactic-ws)) 1246 ;; fontification of types and refs that've been recorded.
1226 ;; At a real declaration?
1227 (if (memq (c-forward-type t) '(t known found))
1228 (progn
1229 (c-font-lock-declarators limit t is-typedef)
1230 nil)
1231 ;; False alarm. Return t to go on to the next check.
1232 (goto-char start-pos)
1233 t))
1234 t)))
1235
1236 (if (eq decl-or-cast 'cast)
1237 ;; Save the position after the previous cast so we can feed
1238 ;; it to `c-forward-decl-or-cast-1' in the next round. That
1239 ;; helps it discover cast chains like "(a) (b) c".
1240 (setq last-cast-end (point))
1241
1242 ;; Set `max-type-decl-end' or `max-type-decl-end-before-token'
1243 ;; under the assumption that we're after the first type decl
1244 ;; expression in the declaration now. That's not really true;
1245 ;; we could also be after a parenthesized initializer
1246 ;; expression in C++, but this is only used as a last resort
1247 ;; to slant ambiguous expression/declarations, and overall
1248 ;; it's worth the risk to occasionally fontify an expression
1249 ;; as a declaration in an initializer expression compared to
1250 ;; getting ambiguous things in normal function prototypes
1251 ;; fontified as expressions.
1252 (if inside-macro
1253 (when (> (point) max-type-decl-end-before-token)
1254 (setq max-type-decl-end-before-token (point)))
1255 (when (> (point) max-type-decl-end)
1256 (setq max-type-decl-end (point))))
1257
1258 ;; Back up to the type to fontify the declarator(s).
1259 (goto-char (car decl-or-cast))
1260
1261 (let ((decl-list
1262 (if context
1263 ;; Should normally not fontify a list of
1264 ;; declarators inside an arglist, but the first
1265 ;; argument in the ';' separated list of a "for"
1266 ;; statement is an exception.
1267 (when (eq (char-before match-pos) ?\()
1268 (save-excursion
1269 (goto-char (1- match-pos))
1270 (c-backward-syntactic-ws)
1271 (and (c-simple-skip-symbol-backward)
1272 (looking-at c-paren-stmt-key))))
1273 t)))
1274
1275 ;; Fix the `c-decl-id-start' or `c-decl-type-start' property
1276 ;; before the first declarator if it's a list.
1277 ;; `c-font-lock-declarators' handles the rest.
1278 (when decl-list
1279 (save-excursion
1280 (c-backward-syntactic-ws)
1281 (unless (bobp)
1282 (c-put-char-property (1- (point)) 'c-type
1283 (if (cdr decl-or-cast)
1284 'c-decl-type-start
1285 'c-decl-id-start)))))
1286
1287 (c-font-lock-declarators
1288 (point-max) decl-list (cdr decl-or-cast))))
1289
1290 ;; A cast or declaration has been successfully identified, so do
1291 ;; all the fontification of types and refs that's been recorded.
1292 (c-fontify-recorded-types-and-refs) 1247 (c-fontify-recorded-types-and-refs)
1293 nil)) 1248 nil)
1249
1250 (t
1251 ;; Are we at a declarator? Try to go back to the declaration
1252 ;; to check this. If we get there, check whether a "typedef"
1253 ;; is there, then fontify the declarators accordingly.
1254 (let ((decl-search-lim (max (- (point) 50000) (point-min)))
1255 paren-state bod-res encl-pos is-typedef
1256 c-recognize-knr-p) ; Strictly speaking, bogus, but it
1257 ; speeds up lisp.h tremendously.
1258 (save-excursion
1259 (setq bod-res (car (c-beginning-of-decl-1 decl-search-lim)))
1260 (if (and (eq bod-res 'same)
1261 (progn
1262 (c-backward-syntactic-ws)
1263 (eq (char-before) ?\})))
1264 (c-beginning-of-decl-1 decl-search-lim))
1265
1266 ;; We're now putatively at the declaration.
1267 (setq paren-state (c-parse-state))
1268 ;; At top level or inside a "{"?
1269 (if (or (not (setq encl-pos
1270 (c-most-enclosing-brace paren-state)))
1271 (eq (char-after encl-pos) ?\{))
1272 (progn
1273 (when (looking-at c-typedef-key) ; "typedef"
1274 (setq is-typedef t)
1275 (goto-char (match-end 0))
1276 (c-forward-syntactic-ws))
1277 ;; At a real declaration?
1278 (if (memq (c-forward-type t) '(t known found))
1279 (progn
1280 (c-font-lock-declarators limit t is-typedef)
1281 nil)
1282 ;; False alarm. Return t to go on to the next check.
1283 (goto-char start-pos)
1284 t))
1285 t))))))
1294 1286
1295 ;; It was a false alarm. Check if we're in a label (or other 1287 ;; It was a false alarm. Check if we're in a label (or other
1296 ;; construct with `:' except bitfield) instead. 1288 ;; construct with `:' except bitfield) instead.