Changeset 4098 for trunk/lisp/emulation/viper-cmd.el
- Timestamp:
- 07/01/06 08:27:06 (2 years ago)
- Files:
-
- trunk/lisp/emulation/viper-cmd.el (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lisp/emulation/viper-cmd.el
r4058 r4098 888 888 (insert ch)) 889 889 (t 890 (setq ch (read-char-exclusive)) 890 ;;(setq ch (read-char-exclusive)) 891 (setq ch (aref (read-key-sequence nil) 0)) 891 892 ;; replace ^M with the newline 892 893 (if (eq ch ?\C-m) (setq ch ?\n)) 893 894 ;; Make sure ^V and ^Q work as quotation chars 894 895 (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 ) 896 899 (insert ch)) 897 900 ) … … 1731 1734 ;; undoing 1732 1735 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 1733 1754 (defun viper-undo () 1734 1755 "Undo previous change." … … 1737 1758 (let ((modified (buffer-modified-p)) 1738 1759 (before-undo-pt (point-marker)) 1739 (after-change-functions after-change-functions)1740 1760 undo-beg-posn undo-end-posn) 1741 1761 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) 1747 1764 1748 1765 (undo-start) … … 1766 1783 (push-mark before-undo-pt t)) 1767 1784 (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 ) 1769 1787 (setq this-command 'viper-undo)) 1770 1788 … … 1814 1832 1815 1833 1816 1834 ;;; Viper's destructive Command ring utilities 1817 1835 1818 1836 (defun viper-display-current-destructive-command () … … 1928 1946 ;; make sure all lines end with newline, unless in the minibuffer or 1929 1947 ;; 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 )) 1936 1957 1937 1958 (defun viper-yank-defun () … … 3046 3067 (if com (viper-execute-com 'viper-next-line val com)))) 3047 3068 3069 3048 3070 (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. 3072 If 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))))))) 3061 3097 3062 3098
