Commit dfc92624 authored by Paul Eggert's avatar Paul Eggert
Browse files

Merge from trunk.

parents ff672d2c 8c9b2106
2011-06-15 Paul Eggert <eggert@cs.ucla.edu>
* lib/ftoastr.c, lib/stdio.in.h, lib/verify.h: Merge from gnulib.
2011-06-14 Jan Djärv <jan.h.d@swipnet.se> 2011-06-14 Jan Djärv <jan.h.d@swipnet.se>
* configure.in: Add emacsgtkfixed.o to GTK_OBJ if HAVE_GTK3. * configure.in: Add emacsgtkfixed.o to GTK_OBJ if HAVE_GTK3.
......
2011-06-15 Chong Yidong <cyd@stupidchicken.com>
* text.texi (Special Properties): Clarify role of font-lock-face.
2011-06-15 Lars Magne Ingebrigtsen <larsi@gnus.org> 2011-06-15 Lars Magne Ingebrigtsen <larsi@gnus.org>
* processes.texi (Process Information): Renamed `process-alive-p' * processes.texi (Process Information): Renamed `process-alive-p'
......
...@@ -3003,18 +3003,18 @@ the context. ...@@ -3003,18 +3003,18 @@ the context.
@item font-lock-face @item font-lock-face
@kindex font-lock-face @r{(text property)} @kindex font-lock-face @r{(text property)}
The @code{font-lock-face} property is equivalent to the @code{face} This property specifies a value for the @code{face} property that Font
property when Font Lock mode is enabled. When Font Lock mode is disabled, Lock mode should apply to the underlying text. It is one of the
fontification methods used by Font Lock mode, and is useful for
special modes that implement their own highlighting.
@xref{Precalculated Fontification}. When Font Lock mode is disabled,
@code{font-lock-face} has no effect. @code{font-lock-face} has no effect.
The @code{font-lock-face} property is useful for special modes that
implement their own highlighting. @xref{Precalculated Fontification}.
@item mouse-face @item mouse-face
@kindex mouse-face @r{(text property)} @kindex mouse-face @r{(text property)}
The property @code{mouse-face} is used instead of @code{face} when the This property is used instead of @code{face} when the mouse is on or
mouse is on or near the character. For this purpose, ``near'' means near the character. For this purpose, ``near'' means that all text
that all text between the character and where the mouse is have the same between the character and where the mouse is have the same
@code{mouse-face} property value. @code{mouse-face} property value.
@item fontified @item fontified
......
...@@ -40,14 +40,15 @@ ...@@ -40,14 +40,15 @@
# define FLOAT_MIN LDBL_MIN # define FLOAT_MIN LDBL_MIN
# define FLOAT_PREC_BOUND _GL_LDBL_PREC_BOUND # define FLOAT_PREC_BOUND _GL_LDBL_PREC_BOUND
# define FTOASTR ldtoastr # define FTOASTR ldtoastr
# define STRTOF strtold # if HAVE_C99_STRTOLD
# define STRTOF strtold
# endif
#elif LENGTH == 2 #elif LENGTH == 2
# define FLOAT double # define FLOAT double
# define FLOAT_DIG DBL_DIG # define FLOAT_DIG DBL_DIG
# define FLOAT_MIN DBL_MIN # define FLOAT_MIN DBL_MIN
# define FLOAT_PREC_BOUND _GL_DBL_PREC_BOUND # define FLOAT_PREC_BOUND _GL_DBL_PREC_BOUND
# define FTOASTR dtoastr # define FTOASTR dtoastr
# define STRTOF strtod
#else #else
# define LENGTH 1 # define LENGTH 1
# define FLOAT float # define FLOAT float
...@@ -55,14 +56,15 @@ ...@@ -55,14 +56,15 @@
# define FLOAT_MIN FLT_MIN # define FLOAT_MIN FLT_MIN
# define FLOAT_PREC_BOUND _GL_FLT_PREC_BOUND # define FLOAT_PREC_BOUND _GL_FLT_PREC_BOUND
# define FTOASTR ftoastr # define FTOASTR ftoastr
# define STRTOF strtof # if HAVE_STRTOF
# define STRTOF strtof
# endif
#endif #endif
/* On pre-C99 hosts, approximate strtof and strtold with strtod. This /* On pre-C99 hosts, approximate strtof and strtold with strtod. This
may generate one or two extra digits, but that's better than not may generate one or two extra digits, but that's better than not
working at all. Assume that strtof works if strtold does. */ working at all. */
#if LENGTH != 2 && ! HAVE_C99_STRTOLD #ifndef STRTOF
# undef STRTOF
# define STRTOF strtod # define STRTOF strtod
#endif #endif
......
...@@ -461,25 +461,6 @@ _GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence) ...@@ -461,25 +461,6 @@ _GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)
_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)); _GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
# endif # endif
_GL_CXXALIASWARN (fseeko); _GL_CXXALIASWARN (fseeko);
# if (@REPLACE_FSEEKO@ || !@HAVE_FSEEKO@) && !@GNULIB_FSEEK@
/* Provide an fseek function that is consistent with fseeko. */
/* In order to avoid that fseek gets defined as a macro here, the
developer can request the 'fseek' module. */
# if !GNULIB_defined_fseek_function
# undef fseek
# define fseek rpl_fseek
static inline int _GL_ARG_NONNULL ((1))
rpl_fseek (FILE *fp, long offset, int whence)
{
# if @REPLACE_FSEEKO@
return rpl_fseeko (fp, offset, whence);
# else
return fseeko (fp, offset, whence);
# endif
}
# define GNULIB_defined_fseek_function 1
# endif
# endif
#elif defined GNULIB_POSIXCHECK #elif defined GNULIB_POSIXCHECK
# define _GL_FSEEK_WARN /* Category 1, above. */ # define _GL_FSEEK_WARN /* Category 1, above. */
# undef fseek # undef fseek
...@@ -539,25 +520,6 @@ _GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); ...@@ -539,25 +520,6 @@ _GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp)); _GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
# endif # endif
_GL_CXXALIASWARN (ftello); _GL_CXXALIASWARN (ftello);
# if (@REPLACE_FTELLO@ || !@HAVE_FTELLO@) && !@GNULIB_FTELL@
/* Provide an ftell function that is consistent with ftello. */
/* In order to avoid that ftell gets defined as a macro here, the
developer can request the 'ftell' module. */
# if !GNULIB_defined_ftell_function
# undef ftell
# define ftell rpl_ftell
static inline long _GL_ARG_NONNULL ((1))
rpl_ftell (FILE *f)
{
# if @REPLACE_FTELLO@
return rpl_ftello (f);
# else
return ftello (f);
# endif
}
# define GNULIB_defined_ftell_function 1
# endif
# endif
#elif defined GNULIB_POSIXCHECK #elif defined GNULIB_POSIXCHECK
# define _GL_FTELL_WARN /* Category 1, above. */ # define _GL_FTELL_WARN /* Category 1, above. */
# undef ftell # undef ftell
......
...@@ -221,10 +221,18 @@ template <int w> ...@@ -221,10 +221,18 @@ template <int w>
contexts, e.g., the top level. */ contexts, e.g., the top level. */
/* Verify requirement R at compile-time, as an integer constant expression. /* Verify requirement R at compile-time, as an integer constant expression.
Return 1. */ Return 1. This is equivalent to verify_expr (R, 1).
verify_true is obsolescent; please use verify_expr instead. */
# define verify_true(R) _GL_VERIFY_TRUE (R, "verify_true (" #R ")") # define verify_true(R) _GL_VERIFY_TRUE (R, "verify_true (" #R ")")
/* Verify requirement R at compile-time. Return the value of the
expression E. */
# define verify_expr(R, E) \
(_GL_VERIFY_TRUE (R, "verify_expr (" #R ", " #E ")") ? (E) : (E))
/* Verify requirement R at compile-time, as a declaration without a /* Verify requirement R at compile-time, as a declaration without a
trailing ';'. */ trailing ';'. */
......
2011-06-15 Stefan Monnier <monnier@iro.umontreal.ca>
* pcmpl-rpm.el (pcomplete/rpm): Minor simplification.
* emacs-lisp/debug.el (debug): Don't leave the buffer in Debugger.
* abbrev.el (define-abbrev-table): Don't add a table multiple times.
2011-06-15 Alan Mackenzie <acm@muc.de>
* progmodes/cc-fonts.el (c-font-lock-declarations): 1: Whilst checking
for declarators, disable knr checking to speed up for normal files.
2: Refactor, replacing a sequence of nested if forms by a cond form.
2011-06-15 Lars Magne Ingebrigtsen <larsi@gnus.org> 2011-06-15 Lars Magne Ingebrigtsen <larsi@gnus.org>
* subr.el (process-live-p): Renamed from `process-alive-p' for * subr.el (process-live-p): Rename from `process-alive-p' for
consistency with other `-live-p' functions. consistency with other `-live-p' functions.
2011-06-15 Stefan Monnier <monnier@iro.umontreal.ca> 2011-06-15 Stefan Monnier <monnier@iro.umontreal.ca>
...@@ -68,8 +82,8 @@ ...@@ -68,8 +82,8 @@
(view-return-to-alist-update): Make obsolete. (view-return-to-alist-update): Make obsolete.
(view-mode-enter): Rename second argument to QUIT-RESTORE. (view-mode-enter): Rename second argument to QUIT-RESTORE.
Rewrite using quit-restore window parameters. Rewrite using quit-restore window parameters.
(view-mode-exit): Rename second argument to EXIT-ONLY. Rewrite (view-mode-exit): Rename second argument to EXIT-ONLY.
using quit-restore-window. Rewrite using quit-restore-window.
(View-exit, View-exit-and-edit, View-leave, View-quit) (View-exit, View-exit-and-edit, View-leave, View-quit)
(View-quit-all, View-kill-and-leave): Call view-mode-exit with (View-quit-all, View-kill-and-leave): Call view-mode-exit with
appropriate arguments. appropriate arguments.
...@@ -89,8 +103,8 @@ ...@@ -89,8 +103,8 @@
(display-buffer-in-side-window, normalize-buffer-to-display) (display-buffer-in-side-window, normalize-buffer-to-display)
(display-buffer-normalize-specifiers-1) (display-buffer-normalize-specifiers-1)
(display-buffer-normalize-specifiers-2) (display-buffer-normalize-specifiers-2)
(display-buffer-normalize-specifiers, display-buffer-frame): New (display-buffer-normalize-specifiers, display-buffer-frame):
functions. New functions.
(display-buffer): Major rewrite. (display-buffer): Major rewrite.
(display-buffer-other-window, display-buffer-other-frame) (display-buffer-other-window, display-buffer-other-frame)
(pop-to-buffer, switch-to-buffer-other-window) (pop-to-buffer, switch-to-buffer-other-window)
...@@ -126,8 +140,8 @@ ...@@ -126,8 +140,8 @@
was inadvertently removed in change from 2011-06-11. Declare as was inadvertently removed in change from 2011-06-11. Declare as
obsolete. obsolete.
* calendar/calendar.el (calendar-generate-window): Use * calendar/calendar.el (calendar-generate-window):
window-iso-combined-p instead of combination of one-window-p and Use window-iso-combined-p instead of combination of one-window-p and
window-safely-shrinkable-p. window-safely-shrinkable-p.
2011-06-12 Glenn Morris <rgm@gnu.org> 2011-06-12 Glenn Morris <rgm@gnu.org>
...@@ -172,15 +186,15 @@ ...@@ -172,15 +186,15 @@
(bw-adjust-window): Remove. (bw-adjust-window): Remove.
(balance-windows-area-adjust): New function with functionality of (balance-windows-area-adjust): New function with functionality of
bw-adjust-window but using resize-window. bw-adjust-window but using resize-window.
(set-window-text-height): Rewrite doc-string. Use (set-window-text-height): Rewrite doc-string.
normalize-live-window and resize-window. Use normalize-live-window and resize-window.
(enlarge-window-horizontally, shrink-window-horizontally): Rename (enlarge-window-horizontally, shrink-window-horizontally):
argument to DELTA. Rename argument to DELTA.
(window-buffer-height): New function. (window-buffer-height): New function.
(fit-window-to-buffer, shrink-window-if-larger-than-buffer): (fit-window-to-buffer, shrink-window-if-larger-than-buffer):
Rewrite using new window resize routines. Rewrite using new window resize routines.
(kill-buffer-and-window, mouse-autoselect-window-select): Use (kill-buffer-and-window, mouse-autoselect-window-select):
ignore-errors instead of condition-case. Use ignore-errors instead of condition-case.
(quit-window): Call delete-frame instead of delete-windows-on (quit-window): Call delete-frame instead of delete-windows-on
for the only buffer on frame. for the only buffer on frame.
...@@ -191,8 +205,8 @@ ...@@ -191,8 +205,8 @@
* files.el (read-buffer-to-switch) * files.el (read-buffer-to-switch)
(switch-to-buffer-other-window) (switch-to-buffer-other-window)
(switch-to-buffer-other-frame, display-buffer-other-frame): Move (switch-to-buffer-other-frame, display-buffer-other-frame):
to window.el. Move to window.el.
* simple.el (get-next-valid-buffer, last-buffer, next-buffer) * simple.el (get-next-valid-buffer, last-buffer, next-buffer)
(previous-buffer): Move to window.el. (previous-buffer): Move to window.el.
...@@ -208,8 +222,8 @@ ...@@ -208,8 +222,8 @@
(switch-to-next-buffer): New functions. (switch-to-next-buffer): New functions.
(get-next-valid-buffer, last-buffer, next-buffer): Move here (get-next-valid-buffer, last-buffer, next-buffer): Move here
from simple.el. Call switch-to-next-buffer. from simple.el. Call switch-to-next-buffer.
(previous-buffer): Move here from simple.el. Call (previous-buffer): Move here from simple.el.
switch-to-prev-buffer. Call switch-to-prev-buffer.
(bury-buffer): Move here from buffer.c. Switch to previous (bury-buffer): Move here from buffer.c. Switch to previous
buffer when window cannot be deleted. buffer when window cannot be deleted.
(unbury-buffer): Move here from bindings.el. (unbury-buffer): Move here from bindings.el.
...@@ -218,8 +232,8 @@ ...@@ -218,8 +232,8 @@
(read-buffer-to-switch, switch-to-buffer-other-window) (read-buffer-to-switch, switch-to-buffer-other-window)
(switch-to-buffer-other-frame): Move here from files.el. (switch-to-buffer-other-frame): Move here from files.el.
(normalize-buffer-to-switch-to): New functions. (normalize-buffer-to-switch-to): New functions.
(switch-to-buffer): Move here from buffer.c. Use (switch-to-buffer): Move here from buffer.c.
read-buffer-to-switch and normalize-buffer-to-switch-to. Use read-buffer-to-switch and normalize-buffer-to-switch-to.
2011-06-10 Martin Rudalics <rudalics@gmx.at> 2011-06-10 Martin Rudalics <rudalics@gmx.at>
...@@ -234,8 +248,8 @@ ...@@ -234,8 +248,8 @@
(window-split-min-size): New function. (window-split-min-size): New function.
(split-window-keep-point): Mention split-window-above-each-other (split-window-keep-point): Mention split-window-above-each-other
instead of split-window-vertically. instead of split-window-vertically.
(split-window-above-each-other, split-window-vertically): Rename (split-window-above-each-other, split-window-vertically):
split-window-vertically to split-window-above-each-other and Rename split-window-vertically to split-window-above-each-other and
provide defalias for old definition. provide defalias for old definition.
(split-window-side-by-side, split-window-horizontally): Rename (split-window-side-by-side, split-window-horizontally): Rename
split-window-horizontally to split-window-side-by-side and provide split-window-horizontally to split-window-side-by-side and provide
...@@ -294,10 +308,10 @@ ...@@ -294,10 +308,10 @@
2011-06-08 Martin Rudalics <rudalics@gmx.at> 2011-06-08 Martin Rudalics <rudalics@gmx.at>
* window.el (one-window-p): Move down in code. Rewrite * window.el (one-window-p): Move down in code.
doc-string. Rewrite doc-string.
(window-current-scroll-bars): Rewrite doc-string. Normalize (window-current-scroll-bars): Rewrite doc-string.
live window argument. Normalize live window argument.
(walk-windows, get-window-with-predicate, count-windows): (walk-windows, get-window-with-predicate, count-windows):
Rewrite doc-string. Use window-list-1. Rewrite doc-string. Use window-list-1.
(window-in-direction-2, window-in-direction, get-mru-window): (window-in-direction-2, window-in-direction, get-mru-window):
...@@ -336,20 +350,20 @@ ...@@ -336,20 +350,20 @@
(image-transform-properties): Return quickly in the normal case. (image-transform-properties): Return quickly in the normal case.
(image-animate-loop): Rename from image-animate-max-time. (image-animate-loop): Rename from image-animate-max-time.
* image.el (image-animate-max-time): Moved to image-mode.el. * image.el (image-animate-max-time): Move to image-mode.el.
(create-animated-image): Remove unnecessary function. (create-animated-image): Remove unnecessary function.
(image-animate): Rename from image-animate-start. New arg. (image-animate): Rename from image-animate-start. New arg.
(image-animate-stop): Removed; just use image-animate-timer. (image-animate-stop): Remove; just use image-animate-timer.
(image-animate-timer): Use car-safe. (image-animate-timer): Use car-safe.
(image-animate-timeout): Rename argument. (image-animate-timeout): Rename argument.
2011-06-07 Martin Rudalics <rudalics@gmx.at> 2011-06-07 Martin Rudalics <rudalics@gmx.at>
* window.el (get-lru-window, get-largest-window): Move here from * window.el (get-lru-window, get-largest-window): Move here from
window.c. Rename first argument to ALL-FRAMES. Rephrase window.c. Rename first argument to ALL-FRAMES.
doc-strings. Rephrase doc-strings.
(get-buffer-window-list): Rewrite using window-list-1. Rephrase (get-buffer-window-list): Rewrite using window-list-1.
doc-string. Rephrase doc-string.
(window-safe-min-height, window-safe-min-width): New constants. (window-safe-min-height, window-safe-min-width): New constants.
(window-size-ignore, window-min-size, window-min-size-1) (window-size-ignore, window-min-size, window-min-size-1)
(window-sizable, window-sizable-p, window-size-fixed-1) (window-sizable, window-sizable-p, window-size-fixed-1)
...@@ -372,8 +386,8 @@ ...@@ -372,8 +386,8 @@
(walk-window-tree-1, walk-window-tree, walk-window-subtree) (walk-window-tree-1, walk-window-tree, walk-window-subtree)
(windows-with-parameter, window-with-parameter) (windows-with-parameter, window-with-parameter)
(window-atom-root, make-window-atom, window-atom-check-1) (window-atom-root, make-window-atom, window-atom-check-1)
(window-atom-check, window-side-check, window-check): New (window-atom-check, window-side-check, window-check):
functions. New functions.
(ignore-window-parameters, window-sides, window-sides-vertical) (ignore-window-parameters, window-sides, window-sides-vertical)
(window-sides-slots): New variables. (window-sides-slots): New variables.
(window-size-fixed): Move down in code. Minor doc-string fix. (window-size-fixed): Move down in code. Minor doc-string fix.
...@@ -411,8 +425,8 @@ ...@@ -411,8 +425,8 @@
2011-06-05 Roland Winkler <winkler@gnu.org> 2011-06-05 Roland Winkler <winkler@gnu.org>
* textmodes/bibtex.el (bibtex-search-entry-globally): New * textmodes/bibtex.el (bibtex-search-entry-globally):
variable. New variable.
(bibtex-search-entry): Use it. (bibtex-search-entry): Use it.
2011-06-05 Roland Winkler <winkler@gnu.org> 2011-06-05 Roland Winkler <winkler@gnu.org>
......
...@@ -935,7 +935,8 @@ Properties with special meaning: ...@@ -935,7 +935,8 @@ Properties with special meaning:
(unless table (unless table
(setq table (make-abbrev-table)) (setq table (make-abbrev-table))
(set tablename table) (set tablename table)
(push tablename abbrev-table-name-list)) (unless (memq tablename abbrev-table-name-list)
(push tablename abbrev-table-name-list)))
;; We used to just pass them to `make-abbrev-table', but that fails ;; We used to just pass them to `make-abbrev-table', but that fails
;; if the table was pre-existing as is the case if it was created by ;; if the table was pre-existing as is the case if it was created by
;; loading the user's abbrev file. ;; loading the user's abbrev file.
......
...@@ -238,13 +238,14 @@ first will be printed into the backtrace buffer." ...@@ -238,13 +238,14 @@ first will be printed into the backtrace buffer."
(kill-buffer debugger-buffer))) (kill-buffer debugger-buffer)))
;; Restore the previous state of the debugger-buffer, in case we were ;; Restore the previous state of the debugger-buffer, in case we were
;; in a recursive invocation of the debugger. ;; in a recursive invocation of the debugger.
(when (and debugger-previous-state (when (buffer-live-p debugger-buffer)
(buffer-live-p debugger-buffer))
(with-current-buffer debugger-buffer (with-current-buffer debugger-buffer
(let ((inhibit-read-only t)) (let ((inhibit-read-only t))
(erase-buffer) (erase-buffer)
(insert (nth 1 debugger-previous-state)) (if (null debugger-previous-state)
(funcall (nth 0 debugger-previous-state))))) (fundamental-mode)
(insert (nth 1 debugger-previous-state))
(funcall (nth 0 debugger-previous-state))))))
(with-timeout-unsuspend debugger-with-timeout-suspend) (with-timeout-unsuspend debugger-with-timeout-suspend)
(set-match-data debugger-outer-match-data))) (set-match-data debugger-outer-match-data)))
;; Put into effect the modified values of these variables ;; Put into effect the modified values of these variables
......
...@@ -84,6 +84,26 @@ ...@@ -84,6 +84,26 @@
;; - Maybe accept two juxtaposed non-terminals in the BNF under the condition ;; - Maybe accept two juxtaposed non-terminals in the BNF under the condition
;; that the first always ends with a terminal, or that the second always ;; that the first always ends with a terminal, or that the second always
;; starts with a terminal. ;; starts with a terminal.
;; - Permit EBNF-style notation.
;; - If the grammar has conflicts, the only way is to make the lexer return
;; different tokens for the different cases. This extra work performed by
;; the lexer can be costly and unnecessary: we perform this extra work every
;; time we find the conflicting token, regardless of whether or not the
;; difference between the various situations is relevant to the current
;; situation. E.g. we may try to determine whether a ";" is a ";-operator"
;; or a ";-separator" in a case where we're skipping over a "begin..end" pair
;; where the difference doesn't matter. For frequently occurring tokens and
;; rarely occurring conflicts, this can be a significant performance problem.
;; We could try and let the lexer return a "set of possible tokens
;; plus a refinement function" and then let parser call the refinement
;; function if needed.
;; - Make it possible to better specify the behavior in the face of
;; syntax errors. IOW provide some control over the choice of precedence
;; levels within the limits of the constraints. E.g. make it possible for
;; the grammar to specify that "begin..end" has lower precedence than
;; "Module..EndModule", so that if a "begin" is missing, scanning from the
;; "end" will stop at "Module" rather than going past it (and similarly,
;; scanning from "Module" should not stop at a spurious "end").
;;; Code: ;;; Code:
......
...@@ -313,9 +313,9 @@ ...@@ -313,9 +313,9 @@
(if (pcomplete-match "^-" 0) (if (pcomplete-match "^-" 0)
(pcomplete-opt "v") (pcomplete-opt "v")
(pcomplete-here (pcomplete-here
(if (eq mode 'test) (pcomplete-dirs-or-entries (if (eq mode 'test)
(pcomplete-dirs-or-entries "\\.tar\\'") "\\.tar\\'"
(pcomplete-dirs-or-entries "\\.spec\\'")))))) "\\.spec\\'"))))))
(t (t
(error "You must select a mode: -q, -i, -U, --verify, etc")))))) (error "You must select a mode: -q, -i, -U, --verify, etc"))))))
......
...@@ -1045,12 +1045,6 @@ casts and declarations are fontified. Used on level 2 and higher." ...@@ -1045,12 +1045,6 @@ casts and declarations are fontified. Used on level 2 and higher."
;; The position of the next token after the closing paren of ;; The position of the next token after the closing paren of
;; the last detected cast. ;; the last detected cast.
last-cast-end last-cast-end
;; Start of containing declaration (if any); limit for searching
;; backwards for it.
decl-start decl-search-lim
;; Start of containing declaration (if any); limit for searching
;; backwards for it.
decl-start decl-search-lim
;; The result from `c-forward-decl-or-cast-1'. ;; The result from `c-forward-decl-or-cast-1'.
decl-or-cast decl-or-cast
;; The maximum of the end positions of all the checked type ;; 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,109 +1182,107 @@ casts and declarations are fontified. Used on level 2 and higher."
(setq decl-or-cast (c-forward-decl-or-cast-1 (setq decl-or-cast (c-forward-decl-or-cast-1
match-pos context last-cast-end)) match-pos context last-cast-end))
(if (not decl-or-cast) (cond
;; Are we at a declarator? Try to go back to the declaration ((eq decl-or-cast 'cast)
;; to check this. Note that `c-beginning-of-decl-1' is slow, ;; Save the position after the previous cast so we can feed
;; so we cache its result between calls. ;; it to `c-forward-decl-or-cast-1' in the next round. That
(let (paren-state bod-res encl-pos is-typedef) ;; helps it discover cast chains like "(a) (b) c".
(goto-char start-pos) (setq last-cast-end (point))
(save-excursion (c-fontify-recorded-types-and-refs)
(unless (and decl-search-lim nil)
(eq decl-search-lim
(save-excursion
(c-syntactic-skip-backward "^;" nil t)
(point))))
(setq decl-search-lim
(and (c-syntactic-skip-backward "^;" nil t) (point)))
(setq bod-res (car (c-beginning-of-decl-1 decl-search-lim)))
(if (and (eq bod-res 'same)
(progn
(c-backward-syntactic-ws)
(eq (char-before) ?\})))
(c-beginning-of-decl-1 decl-search-lim))
(setq decl-start (point))))
(decl-or-cast
;; We've found a declaration.
;; Set `max-type-decl-end' or `max-type-decl-end-before-token'
;; under the assumption that we're after the first type decl
;; expression in the declaration now. That's not really true;
;; we could also be after a parenthesized initializer
;; expression in C++, but this is only used as a last resort
;; to slant ambiguous expression/declarations, and overall
;; it's worth the risk to occasionally fontify an expression
;; as a declaration in an initializer expression compared to
;; getting ambiguous things in normal function prototypes
;; fontified as expressions.
(if inside-macro
(when (> (point) max-type-decl-end-before-token)
(setq max-type-decl-end-before-token (point)))
(when (> (point) max-type-decl-end)
(setq max-type-decl-end (point))))
;; Back up to the type to fontify the declarator(s).
(goto-char (car decl-or-cast))
(let ((decl-list
(if context
;; Should normally not fontify a list of
;; declarators inside an arglist, but the first
;; argument in the ';' separated list of a "for"
;; statement is an exception.
(when (eq (char-before match-pos) ?\()
(save-excursion
(goto-char (1- match-pos))
(c-backward-syntactic-ws)
(and (c-simple-skip-symbol-backward)
(looking-at c-paren-stmt-key))))
t)))
;; Fix the `c-decl-id-start' or `c-decl-type-start' property
;; before the first declarator if it's a list.
;; `c-font-lock-declarators' handles the rest.
(when decl-list
(save-excursion (save-excursion
(goto-char decl-start) (c-backward-syntactic-ws)
;; We're now putatively at the declaration. (unless (bobp)
(setq paren-state (c-parse-state)) (c-put-char-property (1- (point)) 'c-type
;; At top level or inside a "{"? (if (cdr decl-or-cast)
(if (or (not (setq encl-pos 'c-decl-type-start
(c-most-enclosing-brace paren-state))) 'c-decl-id-start)))))
(eq (char-after encl-pos) ?\{))
(progn