emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/emulation/viper-cmd.el


From: Michael Kifer
Subject: [Emacs-diffs] Changes to emacs/lisp/emulation/viper-cmd.el
Date: Mon, 07 Jan 2002 23:36:03 -0500

Index: emacs/lisp/emulation/viper-cmd.el
diff -c emacs/lisp/emulation/viper-cmd.el:1.34 
emacs/lisp/emulation/viper-cmd.el:1.35
*** emacs/lisp/emulation/viper-cmd.el:1.34      Mon Dec 24 00:50:31 2001
--- emacs/lisp/emulation/viper-cmd.el   Mon Jan  7 23:36:00 2002
***************
*** 1,8 ****
  ;;; viper-cmd.el --- Vi command support for Viper
  
! ;; Copyright (C) 1997 Free Software Foundation, Inc.
  
! ;; Author: Michael Kifer <address@hidden>
  
  ;; This file is part of GNU Emacs.
  
--- 1,8 ----
  ;;; viper-cmd.el --- Vi command support for Viper
  
! ;; Copyright (C) 1997, 98, 99, 2000, 01, 02 Free Software Foundation, Inc.
  
! ;; Author: Michael Kifer <address@hidden>
  
  ;; This file is part of GNU Emacs.
  
***************
*** 41,46 ****
--- 41,48 ----
  (defvar quail-current-str)
  (defvar zmacs-region-stays)
  (defvar mark-even-if-inactive)
+ (defvar init-message)
+ (defvar initial)
  
  ;; loading happens only in non-interactive compilation
  ;; in order to spare non-viperized emacs from being viperized
***************
*** 145,150 ****
--- 147,156 ----
  ;; Where viper saves mark. This mark is resurrected by m^
  (defvar viper-saved-mark nil)
  
+ ;; Contains user settings for vars affected by viper-set-expert-level 
function.
+ ;; Not a user option.
+ (defvar viper-saved-user-settings nil)
+ 
  
  
  ;;; CODE
***************
*** 298,309 ****
    ;; desirable that viper-pre-command-sentinel is the last hook and
    ;; viper-post-command-sentinel is the first hook.
  
