diff options
| author | Alan Mackenzie | 2013-03-04 19:33:23 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2013-03-04 19:33:23 +0000 |
| commit | e0bc0f33bd68092b5b3c083fb485a35556a5b73b (patch) | |
| tree | ce2417efb82feb16d969e23ea49a3fa8918c10d6 | |
| parent | 84ac6f9d211796a458214741bdf9677b92bf1c2a (diff) | |
| download | emacs-e0bc0f33bd68092b5b3c083fb485a35556a5b73b.tar.gz emacs-e0bc0f33bd68092b5b3c083fb485a35556a5b73b.zip | |
Replace `last-command-event' by `last-command-char' in XEmacs.
progmodes/cc-defs.el (c-last-command-char): New macro.
progmodes/cc-align.el (c-semi&comma-inside-parenlist)
(c-semi&comma-no-newlines-before-nonblanks)
(c-semi&comma-no-newlines-for-oneline-inliners): Use the new macro in
place of `last-command-event'.
progmodes/cc-cmds.el (c-electric-pound, c-electric-brace)
(c-electric-slash, c-electric-semi&comma, c-electric-lt-gt)
(c-electric-paren, c-electric-continued-statement): Use the new macro in
place of `last-command-event'.
| -rw-r--r-- | lisp/ChangeLog | 13 | ||||
| -rw-r--r-- | lisp/progmodes/cc-align.el | 18 | ||||
| -rw-r--r-- | lisp/progmodes/cc-cmds.el | 30 | ||||
| -rw-r--r-- | lisp/progmodes/cc-defs.el | 7 |
4 files changed, 44 insertions, 24 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fb7883c03d4..4cf18ebb1f6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2013-03-04 Alan Mackenzie <acm@muc.de> | ||
| 2 | |||
| 3 | Replace `last-command-event' by `last-command-char' in XEmacs. | ||
| 4 | * progmodes/cc-defs.el (c-last-command-char): New macro. | ||
| 5 | * progmodes/cc-align.el (c-semi&comma-inside-parenlist) | ||
| 6 | (c-semi&comma-no-newlines-before-nonblanks) | ||
| 7 | (c-semi&comma-no-newlines-for-oneline-inliners): Use the new macro | ||
| 8 | in place of `last-command-event'. | ||
| 9 | * progmodes/cc-cmds.el (c-electric-pound, c-electric-brace) | ||
| 10 | (c-electric-slash, c-electric-semi&comma, c-electric-lt-gt) | ||
| 11 | (c-electric-paren, c-electric-continued-statement): Use the new | ||
| 12 | macro in place of `last-command-event'. | ||
| 13 | |||
| 1 | 2013-03-04 Glenn Morris <rgm@gnu.org> | 14 | 2013-03-04 Glenn Morris <rgm@gnu.org> |
| 2 | 15 | ||
| 3 | * files.el (inhibit-local-variables-regexps): | 16 | * files.el (inhibit-local-variables-regexps): |
diff --git a/lisp/progmodes/cc-align.el b/lisp/progmodes/cc-align.el index cb8d2d23c84..cdd0561a054 100644 --- a/lisp/progmodes/cc-align.el +++ b/lisp/progmodes/cc-align.el | |||
| @@ -1284,7 +1284,7 @@ newline is added. In either case, checking is stopped. This supports | |||
| 1284 | exactly the old newline insertion behavior." | 1284 | exactly the old newline insertion behavior." |
| 1285 | ;; newline only after semicolon, but only if that semicolon is not | 1285 | ;; newline only after semicolon, but only if that semicolon is not |
| 1286 | ;; inside a parenthesis list (e.g. a for loop statement) | 1286 | ;; inside a parenthesis list (e.g. a for loop statement) |
| 1287 | (if (not (eq last-command-event ?\;)) | 1287 | (if (not (eq (c-last-command-char) ?\;)) |
| 1288 | nil ; continue checking | 1288 | nil ; continue checking |
| 1289 | (if (condition-case nil | 1289 | (if (condition-case nil |
| 1290 | (save-excursion | 1290 | (save-excursion |
| @@ -1301,7 +1301,7 @@ If a comma was inserted, no determination is made. If a semicolon was | |||
| 1301 | inserted, and the following line is not blank, no newline is inserted. | 1301 | inserted, and the following line is not blank, no newline is inserted. |
| 1302 | Otherwise, no determination is made." | 1302 | Otherwise, no determination is made." |
| 1303 | (save-excursion | 1303 | (save-excursion |
| 1304 | (if (and (= last-command-event ?\;) | 1304 | (if (and (= (c-last-command-char) ?\;) |
| 1305 | ;;(/= (point-max) | 1305 | ;;(/= (point-max) |
| 1306 | ;; (save-excursion (skip-syntax-forward " ") (point)) | 1306 | ;; (save-excursion (skip-syntax-forward " ") (point)) |
| 1307 | (zerop (forward-line 1)) | 1307 | (zerop (forward-line 1)) |
| @@ -1318,13 +1318,13 @@ suppressed in one-liners, if the line is an in-class inline function. | |||
| 1318 | For other semicolon contexts, no determination is made." | 1318 | For other semicolon contexts, no determination is made." |
| 1319 | (let ((syntax (c-guess-basic-syntax)) | 1319 | (let ((syntax (c-guess-basic-syntax)) |
| 1320 | (bol (save-excursion | 1320 | (bol (save-excursion |
| 1321 | (if (c-safe (up-list -1) t) | 1321 | (if (c-safe (up-list -1) t) |
| 1322 | (c-point 'bol) | 1322 | (c-point 'bol) |
| 1323 | -1)))) | 1323 | -1)))) |
| 1324 | (if (and (eq last-command-event ?\;) | 1324 | (if (and (eq (c-last-command-char) ?\;) |
| 1325 | (eq (car (car syntax)) 'inclass) | 1325 | (eq (car (car syntax)) 'inclass) |
| 1326 | (eq (car (car (cdr syntax))) 'topmost-intro) | 1326 | (eq (car (car (cdr syntax))) 'topmost-intro) |
| 1327 | (= (c-point 'bol) bol)) | 1327 | (= (c-point 'bol) bol)) |
| 1328 | 'stop | 1328 | 'stop |
| 1329 | nil))) | 1329 | nil))) |
| 1330 | 1330 | ||
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index e7b12ba04c8..0bb804799dc 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el | |||
| @@ -475,7 +475,7 @@ inside a literal or a macro, nothing special happens." | |||
| 475 | (bolp (bolp))) | 475 | (bolp (bolp))) |
| 476 | (beginning-of-line) | 476 | (beginning-of-line) |
| 477 | (delete-horizontal-space) | 477 | (delete-horizontal-space) |
| 478 | (insert last-command-event) | 478 | (insert (c-last-command-char)) |
| 479 | (and (not bolp) | 479 | (and (not bolp) |
| 480 | (goto-char (- (point-max) pos))) | 480 | (goto-char (- (point-max) pos))) |
| 481 | ))) | 481 | ))) |
| @@ -737,7 +737,7 @@ settings of `c-cleanup-list' are done." | |||
| 737 | ;; `}': clean up empty defun braces | 737 | ;; `}': clean up empty defun braces |
| 738 | (when (c-save-buffer-state () | 738 | (when (c-save-buffer-state () |
| 739 | (and (memq 'empty-defun-braces c-cleanup-list) | 739 | (and (memq 'empty-defun-braces c-cleanup-list) |
| 740 | (eq last-command-event ?\}) | 740 | (eq (c-last-command-char) ?\}) |
| 741 | (c-intersect-lists '(defun-close class-close inline-close) | 741 | (c-intersect-lists '(defun-close class-close inline-close) |
| 742 | syntax) | 742 | syntax) |
| 743 | (progn | 743 | (progn |
| @@ -753,14 +753,14 @@ settings of `c-cleanup-list' are done." | |||
| 753 | ;; `}': compact to a one-liner defun? | 753 | ;; `}': compact to a one-liner defun? |
| 754 | (save-match-data | 754 | (save-match-data |
| 755 | (when | 755 | (when |
| 756 | (and (eq last-command-event ?\}) | 756 | (and (eq (c-last-command-char) ?\}) |
| 757 | (memq 'one-liner-defun c-cleanup-list) | 757 | (memq 'one-liner-defun c-cleanup-list) |
| 758 | (c-intersect-lists '(defun-close) syntax) | 758 | (c-intersect-lists '(defun-close) syntax) |
| 759 | (c-try-one-liner)) | 759 | (c-try-one-liner)) |
| 760 | (setq here (- (point-max) pos)))) | 760 | (setq here (- (point-max) pos)))) |
| 761 | 761 | ||
| 762 | ;; `{': clean up brace-else-brace and brace-elseif-brace | 762 | ;; `{': clean up brace-else-brace and brace-elseif-brace |
| 763 | (when (eq last-command-event ?\{) | 763 | (when (eq (c-last-command-char) ?\{) |
| 764 | (cond | 764 | (cond |
| 765 | ((and (memq 'brace-else-brace c-cleanup-list) | 765 | ((and (memq 'brace-else-brace c-cleanup-list) |
| 766 | (re-search-backward | 766 | (re-search-backward |
| @@ -814,7 +814,7 @@ settings of `c-cleanup-list' are done." | |||
| 814 | )))) | 814 | )))) |
| 815 | 815 | ||
| 816 | ;; blink the paren | 816 | ;; blink the paren |
| 817 | (and (eq last-command-event ?\}) | 817 | (and (eq (c-last-command-char) ?\}) |
| 818 | (not executing-kbd-macro) | 818 | (not executing-kbd-macro) |
| 819 | old-blink-paren | 819 | old-blink-paren |
| 820 | (save-excursion | 820 | (save-excursion |
| @@ -851,7 +851,7 @@ is inhibited." | |||
| 851 | (when (and (not arg) | 851 | (when (and (not arg) |
| 852 | (eq literal 'c) | 852 | (eq literal 'c) |
| 853 | (memq 'comment-close-slash c-cleanup-list) | 853 | (memq 'comment-close-slash c-cleanup-list) |
| 854 | (eq last-command-event ?/) | 854 | (eq (c-last-command-char) ?/) |
| 855 | (looking-at (concat "[ \t]*\\(" | 855 | (looking-at (concat "[ \t]*\\(" |
| 856 | (regexp-quote comment-end) "\\)?$")) | 856 | (regexp-quote comment-end) "\\)?$")) |
| 857 | ; (eq c-block-comment-ender "*/") ; C-style comments ALWAYS end in */ | 857 | ; (eq c-block-comment-ender "*/") ; C-style comments ALWAYS end in */ |
| @@ -867,7 +867,7 @@ is inhibited." | |||
| 867 | (setq indentp (and (not arg) | 867 | (setq indentp (and (not arg) |
| 868 | c-syntactic-indentation | 868 | c-syntactic-indentation |
| 869 | c-electric-flag | 869 | c-electric-flag |
| 870 | (eq last-command-event ?/) | 870 | (eq (c-last-command-char) ?/) |
| 871 | (eq (char-before) (if literal ?* ?/)))) | 871 | (eq (char-before) (if literal ?* ?/)))) |
| 872 | (self-insert-command (prefix-numeric-value arg)) | 872 | (self-insert-command (prefix-numeric-value arg)) |
| 873 | (if indentp | 873 | (if indentp |
| @@ -941,10 +941,10 @@ settings of `c-cleanup-list'." | |||
| 941 | (let ((pos (- (point-max) (point)))) | 941 | (let ((pos (- (point-max) (point)))) |
| 942 | (if (c-save-buffer-state () | 942 | (if (c-save-buffer-state () |
| 943 | (and (or (and | 943 | (and (or (and |
| 944 | (eq last-command-event ?,) | 944 | (eq (c-last-command-char) ?,) |
| 945 | (memq 'list-close-comma c-cleanup-list)) | 945 | (memq 'list-close-comma c-cleanup-list)) |
| 946 | (and | 946 | (and |
| 947 | (eq last-command-event ?\;) | 947 | (eq (c-last-command-char) ?\;) |
| 948 | (memq 'defun-close-semi c-cleanup-list))) | 948 | (memq 'defun-close-semi c-cleanup-list))) |
| 949 | (progn | 949 | (progn |
| 950 | (forward-char -1) | 950 | (forward-char -1) |
| @@ -1101,7 +1101,7 @@ numeric argument is supplied, or the point is inside a literal." | |||
| 1101 | ;; Indent the line if appropriate. | 1101 | ;; Indent the line if appropriate. |
| 1102 | (when (and c-electric-flag c-syntactic-indentation c-recognize-<>-arglists) | 1102 | (when (and c-electric-flag c-syntactic-indentation c-recognize-<>-arglists) |
| 1103 | (setq found-delim | 1103 | (setq found-delim |
| 1104 | (if (eq last-command-event ?<) | 1104 | (if (eq (c-last-command-char) ?<) |
| 1105 | ;; If a <, basically see if it's got "template" before it ..... | 1105 | ;; If a <, basically see if it's got "template" before it ..... |
| 1106 | (or (and (progn | 1106 | (or (and (progn |
| 1107 | (backward-char) | 1107 | (backward-char) |
| @@ -1195,7 +1195,7 @@ newline cleanups are done if appropriate; see the variable `c-cleanup-list'." | |||
| 1195 | ;; clean up brace-elseif-brace | 1195 | ;; clean up brace-elseif-brace |
| 1196 | (when | 1196 | (when |
| 1197 | (and (memq 'brace-elseif-brace c-cleanup-list) | 1197 | (and (memq 'brace-elseif-brace c-cleanup-list) |
| 1198 | (eq last-command-event ?\() | 1198 | (eq (c-last-command-char) ?\() |
| 1199 | (re-search-backward | 1199 | (re-search-backward |
| 1200 | (concat "}" | 1200 | (concat "}" |
| 1201 | "\\([ \t\n]\\|\\\\\n\\)*" | 1201 | "\\([ \t\n]\\|\\\\\n\\)*" |
| @@ -1213,7 +1213,7 @@ newline cleanups are done if appropriate; see the variable `c-cleanup-list'." | |||
| 1213 | ;; clean up brace-catch-brace | 1213 | ;; clean up brace-catch-brace |
| 1214 | (when | 1214 | (when |
| 1215 | (and (memq 'brace-catch-brace c-cleanup-list) | 1215 | (and (memq 'brace-catch-brace c-cleanup-list) |
| 1216 | (eq last-command-event ?\() | 1216 | (eq (c-last-command-char) ?\() |
| 1217 | (re-search-backward | 1217 | (re-search-backward |
| 1218 | (concat "}" | 1218 | (concat "}" |
| 1219 | "\\([ \t\n]\\|\\\\\n\\)*" | 1219 | "\\([ \t\n]\\|\\\\\n\\)*" |
| @@ -1234,7 +1234,7 @@ newline cleanups are done if appropriate; see the variable `c-cleanup-list'." | |||
| 1234 | 1234 | ||
| 1235 | ;; space-before-funcall clean-up? | 1235 | ;; space-before-funcall clean-up? |
| 1236 | ((and (memq 'space-before-funcall c-cleanup-list) | 1236 | ((and (memq 'space-before-funcall c-cleanup-list) |
| 1237 | (eq last-command-event ?\() | 1237 | (eq (c-last-command-char) ?\() |
| 1238 | (save-excursion | 1238 | (save-excursion |
| 1239 | (backward-char) | 1239 | (backward-char) |
| 1240 | (skip-chars-backward " \t") | 1240 | (skip-chars-backward " \t") |
| @@ -1252,7 +1252,7 @@ newline cleanups are done if appropriate; see the variable `c-cleanup-list'." | |||
| 1252 | ;; compact-empty-funcall clean-up? | 1252 | ;; compact-empty-funcall clean-up? |
| 1253 | ((c-save-buffer-state () | 1253 | ((c-save-buffer-state () |
| 1254 | (and (memq 'compact-empty-funcall c-cleanup-list) | 1254 | (and (memq 'compact-empty-funcall c-cleanup-list) |
| 1255 | (eq last-command-event ?\)) | 1255 | (eq (c-last-command-char) ?\)) |
| 1256 | (save-excursion | 1256 | (save-excursion |
| 1257 | (c-safe (backward-char 2)) | 1257 | (c-safe (backward-char 2)) |
| 1258 | (when (looking-at "()") | 1258 | (when (looking-at "()") |
| @@ -1281,7 +1281,7 @@ keyword on the line, the keyword is not inserted inside a literal, and | |||
| 1281 | (when (c-save-buffer-state () | 1281 | (when (c-save-buffer-state () |
| 1282 | (and c-electric-flag | 1282 | (and c-electric-flag |
| 1283 | c-syntactic-indentation | 1283 | c-syntactic-indentation |
| 1284 | (not (eq last-command-event ?_)) | 1284 | (not (eq (c-last-command-char) ?_)) |
| 1285 | (= (save-excursion | 1285 | (= (save-excursion |
| 1286 | (skip-syntax-backward "w") | 1286 | (skip-syntax-backward "w") |
| 1287 | (point)) | 1287 | (point)) |
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index 78c3f32b7a0..48236c2dca2 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el | |||
| @@ -376,6 +376,13 @@ to it is returned. This function does not modify the point or the mark." | |||
| 376 | `(int-to-char ,integer) | 376 | `(int-to-char ,integer) |
| 377 | integer)) | 377 | integer)) |
| 378 | 378 | ||
| 379 | (defmacro c-last-command-char () | ||
| 380 | ;; The last character just typed. Note that `last-command-event' exists in | ||
| 381 | ;; both Emacs and XEmacs, but with confusingly different meanings. | ||
| 382 | (if (featurep 'xemacs) | ||
| 383 | 'last-command-char | ||
| 384 | 'last-command-event)) | ||
| 385 | |||
| 379 | (defmacro c-sentence-end () | 386 | (defmacro c-sentence-end () |
| 380 | ;; Get the regular expression `sentence-end'. | 387 | ;; Get the regular expression `sentence-end'. |
| 381 | (if (cc-bytecomp-fboundp 'sentence-end) | 388 | (if (cc-bytecomp-fboundp 'sentence-end) |