diff options
| author | Michael Kifer | 2006-06-18 17:08:24 +0000 |
|---|---|---|
| committer | Michael Kifer | 2006-06-18 17:08:24 +0000 |
| commit | ec6aebe8337fdd6dc218609a3ff86ccc0232fb4a (patch) | |
| tree | cbcaecf8692fb0ba1bcb4dbeeac96d471b1ba2be /lisp/emulation | |
| parent | 9e363b8991ea4c52e18b59d0679689cd6a1c0d1b (diff) | |
| download | emacs-ec6aebe8337fdd6dc218609a3ff86ccc0232fb4a.tar.gz emacs-ec6aebe8337fdd6dc218609a3ff86ccc0232fb4a.zip | |
2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-special-read-and-insert-char): use
read-key-sequence.
(viper-after-change-undo-hook): enhancements.
(viper-after-change-undo-hook): new hook.
(viper-undo): use viper-after-change-undo-hook.
(viper-add-newline-at-eob-if-necessary): widen before making changes.
(viper-next-line-at-bol): If point is on a widget or a button, simulate
clicking on that widget/button.
* viper.el (viper-mode): allow for a separate cursor color in Emacs
state.
* ediff-diff (ediff-test-patch-utility): catch errors.
(ediff-actual-diff-options, ediff-actual-diff3-options): new variables.
(ediff-set-actual-diff-options): new function.
(ediff-reset-diff-options, ediff-toggle-ignore-case):
use ediff-set-actual-diff-options.
(ediff-extract-diffs): catch errors.
(ediff-whitespace): add nonbreakable space.
(ediff-same-file-contents): catch errors.
* ediff-mult.el (ediff-collect-custom-diffs): save
coding-system-for-read.
* ediff-vers.el (ediff-keep-tmp-versions): new var.
(ediff-vc-internal, ediff-vc-merge-internal): use
ediff-delete-version-file.
(ediff-delete-version-file): new function.
* ediff-wind.el (ediff-control-frame-parameters): set frame fringes.
* ediff.el (ediff-directories, ediff-directory-revisions,
ediff-merge-directories, ediff-merge-directories-with-ancestor,
ediff-directories-internal, ediff-merge-directory-revisions,
ediff-merge-directory-revisions-with-ancestor,
ediff-directories3): use read-directory-name.
Diffstat (limited to 'lisp/emulation')
| -rw-r--r-- | lisp/emulation/viper-cmd.el | 90 | ||||
| -rw-r--r-- | lisp/emulation/viper-util.el | 4 | ||||
| -rw-r--r-- | lisp/emulation/viper.el | 6 |
3 files changed, 69 insertions, 31 deletions
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index 645f4f26eaf..0dce3b94ff0 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el | |||
| @@ -887,12 +887,15 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to | |||
| 887 | (setq ch (aref (read-key-sequence nil) 0))) | 887 | (setq ch (aref (read-key-sequence nil) 0))) |
| 888 | (insert ch)) | 888 | (insert ch)) |
| 889 | (t | 889 | (t |
| 890 | (setq ch (read-char-exclusive)) | 890 | ;;(setq ch (read-char-exclusive)) |
| 891 | (setq ch (aref (read-key-sequence nil) 0)) | ||
| 891 | ;; replace ^M with the newline | 892 | ;; replace ^M with the newline |
| 892 | (if (eq ch ?\C-m) (setq ch ?\n)) | 893 | (if (eq ch ?\C-m) (setq ch ?\n)) |
| 893 | ;; Make sure ^V and ^Q work as quotation chars | 894 | ;; Make sure ^V and ^Q work as quotation chars |
| 894 | (if (memq ch '(?\C-v ?\C-q)) | 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 | (insert ch)) | 899 | (insert ch)) |
| 897 | ) | 900 | ) |
| 898 | (setq last-command-event | 901 | (setq last-command-event |
| @@ -1730,20 +1733,34 @@ invokes the command before that, etc." | |||
| 1730 | 1733 | ||
| 1731 | ;; undoing | 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 | (defun viper-undo () | 1754 | (defun viper-undo () |
| 1734 | "Undo previous change." | 1755 | "Undo previous change." |
| 1735 | (interactive) | 1756 | (interactive) |
| 1736 | (message "undo!") | 1757 | (message "undo!") |
| 1737 | (let ((modified (buffer-modified-p)) | 1758 | (let ((modified (buffer-modified-p)) |
| 1738 | (before-undo-pt (point-marker)) | 1759 | (before-undo-pt (point-marker)) |
| 1739 | (after-change-functions after-change-functions) | ||
| 1740 | undo-beg-posn undo-end-posn) | 1760 | undo-beg-posn undo-end-posn) |
| 1741 | 1761 | ||
| 1742 | ;; no need to remove this hook, since this var has scope inside a let. | 1762 | ;; the viper-after-change-undo-hook removes itself after the 1st invocation |
| 1743 | (add-hook 'after-change-functions | 1763 | (add-hook 'viper-undo-functions 'viper-after-change-undo-hook nil 'local) |
| 1744 | '(lambda (beg end len) | ||
| 1745 | (setq undo-beg-posn beg | ||
| 1746 | undo-end-posn (or end beg)))) | ||
| 1747 | 1764 | ||
| 1748 | (undo-start) | 1765 | (undo-start) |
| 1749 | (undo-more 2) | 1766 | (undo-more 2) |
| @@ -1765,7 +1782,8 @@ invokes the command before that, etc." | |||
| 1765 | (goto-char undo-beg-posn))) | 1782 | (goto-char undo-beg-posn))) |
| 1766 | (push-mark before-undo-pt t)) | 1783 | (push-mark before-undo-pt t)) |
| 1767 | (if (and (eolp) (not (bolp))) (backward-char 1)) | 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 | (setq this-command 'viper-undo)) | 1787 | (setq this-command 'viper-undo)) |
| 1770 | 1788 | ||
| 1771 | ;; Continue undoing previous changes. | 1789 | ;; Continue undoing previous changes. |
| @@ -1813,7 +1831,7 @@ invokes the command before that, etc." | |||
| 1813 | (setq viper-undo-needs-adjustment t))))) | 1831 | (setq viper-undo-needs-adjustment t))))) |
| 1814 | 1832 | ||
| 1815 | 1833 | ||
| 1816 | 1834 | ;;; Viper's destructive Command ring utilities | |
| 1817 | 1835 | ||
| 1818 | (defun viper-display-current-destructive-command () | 1836 | (defun viper-display-current-destructive-command () |
| 1819 | (let ((text (nth 4 viper-d-com)) | 1837 | (let ((text (nth 4 viper-d-com)) |
| @@ -1927,12 +1945,15 @@ Undo previous insertion and inserts new." | |||
| 1927 | (end-of-line) | 1945 | (end-of-line) |
| 1928 | ;; make sure all lines end with newline, unless in the minibuffer or | 1946 | ;; make sure all lines end with newline, unless in the minibuffer or |
| 1929 | ;; when requested otherwise (require-final-newline is nil) | 1947 | ;; when requested otherwise (require-final-newline is nil) |
| 1930 | (if (and (eobp) | 1948 | (save-restriction |
| 1931 | (not (bolp)) | 1949 | (widen) |
| 1932 | require-final-newline | 1950 | (if (and (eobp) |
| 1933 | (not (viper-is-in-minibuffer)) | 1951 | (not (bolp)) |
| 1934 | (not buffer-read-only)) | 1952 | require-final-newline |
| 1935 | (insert "\n")))) | 1953 | (not (viper-is-in-minibuffer)) |
| 1954 | (not buffer-read-only)) | ||
| 1955 | (insert "\n"))) | ||
| 1956 | )) | ||
| 1936 | 1957 | ||
| 1937 | (defun viper-yank-defun () | 1958 | (defun viper-yank-defun () |
| 1938 | (mark-defun) | 1959 | (mark-defun) |
| @@ -3045,19 +3066,34 @@ On reaching beginning of line, stop and signal error." | |||
| 3045 | (setq this-command 'next-line) | 3066 | (setq this-command 'next-line) |
| 3046 | (if com (viper-execute-com 'viper-next-line val com)))) | 3067 | (if com (viper-execute-com 'viper-next-line val com)))) |
| 3047 | 3068 | ||
| 3069 | |||
| 3048 | (defun viper-next-line-at-bol (arg) | 3070 | (defun viper-next-line-at-bol (arg) |
| 3049 | "Next line at beginning of line." | 3071 | "Next line at beginning of line. |
| 3072 | If point is on a widget or a button, simulate clicking on that widget/button." | ||
| 3050 | (interactive "P") | 3073 | (interactive "P") |
| 3051 | (viper-leave-region-active) | 3074 | (let* ((field (get-char-property (point) 'field)) |
| 3052 | (save-excursion | 3075 | (button (get-char-property (point) 'button)) |
| 3053 | (end-of-line) | 3076 | (doc (get-char-property (point) 'widget-doc)) |
| 3054 | (if (eobp) (error "Last line in buffer"))) | 3077 | (widget (or field button doc))) |
| 3055 | (let ((val (viper-p-val arg)) | 3078 | (if (and widget |
| 3056 | (com (viper-getCom arg))) | 3079 | (if (symbolp widget) |
| 3057 | (if com (viper-move-marker-locally 'viper-com-point (point))) | 3080 | (get widget 'widget-type) |
| 3058 | (forward-line val) | 3081 | (and (consp widget) |
| 3059 | (back-to-indentation) | 3082 | (get (widget-type widget) 'widget-type)))) |
| 3060 | (if com (viper-execute-com 'viper-next-line-at-bol val com)))) | 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 | ||
| 3063 | (defun viper-previous-line (arg) | 3099 | (defun viper-previous-line (arg) |
diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el index c7fe792b5f2..252088a476d 100644 --- a/lisp/emulation/viper-util.el +++ b/lisp/emulation/viper-util.el | |||
| @@ -139,8 +139,8 @@ | |||
| 139 | 139 | ||
| 140 | (defsubst viper-get-cursor-color () | 140 | (defsubst viper-get-cursor-color () |
| 141 | (viper-cond-compile-for-xemacs-or-emacs | 141 | (viper-cond-compile-for-xemacs-or-emacs |
| 142 | ;; xemacs | 142 | (color-instance-name |
| 143 | (color-instance-name (frame-property (selected-frame) 'cursor-color)) | 143 | (frame-property (selected-frame) 'cursor-color)) ; xemacs |
| 144 | (cdr (assoc 'cursor-color (frame-parameters))) ; emacs | 144 | (cdr (assoc 'cursor-color (frame-parameters))) ; emacs |
| 145 | )) | 145 | )) |
| 146 | 146 | ||
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el index fc55d291550..8f858526da3 100644 --- a/lisp/emulation/viper.el +++ b/lisp/emulation/viper.el | |||
| @@ -534,6 +534,10 @@ If Viper is enabled, turn it off. Otherwise, turn it on." | |||
| 534 | (defun viper-mode () | 534 | (defun viper-mode () |
| 535 | "Turn on Viper emulation of Vi in Emacs. See Info node `(viper)Viper'." | 535 | "Turn on Viper emulation of Vi in Emacs. See Info node `(viper)Viper'." |
| 536 | (interactive) | 536 | (interactive) |
| 537 | (if (null viper-vi-state-cursor-color) | ||
| 538 | (modify-frame-parameters | ||
| 539 | (selected-frame) | ||
| 540 | (list (cons 'viper-vi-state-cursor-color (viper-get-cursor-color))))) | ||
| 537 | (if (not noninteractive) | 541 | (if (not noninteractive) |
| 538 | (progn | 542 | (progn |
| 539 | ;; if the user requested viper-mode explicitly | 543 | ;; if the user requested viper-mode explicitly |
| @@ -545,8 +549,6 @@ If Viper is enabled, turn it off. Otherwise, turn it on." | |||
| 545 | (if viper-first-time ; Important check. Prevents mix-up of startup | 549 | (if viper-first-time ; Important check. Prevents mix-up of startup |
| 546 | (progn ; and expert-level msgs when viper-mode recurses | 550 | (progn ; and expert-level msgs when viper-mode recurses |
| 547 | (setq viper-first-time nil) | 551 | (setq viper-first-time nil) |
| 548 | (setq viper-vi-state-cursor-color | ||
| 549 | (viper-get-cursor-color)) | ||
| 550 | (if (not viper-inhibit-startup-message) | 552 | (if (not viper-inhibit-startup-message) |
| 551 | (save-window-excursion | 553 | (save-window-excursion |
| 552 | (setq viper-inhibit-startup-message t) | 554 | (setq viper-inhibit-startup-message t) |