annotate src/commands.h @ 106395:f2b36fb84bf7

Enhance `c-parse-state' to run efficiently in "brace desserts". * progmodes/cc-mode.el (c-basic-common-init): Call c-state-cache-init. (c-neutralize-syntax-in-and-mark-CPP): Renamed from c-extend-and-neutralize-syntax-in-CPP. Mark each CPP construct by placing `category' properties value 'c-cpp-delimiter at its boundaries. * progmodes/cc-langs.el (c-before-font-lock-function): c-extend-and-neutralize-syntax-in-CPP has been renamed c-neutralize-syntax-in-and-mark-CPP. * progmodes/cc-fonts.el (c-cpp-matchers): Mark template brackets with `category' properties now, not `syntax-table' ones. * progmodes/cc-engine.el (c-syntactic-end-of-macro): A new enhanced (but slower) version of c-end-of-macro that won't land inside a literal or on another awkward character. (c-state-cache-too-far, c-state-cache-start) (c-state-nonlit-pos-interval, c-state-nonlit-pos-cache) (c-state-nonlit-pos-cache-limit, c-state-point-min) (c-state-point-min-lit-type, c-state-point-min-lit-start) (c-state-min-scan-pos, c-state-brace-pair-desert) (c-state-old-cpp-beg, c-state-old-cpp-end): New constants and buffer local variables. (c-state-literal-at, c-state-lit-beg) (c-state-cache-non-literal-place, c-state-get-min-scan-pos) (c-state-mark-point-min-literal, c-state-cache-top-lparen) (c-state-cache-top-paren, c-state-cache-after-top-paren) (c-get-cache-scan-pos, c-get-fallback-scan-pos) (c-state-balance-parens-backwards, c-parse-state-get-strategy) (c-renarrow-state-cache) (c-append-lower-brace-pair-to-state-cache) (c-state-push-any-brace-pair, c-append-to-state-cache) (c-remove-stale-state-cache) (c-remove-stale-state-cache-backwards, c-state-cache-init) (c-invalidate-state-cache-1, c-parse-state-1) (c-invalidate-state-cache): New defuns/defmacros/defsubsts. (c-parse-state): Enhanced and refactored. (c-debug-parse-state): Amended to deal with all the new variables. * progmodes/cc-defs.el (c-<-as-paren-syntax, c-mark-<-as-paren) (c->-as-paren-syntax, c-mark->-as-paren, c-unmark-<->-as-paren): modify to use category text properties rather than syntax-table ones. (c-suppress-<->-as-parens, c-restore-<->-as-parens): new defsubsts to switch off/on the syntactic paren property of C++ template delimiters using the category property. (c-with-<->-as-parens-suppressed): Macro to invoke code with template delims suppressed. (c-cpp-delimiter, c-set-cpp-delimiters, c-clear-cpp-delimiters): New constant/macros which apply category properties to the start and end of preprocessor constructs. (c-comment-out-cpps, c-uncomment-out-cpps): defsubsts which "comment out" the syntactic value of characters in preprocessor constructs. (c-with-cpps-commented-out) (c-with-all-but-one-cpps-commented-out): Macros to invoke code with characters in all or all but one preprocessor constructs "commented out".
author Alan Mackenzie <acm@muc.de>
date Thu, 03 Dec 2009 16:02:10 +0000
parents 665b8b95b06f
children 1d1d5d9bd884
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1 /* Definitions needed by most editing commands.
75227
e90d04cd455a Update copyright for years from Emacs 21 to present (mainly adding
Glenn Morris <rgm@gnu.org>
parents: 68651
diff changeset
2 Copyright (C) 1985, 1994, 2001, 2002, 2003, 2004,
100951
e038c1a8307c Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 95575
diff changeset
3 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5 This file is part of GNU Emacs.
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6
94994
29adfc9354e7 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79759
diff changeset
7 GNU Emacs is free software: you can redistribute it and/or modify
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
94994
29adfc9354e7 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79759
diff changeset
9 the Free Software Foundation, either version 3 of the License, or
29adfc9354e7 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79759
diff changeset
10 (at your option) any later version.
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12 GNU Emacs is distributed in the hope that it will be useful,
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15 GNU General Public License for more details.
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
94994
29adfc9354e7 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 79759
diff changeset
18 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21 #define Ctl(c) ((c)&037)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22
3886
92f6b47e3e8d * keyboard.c (menu_bar_items, read_key_sequence): Use
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
23 /* Define the names of keymaps, just so people can refer to them in
92f6b47e3e8d * keyboard.c (menu_bar_items, read_key_sequence): Use
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
24 calls to initial_define_key. These should *not* be used after
92f6b47e3e8d * keyboard.c (menu_bar_items, read_key_sequence): Use
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
25 initialization; use-global-map doesn't affect these; it sets
92f6b47e3e8d * keyboard.c (menu_bar_items, read_key_sequence): Use
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
26 current_global_map instead. */
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27 extern Lisp_Object global_map;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28 extern Lisp_Object meta_map;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29 extern Lisp_Object control_x_map;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 extern Lisp_Object Vminibuffer_local_map;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33 extern Lisp_Object Vminibuffer_local_ns_map;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35 /* keymap used for minibuffers when doing completion */
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 extern Lisp_Object Vminibuffer_local_completion_map;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37
67258
a68df09a8a34 (Vminibuffer_local_filename_completion_map): Declare a new keymap for
Eli Zaretskii <eliz@gnu.org>
parents: 64770
diff changeset
38 /* keymap used for minibuffers when doing completion in filenames*/
a68df09a8a34 (Vminibuffer_local_filename_completion_map): Declare a new keymap for
Eli Zaretskii <eliz@gnu.org>
parents: 64770
diff changeset
39 extern Lisp_Object Vminibuffer_local_filename_completion_map;
a68df09a8a34 (Vminibuffer_local_filename_completion_map): Declare a new keymap for
Eli Zaretskii <eliz@gnu.org>
parents: 64770
diff changeset
40
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41 /* keymap used for minibuffers when doing completion and require a match */
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 extern Lisp_Object Vminibuffer_local_must_match_map;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43
67258
a68df09a8a34 (Vminibuffer_local_filename_completion_map): Declare a new keymap for
Eli Zaretskii <eliz@gnu.org>
parents: 64770
diff changeset
44 /* keymap used for minibuffers when doing completion in filenames
a68df09a8a34 (Vminibuffer_local_filename_completion_map): Declare a new keymap for
Eli Zaretskii <eliz@gnu.org>
parents: 64770
diff changeset
45 and require a match */
95575
d34a432d5863 * keymap.c (Vminibuffer_local_filename_must_match_map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 94994
diff changeset
46 extern Lisp_Object Vminibuffer_local_filename_must_match_map;
67258
a68df09a8a34 (Vminibuffer_local_filename_completion_map): Declare a new keymap for
Eli Zaretskii <eliz@gnu.org>
parents: 64770
diff changeset
47
100998
665b8b95b06f Update for last_command_char rename.
Glenn Morris <rgm@gnu.org>
parents: 100951
diff changeset
48 /* Last input event read as a command. */
665b8b95b06f Update for last_command_char rename.
Glenn Morris <rgm@gnu.org>
parents: 100951
diff changeset
49 extern Lisp_Object last_command_event;
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50
100998
665b8b95b06f Update for last_command_char rename.
Glenn Morris <rgm@gnu.org>
parents: 100951
diff changeset
51 /* Last input event read as a command, not counting menus
1080
8f64d3122435 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 485
diff changeset
52 reached by the mouse. */
8f64d3122435 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 485
diff changeset
53 extern Lisp_Object last_nonmenu_event;
8f64d3122435 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 485
diff changeset
54
1821
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1587
diff changeset
55 /* List of command events to be re-read, or Qnil. */
7171
945fd4c43a14 (Vunread_command_events): Renamed.
Richard M. Stallman <rms@gnu.org>
parents: 6536
diff changeset
56 extern Lisp_Object Vunread_command_events;
1587
57ae5625fe22 * commands.h (unread_command_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 1507
diff changeset
57
8273
cd8665daa5a8 (unread_command_char): Declared.
Richard M. Stallman <rms@gnu.org>
parents: 7331
diff changeset
58 /* Command char event to be re-read, or -1 if none.
cd8665daa5a8 (unread_command_char): Declared.
Richard M. Stallman <rms@gnu.org>
parents: 7331
diff changeset
59 Setting this is obsolete, but some things should still check it. */
43713
f92c4d87863a Change defvar_int def and vars to use EMACS_INT instead of just int.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 22967
diff changeset
60 extern EMACS_INT unread_command_char;
8273
cd8665daa5a8 (unread_command_char): Declared.
Richard M. Stallman <rms@gnu.org>
parents: 7331
diff changeset
61
6536
4fa1c2b2f1e9 (this_command, last_command): Declared.
Richard M. Stallman <rms@gnu.org>
parents: 6179
diff changeset
62 /* The command being executed by the command loop.
12162
f670e669470b (last_command): Var deleted; now part of struct kboard.
Karl Heuer <kwzh@gnu.org>
parents: 8273
diff changeset
63 Commands may set this, and the value set will be copied into
f670e669470b (last_command): Var deleted; now part of struct kboard.
Karl Heuer <kwzh@gnu.org>
parents: 8273
diff changeset
64 current_kboard->Vlast_command instead of the actual command. */
22967
63801d5488f4 (Vthis_command): Renamed from this_command.
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
65 extern Lisp_Object Vthis_command;
6536
4fa1c2b2f1e9 (this_command, last_command): Declared.
Richard M. Stallman <rms@gnu.org>
parents: 6179
diff changeset
66
1587
57ae5625fe22 * commands.h (unread_command_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 1507
diff changeset
67 /* If not Qnil, this is a switch-frame event which we decided to put
57ae5625fe22 * commands.h (unread_command_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 1507
diff changeset
68 off until the end of a key sequence. This should be read as the
7171
945fd4c43a14 (Vunread_command_events): Renamed.
Richard M. Stallman <rms@gnu.org>
parents: 6536
diff changeset
69 next command input, after any Vunread_command_events.
1587
57ae5625fe22 * commands.h (unread_command_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 1507
diff changeset
70
57ae5625fe22 * commands.h (unread_command_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 1507
diff changeset
71 read_key_sequence uses this to delay switch-frame events until the
57ae5625fe22 * commands.h (unread_command_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 1507
diff changeset
72 end of the key sequence; Fread_char uses it to put off switch-frame
57ae5625fe22 * commands.h (unread_command_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 1507
diff changeset
73 events until a non-ASCII event is acceptable as input. */
57ae5625fe22 * commands.h (unread_command_event): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 1507
diff changeset
74 extern Lisp_Object unread_switch_frame;
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75
67831
5cb0abe0420f (last_point_position_window): Declare.
Richard M. Stallman <rms@gnu.org>
parents: 67258
diff changeset
76 /* The value of point when the last command was started. */
6179
e2bb2d0b8a00 New variable last_point_position.
Karl Heuer <kwzh@gnu.org>
parents: 3886
diff changeset
77 extern int last_point_position;
e2bb2d0b8a00 New variable last_point_position.
Karl Heuer <kwzh@gnu.org>
parents: 3886
diff changeset
78
7331
18bc27b97236 (last_point_position_buffer): Declared.
Richard M. Stallman <rms@gnu.org>
parents: 7307
diff changeset
79 /* The buffer that was current when the last command was started. */
18bc27b97236 (last_point_position_buffer): Declared.
Richard M. Stallman <rms@gnu.org>
parents: 7307
diff changeset
80 extern Lisp_Object last_point_position_buffer;
18bc27b97236 (last_point_position_buffer): Declared.
Richard M. Stallman <rms@gnu.org>
parents: 7307
diff changeset
81
67831
5cb0abe0420f (last_point_position_window): Declare.
Richard M. Stallman <rms@gnu.org>
parents: 67258
diff changeset
82 /* The window that was selected when the last command was started. */
5cb0abe0420f (last_point_position_window): Declare.
Richard M. Stallman <rms@gnu.org>
parents: 67258
diff changeset
83 extern Lisp_Object last_point_position_window;
5cb0abe0420f (last_point_position_window): Declare.
Richard M. Stallman <rms@gnu.org>
parents: 67258
diff changeset
84
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 /* Nonzero means ^G can quit instantly */
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86 extern int immediate_quit;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87
61981
8131d95ff037 (Vexecuting_kbd_macro): Declare instead of Vexecuting_macro.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
88 extern Lisp_Object Vexecuting_kbd_macro;
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 /* Nonzero if input is coming from the keyboard */
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91
61981
8131d95ff037 (Vexecuting_kbd_macro): Declare instead of Vexecuting_macro.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
92 #define INTERACTIVE (NILP (Vexecuting_kbd_macro) && !noninteractive)
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94 /* Set this nonzero to force reconsideration of mode line. */
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
96 extern int update_mode_lines;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98 /* Nonzero means reading single-character input with prompt
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99 so put cursor on minibuffer after the prompt. */
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101 extern int cursor_in_echo_area;
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 43713
diff changeset
102
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 43713
diff changeset
103 /* arch-tag: 4f7ca0b7-6a56-4b20-8bf5-b67a99921d1d
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 43713
diff changeset
104 (do not change this comment) */