]> code.delx.au - gnu-emacs/blobdiff - lisp/emulation/viper-macs.el
Merge from trunk.
[gnu-emacs] / lisp / emulation / viper-macs.el
index a9e24f28e7b08cfe259f04a02d15520b652cc21b..0b96793deb794ee3f5aaf6b19b8e07f6341e6c3c 100644 (file)
@@ -1,16 +1,16 @@
 ;;; viper-macs.el --- functions implementing keyboard macros for Viper
 
-;; Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1997, 2000-2012 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
+;; Package: viper
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -18,9 +18,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
 ;; in order to spare non-viperized emacs from being viperized
 (if noninteractive
     (eval-when-compile
-      (let ((load-path (cons (expand-file-name ".") load-path)))
-       (or (featurep 'viper-cmd)
-           (load "viper-cmd.el" nil t 'nosuffix))
-       )))
+      (require 'viper-cmd)
+      ))
 ;; end pacifier
 
 (require 'viper-util)
@@ -323,7 +319,7 @@ a key is a symbol, e.g., `a', `\\1', `f2', etc., or a list, e.g.,
 
 ;; Accepts as macro names: strings and vectors.
 ;; strings must be strings of characters; vectors must be vectors of keys
-;; in canonic form.  The canonic form is essentially the form used in XEmacs
+;; in canonical form, which is essentially the form used in XEmacs.
 ;; More general definitions are inherited by more specific scopes:
 ;; global->major mode->buffer. More specific definitions override more general
 (defun viper-record-kbd-macro (macro-name state macro-body &optional scope)
@@ -873,9 +869,13 @@ name from there."
   (let ((lis (vector event))
        next-event)
     (while (and (viper-fast-keysequence-p)
-               (viper-keyseq-is-a-possible-macro lis macro-alist))
-      (setq next-event (viper-read-key))
-      ;;(setq next-event (viper-read-event))
+           (viper-keyseq-is-a-possible-macro lis macro-alist))
+      ;; Seems that viper-read-event is more robust here. We need to be able to
+      ;; place these events on unread-command-events list. If we use
+      ;; viper-read-key then events will be converted to keys, and sometimes
+      ;; (e.g., (control \[)) those keys differ from the corresponding events.
+      ;; So, do not use (setq next-event (viper-read-key))
+      (setq next-event (viper-read-event))
       (or (viper-mouse-event-p next-event)
          (setq lis (vconcat lis (vector next-event)))))
     lis))
@@ -921,7 +921,7 @@ name from there."
 
 
 (defun viper-global-execute ()
-  "Call last keyboad macro for each line in the region."
+  "Call last keyboard macro for each line in the region."
   (if (> (point) (mark t)) (exchange-point-and-mark))
   (beginning-of-line)
   (call-last-kbd-macro)
@@ -931,5 +931,4 @@ name from there."
     (call-last-kbd-macro)))
 
 
-;;; arch-tag: ecd3cc5c-8cd0-4bbe-b2ec-7e75a4b7d0aa
 ;;; viper-macs.el ends here