Show
Ignore:
Timestamp:
07/01/06 08:27:06 (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

    r4058 r4098  
    888888               (insert ch)) 
    889889              (t 
    890                (setq ch (read-char-exclusive)) 
     890               ;;(setq ch (read-char-exclusive)) 
     891               (setq ch (aref (read-key-sequence nil) 0)) 
    891892               ;; replace ^M with the newline 
    892893               (if (eq ch ?\C-m) (setq ch ?\n)) 
    893894               ;; Make sure ^V and ^Q work as quotation chars 
    894895               (if (memq ch '(?\C-v ?\C-q)) 
    895                    (setq ch (read-char-exclusive))) 
     896                   ;;(setq ch (read-char-exclusive)) 
     897                   (setq ch (aref (read-key-sequence nil) 0)) 
     898                 ) 
    896899               (insert ch)) 
    897900              ) 
     
    17311734;; undoing 
    17321735 
     1736;; hook used inside undo 
     1737(defvar viper-undo-functions nil) 
     1738 
     1739;; Runs viper-before-change-functions inside before-change-functions 
     1740(defun viper-undo-sentinel (beg end length) 
     1741  (run-hook-with-args 'viper-undo-functions beg end length)) 
     1742 
     1743(add-hook 'after-change-functions 'viper-undo-sentinel) 
     1744 
     1745;; Hook used in viper-undo 
     1746(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)) 
     1753 
    17331754(defun viper-undo () 
    17341755  "Undo previous change." 
     
    17371758  (let ((modified (buffer-modified-p)) 
    17381759        (before-undo-pt (point-marker)) 
    1739         (after-change-functions after-change-functions) 
    17401760        undo-beg-posn undo-end-posn) 
    17411761 
    1742     ;; no need to remove this hook, since this var has scope inside a let. 
    1743     (add-hook 'after-change-functions 
    1744               '(lambda (beg end len) 
    1745                  (setq undo-beg-posn beg 
    1746                        undo-end-posn (or end beg)))) 
     1762    ;; the viper-after-change-undo-hook removes itself after the 1st invocation 
     1763    (add-hook 'viper-undo-functions 'viper-after-change-undo-hook nil 'local) 
    17471764 
    17481765    (undo-start) 
     
    17661783      (push-mark before-undo-pt t)) 
    17671784    (if (and (eolp) (not (bolp))) (backward-char 1)) 
    1768     (if (not modified) (set-buffer-modified-p t))) 
     1785    ;;(if (not modified) (set-buffer-modified-p t)) 
     1786    ) 
    17691787  (setq this-command 'viper-undo)) 
    17701788 
     
    18141832 
    18151833 
    1816  
     1834;;; Viper's destructive Command ring utilities 
    18171835 
    18181836(defun viper-display-current-destructive-command () 
     
    19281946      ;; make sure all lines end with newline, unless in the minibuffer or 
    19291947      ;; when requested otherwise (require-final-newline is nil) 
    1930       (if (and (eobp) 
    1931                (not (bolp)) 
    1932                require-final-newline 
    1933                (not (viper-is-in-minibuffer)) 
    1934                (not buffer-read-only)) 
    1935           (insert "\n")))) 
     1948      (save-restriction 
     1949        (widen) 
     1950        (if (and (eobp) 
     1951                 (not (bolp)) 
     1952                 require-final-newline 
     1953                 (not (viper-is-in-minibuffer)) 
     1954                 (not buffer-read-only)) 
     1955            (insert "\n"))) 
     1956      )) 
    19361957 
    19371958(defun viper-yank-defun () 
     
    30463067    (if com (viper-execute-com 'viper-next-line val com)))) 
    30473068 
     3069 
    30483070(defun viper-next-line-at-bol (arg) 
    3049   "Next line at beginning of line." 
    3050   (interactive "P") 
    3051   (viper-leave-region-active) 
    3052   (save-excursion 
    3053     (end-of-line) 
    3054     (if (eobp) (error "Last line in buffer"))) 
    3055   (let ((val (viper-p-val arg)) 
    3056         (com (viper-getCom arg))) 
    3057     (if com (viper-move-marker-locally 'viper-com-point (point))) 
    3058     (forward-line val) 
    3059     (back-to-indentation) 
    3060     (if com (viper-execute-com 'viper-next-line-at-bol val com)))) 
     3071  "Next line at beginning of line. 
     3072If point is on a widget or a button, simulate clicking on that widget/button." 
     3073  (interactive "P") 
     3074  (let* ((field (get-char-property (point) 'field)) 
     3075         (button (get-char-property (point) 'button)) 
     3076         (doc (get-char-property (point) 'widget-doc)) 
     3077         (widget (or field button doc))) 
     3078    (if (and widget 
     3079             (if (symbolp widget) 
     3080                 (get widget 'widget-type) 
     3081               (and (consp widget) 
     3082                    (get (widget-type widget) 'widget-type)))) 
     3083        (widget-button-press (point)) 
     3084      (if (button-at (point)) 
     3085          (push-button) 
     3086        ;; not a widget or a button 
     3087        (viper-leave-region-active) 
     3088        (save-excursion 
     3089          (end-of-line) 
     3090          (if (eobp) (error "Last line in buffer"))) 
     3091        (let ((val (viper-p-val arg)) 
     3092              (com (viper-getCom arg))) 
     3093          (if com (viper-move-marker-locally 'viper-com-point (point))) 
     3094          (forward-line val) 
     3095          (back-to-indentation) 
     3096          (if com (viper-execute-com 'viper-next-line-at-bol val com))))))) 
    30613097 
    30623098