emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111938: Replace `last-command-event'


From: Alan Mackenzie
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111938: Replace `last-command-event' by `last-command-char' in XEmacs.
Date: Mon, 04 Mar 2013 19:33:23 +0000
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111938
committer: Alan Mackenzie <address@hidden>
branch nick: trunk
timestamp: Mon 2013-03-04 19:33:23 +0000
message:
  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'.
modified:
  lisp/ChangeLog
  lisp/progmodes/cc-align.el
  lisp/progmodes/cc-cmds.el
  lisp/progmodes/cc-defs.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-03-04 07:37:30 +0000
+++ b/lisp/ChangeLog    2013-03-04 19:33:23 +0000
@@ -1,3 +1,16 @@
+2013-03-04  Alan Mackenzie  <address@hidden>
+
+       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'.
+
 2013-03-04  Glenn Morris  <address@hidden>
 
        * files.el (inhibit-local-variables-regexps):

=== modified file 'lisp/progmodes/cc-align.el'
--- a/lisp/progmodes/cc-align.el        2013-02-12 17:36:54 +0000
+++ b/lisp/progmodes/cc-align.el        2013-03-04 19:33:23 +0000
@@ -1284,7 +1284,7 @@
 exactly the old newline insertion behavior."
   ;; newline only after semicolon, but only if that semicolon is not
   ;; inside a parenthesis list (e.g. a for loop statement)
