Show
Ignore:
Timestamp:
09/09/06 16:30:10 (2 years ago)
Author:
miyoshi
Message:

Sync up with Emacs CVS HEAD.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lisp/emulation/viper-cmd.el

    r4098 r4161  
    4747(defvar init-message) 
    4848(defvar initial) 
     49(defvar undo-beg-posn) 
     50(defvar undo-end-posn) 
    4951 
    5052;; loading happens only in non-interactive compilation 
     
    197199        ;; set insert mode cursor color 
    198200        (viper-change-cursor-color viper-insert-state-cursor-color))) 
    199   (if (eq viper-current-state 'emacs-state
     201  (if (and viper-emacs-state-cursor-color (eq viper-current-state 'emacs-state)
    200202      (let ((has-saved-cursor-color-in-emacs-mode 
    201203             (stringp (viper-get-saved-cursor-color-in-emacs-mode)))) 
     
    723725  (viper-hide-replace-overlay) 
    724726 
    725   (let ((has-saved-cursor-color-in-emacs-mode 
    726          (stringp (viper-get-saved-cursor-color-in-emacs-mode)))) 
    727     (or has-saved-cursor-color-in-emacs-mode 
    728         (string= (viper-get-cursor-color) viper-emacs-state-cursor-color) 
    729         (viper-save-cursor-color 'before-emacs-mode)) 
    730     (viper-change-cursor-color viper-emacs-state-cursor-color)) 
     727  (if viper-emacs-state-cursor-color 
     728      (let ((has-saved-cursor-color-in-emacs-mode 
     729             (stringp (viper-get-saved-cursor-color-in-emacs-mode)))) 
     730        (or has-saved-cursor-color-in-emacs-mode 
     731            (string= (viper-get-cursor-color) viper-emacs-state-cursor-color) 
     732            (viper-save-cursor-color 'before-emacs-mode)) 
     733        (viper-change-cursor-color viper-emacs-state-cursor-color))) 
    731734 
    732735  (viper-change-state 'emacs-state) 
     
    890893               ;;(setq ch (read-char-exclusive)) 
    891894               (setq ch (aref (read-key-sequence nil) 0)) 
     895               (if viper-xemacs-p 
     896                   (setq ch (event-to-character ch))) 
    892897               ;; replace ^M with the newline 
    893898               (if (eq ch ?\C-m) (setq ch ?\n)) 
    894899               ;; Make sure ^V and ^Q work as quotation chars 
    895900               (if (memq ch '(?\C-v ?\C-q)) 
    896                    ;;(setq ch (read-char-exclusive)) 
    897                    (setq ch (aref (read-key-sequence nil) 0)) 
     901                   (progn 
     902                     ;;(setq ch (read-char-exclusive)) 
     903                     (setq ch (aref (read-key-sequence nil) 0)) 
     904                     (if viper-xemacs-p 
     905                         (setq ch (event-to-character ch)))) 
    898906                 ) 
    899907               (insert ch)) 
     
    10311039    (if (viper-ESC-event-p event) 
    10321040        (progn 
    1033           ;; Emacs 22.50.8 introduced a bug, which makes even a single ESC into 
    1034           ;; a fast keyseq. To guard against this, we added a check if there 
    1035           ;; are other events as well 
    1036           (if (and (viper-fast-keysequence-p) unread-command-events) 
     1041          ;; Some versions of Emacs (eg., 22.50.8 have a bug, which makes even 
     1042          ;; a single ESC into ;; a fast keyseq. To guard against this, we 
     1043          ;; added a check if there are other events as well. Keep the next 
     1044          ;; line for the next time the bug reappears, so that will remember to 
     1045          ;; report it. 
     1046          ;;(if (and (viper-fast-keysequence-p) unread-command-events) 
     1047          (if (viper-fast-keysequence-p) ;; for Emacsen without the above bug 
    10371048              (progn 
    10381049                (let (minor-mode-map-alist emulation-mode-map-alists) 
     
    17451756;; Hook used in viper-undo 
    17461757(defun viper-after-change-undo-hook (beg end len) 
    1747   (setq undo-beg-posn beg 
    1748         undo-end-posn (or end beg)) 
    1749   ;; some other hooks may be changing various text properties in 
    1750   ;; the buffer in response to 'undo'; so remove this hook to avoid 
    1751   ;; its repeated invocation 
    1752   (remove-hook 'viper-undo-functions 'viper-after-change-undo-hook 'local)) 
     1758  (if (and (boundp 'undo-in-progress) undo-in-progress) 
     1759      (setq undo-beg-posn beg 
     1760            undo-end-posn (or end beg)) 
     1761    ;; some other hooks may be changing various text properties in 
     1762    ;; the buffer in response to 'undo'; so remove this hook to avoid 
     1763    ;; its repeated invocation 
     1764    (remove-hook 'viper-undo-functions 'viper-after-change-undo-hook 'local) 
     1765  )) 
    17531766 
    17541767(defun viper-undo () 
     
    17651778    (undo-start) 
    17661779    (undo-more 2) 
    1767     (setq undo-beg-posn (or undo-beg-posn before-undo-pt) 
    1768           undo-end-posn (or undo-end-posn undo-beg-posn)) 
    1769  
    1770     (goto-char undo-beg-posn) 
    1771     (sit-for 0) 
    1772     (if (and viper-keep-point-on-undo 
    1773              (pos-visible-in-window-p before-undo-pt)) 
     1780    ;;(setq undo-beg-posn (or undo-beg-posn (point)) 
     1781    ;;    undo-end-posn (or undo-end-posn (point))) 
     1782    ;;(setq undo-beg-posn (or undo-beg-posn before-undo-pt) 
     1783    ;;      undo-end-posn (or undo-end-posn undo-beg-posn)) 
     1784 
     1785    (if (and undo-beg-posn undo-end-posn) 
    17741786        (progn 
    1775           (push-mark (point-marker) t) 
    1776           (viper-sit-for-short 300) 
    1777           (goto-char undo-end-posn) 
    1778           (viper-sit-for-short 300) 
    1779           (if (and (> (viper-chars-in-region undo-beg-posn before-undo-pt) 1) 
    1780                    (> (viper-chars-in-region undo-end-posn before-undo-pt) 1)) 
    1781               (goto-char before-undo-pt) 
    1782             (goto-char undo-beg-posn))) 
    1783       (push-mark before-undo-pt t)) 
     1787          (goto-char undo-beg-posn) 
     1788          (sit-for 0) 
     1789          (if (and viper-keep-point-on-undo 
     1790                   (pos-visible-in-window-p before-undo-pt)) 
     1791              (progn 
     1792                (push-mark (point-marker) t) 
     1793                (viper-sit-for-short 300) 
     1794                (goto-char undo-end-posn) 
     1795                (viper-sit-for-short 300) 
     1796                (if (pos-visible-in-window-p undo-beg-posn) 
     1797                    (goto-char before-undo-pt) 
     1798                  (goto-char undo-beg-posn))) 
     1799            (push-mark before-undo-pt t)) 
     1800          )) 
     1801 
    17841802    (if (and (eolp) (not (bolp))) (backward-char 1)) 
    1785     ;;(if (not modified) (set-buffer-modified-p t)) 
    17861803    ) 
    17871804  (setq this-command 'viper-undo)) 
     
    39533970        (com (viper-getcom arg)) 
    39543971        debug-on-error) 
    3955     (if (null viper-s-string) (error viper-NoPrevSearch)) 
     3972    (if (or (null viper-s-string) (string= viper-s-string "")) 
     3973        (error viper-NoPrevSearch)) 
    39563974    (viper-search viper-s-string viper-s-forward arg) 
    39573975    (if com