!   (if viper-xemacs-p
!       (progn
!       (make-local-hook 'viper-after-change-functions)
!       (make-local-hook 'viper-before-change-functions)
!       (make-local-hook 'viper-post-command-hooks)
!       (make-local-hook 'viper-pre-command-hooks)))
  
    (remove-hook 'post-command-hook 'viper-post-command-sentinel)
    (add-hook 'post-command-hook 'viper-post-command-sentinel)
--- 304,318 ----
    ;; desirable that viper-pre-command-sentinel is the last hook and
    ;; viper-post-command-sentinel is the first hook.
  
!   (viper-cond-compile-for-xemacs-or-emacs
!    ;; xemacs
!    (progn
!      (make-local-hook 'viper-after-change-functions)
!      (make-local-hook 'viper-before-change-functions)
!      (make-local-hook 'viper-post-command-hooks)
!      (make-local-hook 'viper-pre-command-hooks))
!    nil ; emacs
!    )
  
    (remove-hook 'post-command-hook 'viper-post-command-sentinel)
    (add-hook 'post-command-hook 'viper-post-command-sentinel)
***************
*** 744,757 ****
  
          ;; this-command, last-command-char, last-command-event
          (setq this-command com)
!         (if viper-xemacs-p ; XEmacs represents key sequences as vectors
!             (setq last-command-event
!                   (viper-copy-event (viper-seq-last-elt key))
!                   last-command-char (event-to-character last-command-event))
!           ;; Emacs represents them as sequences (str or vec)
!           (setq last-command-event
!                 (viper-copy-event (viper-seq-last-elt key))
!                 last-command-char last-command-event))
  
          (if (commandp com)
              (progn
--- 753,768 ----
  
          ;; this-command, last-command-char, last-command-event
          (setq this-command com)
!         (viper-cond-compile-for-xemacs-or-emacs
!          ;; XEmacs represents key sequences as vectors
!          (setq last-command-event
!                (viper-copy-event (viper-seq-last-elt key))
!                last-command-char (event-to-character last-command-event))
!          ;; Emacs represents them as sequences (str or vec)
!          (setq last-command-event
!                (viper-copy-event (viper-seq-last-elt key))
!                last-command-char last-command-event)
!          )
  
          (if (commandp com)
              (progn
***************
*** 850,856 ****
              (viper-copy-event (if viper-xemacs-p
                                    (character-to-event ch) ch)))
        ) ; let
!     (error)
      ) ; condition-case
        
    (viper-set-input-method nil)
--- 861,867 ----
              (viper-copy-event (if viper-xemacs-p
                                    (character-to-event ch) ch)))
        ) ; let
!     (error nil)
      ) ; condition-case
        
    (viper-set-input-method nil)
***************
*** 1766,1778 ****
      (message " `.' runs  %s%s"
             (concat "`" (viper-array-to-string keys) "'")
             (viper-abbreviate-string
!             (if viper-xemacs-p
!                 (replace-in-string
!                  (cond ((characterp text) (char-to-string text))
!                        ((stringp text) text)
!                        (t ""))
!                  "\n" "^J")
!               text)
              max-text-len
              "  inserting  `" "'" "    ......."))
      ))
--- 1777,1790 ----
      (message " `.' runs  %s%s"
             (concat "`" (viper-array-to-string keys) "'")
             (viper-abbreviate-string
!             (viper-cond-compile-for-xemacs-or-emacs
!              (replace-in-string ; xemacs
!               (cond ((characterp text) (char-to-string text))
!                     ((stringp text) text)
!                     (t ""))
!               "\n" "^J")
!              text ; emacs
!              )
              max-text-len
              "  inserting  `" "'" "    ......."))
      ))
***************
*** 2059,2067 ****
                  (setq cmd
                        (key-binding (setq key (read-key-sequence nil))))
                  (cond ((eq cmd 'self-insert-command)
!                        (if viper-xemacs-p
!                            (insert (events-to-keys key))
!                          (insert key)))
                        ((memq cmd '(exit-minibuffer viper-exit-minibuffer))
                         nil)
                        (t (command-execute cmd)))
--- 2071,2080 ----
                  (setq cmd
                        (key-binding (setq key (read-key-sequence nil))))
                  (cond ((eq cmd 'self-insert-command)
!                        (viper-cond-compile-for-xemacs-or-emacs
!                         (insert (events-to-keys key)) ; xemacs
!                         (insert key) ; emacs
!                         ))
                        ((memq cmd '(exit-minibuffer viper-exit-minibuffer))
                         nil)
                        (t (command-execute cmd)))
***************
*** 2642,2648 ****
    (let ((pt (point)))
      (condition-case nil
        (forward-char arg)
!       (error))
      (if (< (point) pt) ; arg was negative
        (- (viper-chars-in-region pt (point)))
        (viper-chars-in-region pt (point)))))
--- 2655,2661 ----
    (let ((pt (point)))
      (condition-case nil
        (forward-char arg)
!       (error nil))
      (if (< (point) pt) ; arg was negative
        (- (viper-chars-in-region pt (point)))
        (viper-chars-in-region pt (point)))))
***************
*** 2656,2662 ****
    (let ((pt (point)))
      (condition-case nil
        (backward-char arg)
!       (error))
      (if (> (point) pt) ; arg was negative
        (viper-chars-in-region pt (point))
        (- (viper-chars-in-region pt (point))))))
--- 2669,2675 ----
    (let ((pt (point)))
      (condition-case nil
        (backward-char arg)
!       (error nil))
      (if (> (point) pt) ; arg was negative
        (viper-chars-in-region pt (point))
        (- (viper-chars-in-region pt (point))))))
***************
*** 3323,3331 ****
  ;; (which is called from viper-search-forward/backward/next).  If the value of
  ;; viper-search-scroll-threshold is negative - don't scroll.
  (defun viper-adjust-window ()
!   (let ((win-height (if viper-emacs-p
!                       (1- (window-height)) ; adjust for modeline
!                     (window-displayed-height)))
        (pt (point))
        at-top-p at-bottom-p
        min-scroll direction)
--- 3336,3346 ----
  ;; (which is called from viper-search-forward/backward/next).  If the value of
  ;; viper-search-scroll-threshold is negative - don't scroll.
  (defun viper-adjust-window ()
!   (let ((win-height (viper-cond-compile-for-xemacs-or-emacs
!                    (window-displayed-height) ; xemacs
!                    ;; emacs
!                    (1- (window-height)) ; adjust for modeline
!                    ))
        (pt (point))
        at-top-p at-bottom-p
        min-scroll direction)
***************
*** 4575,4582 ****
          (t (error viper-InvalidTextmarker reg)))))
  
  
- 
- ;; commands in insertion mode
  
  (defun viper-delete-backward-word (arg)
    "Delete previous word."
--- 4590,4595 ----
***************
*** 4587,4592 ****
--- 4600,4616 ----
      (delete-region (point) (mark t))
      (pop-mark)))
  
+ 
+ 
+ ;; Get viper standard value of SYMBOL.  If symbol is customized, get its
+ ;; standard value.  Otherwise, get the value saved in the alist STORAGE.  If
+ ;; STORAGE is nil, use viper-saved-user-settings. 
+ (defun viper-standard-value (symbol &optional storage)
+   (or (eval (car (get symbol 'customized-value)))
+       (eval (car (get symbol 'saved-value)))
+       (nth 1 (assoc symbol (or storage viper-saved-user-settings)))))
+ 
+ 
  
  (defun viper-set-expert-level (&optional dont-change-unless)
    "Sets the expert level for a Viper user.
***************
*** 4913,4919 ****
          (require 'reporter)
          (set-window-configuration window-config)
  
!         (reporter-submit-bug-report "address@hidden"
                                      (viper-version)
                                      varlist
                                      nil 'delete-other-windows
--- 4937,4943 ----
          (require 'reporter)
          (set-window-configuration window-config)
  
!         (reporter-submit-bug-report "address@hidden"
                                      (viper-version)
                                      varlist
                                      nil 'delete-other-windows
***************
*** 4921,4974 ****
          ))
  
  
- 
- ;; Smoothes out the difference between Emacs' unread-command-events
- ;; and XEmacs unread-command-event.  Arg is a character, an event, a list of
- ;; events or a sequence of keys.
- ;;
- ;; Due to the way unread-command-events in Emacs (not XEmacs), a non-event
- ;; symbol in unread-command-events list may cause Emacs to turn this symbol
- ;; into an event.  Below, we delete nil from event lists, since nil is the 
most
- ;; common symbol that might appear in this wrong context.
- (defun viper-set-unread-command-events (arg)
-   (if viper-emacs-p
-       (setq
-        unread-command-events
-        (let ((new-events
-             (cond ((eventp arg) (list arg))
-                   ((listp arg) arg)
-                   ((sequencep arg)
-                    (listify-key-sequence arg))
-                   (t (error
-                       "viper-set-unread-command-events: Invalid argument, %S"
-                       arg)))))
-        (if (not (eventp nil))
-            (setq new-events (delq nil new-events)))
-        (append new-events unread-command-events)))
-     ;; XEmacs
-     (setq
-      unread-command-events
-      (append
-       (cond ((viper-characterp arg) (list (character-to-event arg)))
-           ((eventp arg)  (list arg))
-           ((stringp arg) (mapcar 'character-to-event arg))
-           ((vectorp arg) (append arg nil)) ; turn into list
-           ((listp arg) (viper-eventify-list-xemacs arg))
-           (t (error
-               "viper-set-unread-command-events: Invalid argument, %S" arg)))
-       unread-command-events))))
- 
- ;; list is assumed to be a list of events of characters
- (defun viper-eventify-list-xemacs (lis)
-   (mapcar
-    (lambda (elt)
-      (cond ((viper-characterp elt) (character-to-event elt))
-          ((eventp elt)  elt)
-          (t (error
-              "viper-eventify-list-xemacs: can't convert to event, %S"
-              elt))))
-    lis))
-   
    
  
  ;;; viper-cmd.el ends here
--- 4945,4950 ----



reply via email to

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