-  (if (not (eq last-command-event ?\;))
+  (if (not (eq (c-last-command-char) ?\;))
       nil                              ; continue checking
     (if (condition-case nil
            (save-excursion
@@ -1301,7 +1301,7 @@
 inserted, and the following line is not blank, no newline is inserted.
 Otherwise, no determination is made."
   (save-excursion
-    (if (and (= last-command-event ?\;)
+    (if (and (= (c-last-command-char) ?\;)
             ;;(/= (point-max)
             ;;    (save-excursion (skip-syntax-forward " ") (point))
             (zerop (forward-line 1))
@@ -1318,13 +1318,13 @@
 For other semicolon contexts, no determination is made."
   (let ((syntax (c-guess-basic-syntax))
         (bol (save-excursion
-               (if (c-safe (up-list -1) t)
-                   (c-point 'bol)
-                 -1))))
-    (if (and (eq last-command-event ?\;)
-             (eq (car (car syntax)) 'inclass)
-             (eq (car (car (cdr syntax))) 'topmost-intro)
-             (= (c-point 'bol) bol))
+              (if (c-safe (up-list -1) t)
+                  (c-point 'bol)
+                -1))))
+    (if (and (eq (c-last-command-char) ?\;)
+            (eq (car (car syntax)) 'inclass)
+            (eq (car (car (cdr syntax))) 'topmost-intro)
+            (= (c-point 'bol) bol))
         'stop
       nil)))
 

=== modified file 'lisp/progmodes/cc-cmds.el'
--- a/lisp/progmodes/cc-cmds.el 2013-01-01 09:11:05 +0000
+++ b/lisp/progmodes/cc-cmds.el 2013-03-04 19:33:23 +0000
@@ -475,7 +475,7 @@
          (bolp (bolp)))
       (beginning-of-line)
       (delete-horizontal-space)
-      (insert last-command-event)
+      (insert (c-last-command-char))
       (and (not bolp)
           (goto-char (- (point-max) pos)))
       )))
@@ -737,7 +737,7 @@
              ;; `}': clean up empty defun braces
              (when (c-save-buffer-state ()
                      (and (memq 'empty-defun-braces c-cleanup-list)
-                          (eq last-command-event ?\})
+                          (eq (c-last-command-char) ?\})
                           (c-intersect-lists '(defun-close class-close 
inline-close)
                                              syntax)
                           (progn
@@ -753,14 +753,14 @@
              ;; `}': compact to a one-liner defun?
              (save-match-data
                (when
-                   (and (eq last-command-event ?\})
+                   (and (eq (c-last-command-char) ?\})
                         (memq 'one-liner-defun c-cleanup-list)
                         (c-intersect-lists '(defun-close) syntax)
                         (c-try-one-liner))
                  (setq here (- (point-max) pos))))
 
              ;; `{': clean up brace-else-brace and brace-elseif-brace
-             (when (eq last-command-event ?\{)
+             (when (eq (c-last-command-char) ?\{)
                (cond
                 ((and (memq 'brace-else-brace c-cleanup-list)
                       (re-search-backward
@@ -814,7 +814,7 @@
            ))))
 
     ;; blink the paren
-    (and (eq last-command-event ?\})
+    (and (eq (c-last-command-char) ?\})
         (not executing-kbd-macro)
         old-blink-paren
         (save-excursion
@@ -851,7 +851,7 @@
     (when (and (not arg)
               (eq literal 'c)
               (memq 'comment-close-slash c-cleanup-list)
-              (eq last-command-event ?/)
+              (eq (c-last-command-char) ?/)
               (looking-at (concat "[ \t]*\\("
                                   (regexp-quote comment-end) "\\)?$"))
        ; (eq c-block-comment-ender "*/") ; C-style comments ALWAYS end in */
@@ -867,7 +867,7 @@
     (setq indentp (and (not arg)
                       c-syntactic-indentation
                       c-electric-flag
-                      (eq last-command-event ?/)
+                      (eq (c-last-command-char) ?/)
                       (eq (char-before) (if literal ?* ?/))))
     (self-insert-command (prefix-numeric-value arg))
     (if indentp
@@ -941,10 +941,10 @@
          (let ((pos (- (point-max) (point))))
            (if (c-save-buffer-state ()
                  (and (or (and
-                           (eq last-command-event ?,)
+                           (eq (c-last-command-char) ?,)
                            (memq 'list-close-comma c-cleanup-list))
                           (and
-                           (eq last-command-event ?\;)
+                           (eq (c-last-command-char) ?\;)
                            (memq 'defun-close-semi c-cleanup-list)))
                       (progn
                         (forward-char -1)
@@ -1101,7 +1101,7 @@
     ;; Indent the line if appropriate.
     (when (and c-electric-flag c-syntactic-indentation c-recognize-<>-arglists)
       (setq found-delim
-           (if (eq last-command-event ?<)
+           (if (eq (c-last-command-char) ?<)
                ;; If a <, basically see if it's got "template" before it .....
                (or (and (progn
                           (backward-char)
@@ -1195,7 +1195,7 @@
            ;; clean up brace-elseif-brace
            (when
                (and (memq 'brace-elseif-brace c-cleanup-list)
-                    (eq last-command-event ?\()
+                    (eq (c-last-command-char) ?\()
                     (re-search-backward
                      (concat "}"
                              "\\([ \t\n]\\|\\\\\n\\)*"
@@ -1213,7 +1213,7 @@
            ;; clean up brace-catch-brace
            (when
                (and (memq 'brace-catch-brace c-cleanup-list)
-                    (eq last-command-event ?\()
+                    (eq (c-last-command-char) ?\()
                     (re-search-backward
                      (concat "}"
                              "\\([ \t\n]\\|\\\\\n\\)*"
@@ -1234,7 +1234,7 @@
 
             ;; space-before-funcall clean-up?
             ((and (memq 'space-before-funcall c-cleanup-list)
-                  (eq last-command-event ?\()
+                  (eq (c-last-command-char) ?\()
                   (save-excursion
                     (backward-char)
                     (skip-chars-backward " \t")
@@ -1252,7 +1252,7 @@
             ;; compact-empty-funcall clean-up?
                  ((c-save-buffer-state ()
                     (and (memq 'compact-empty-funcall c-cleanup-list)
-                         (eq last-command-event ?\))
+                         (eq (c-last-command-char) ?\))
                          (save-excursion
                            (c-safe (backward-char 2))
                            (when (looking-at "()")
@@ -1281,7 +1281,7 @@
     (when (c-save-buffer-state ()
            (and c-electric-flag
                 c-syntactic-indentation
-                (not (eq last-command-event ?_))
+                (not (eq (c-last-command-char) ?_))
                 (= (save-excursion
                      (skip-syntax-backward "w")
                      (point))

=== modified file 'lisp/progmodes/cc-defs.el'
--- a/lisp/progmodes/cc-defs.el 2013-01-01 09:11:05 +0000
+++ b/lisp/progmodes/cc-defs.el 2013-03-04 19:33:23 +0000
@@ -376,6 +376,13 @@
       `(int-to-char ,integer)
     integer))
 
+(defmacro c-last-command-char ()
+  ;; The last character just typed.  Note that `last-command-event' exists in
+  ;; both Emacs and XEmacs, but with confusingly different meanings.
+  (if (featurep 'xemacs)
+      'last-command-char
+    'last-command-event))
+
 (defmacro c-sentence-end ()
   ;; Get the regular expression `sentence-end'.
   (if (cc-bytecomp-fboundp 'sentence-end)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]