Mercurial > emacs
comparison lisp/emulation/viper-cmd.el @ 90596:6823a91487f2
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 399-413)
- Update from CVS
- Rcirc update from Ryan Yeske
- Merge from gnus--rel--5.10
- Miscellaneous tq-related fixes.
* gnus--rel--5.10 (patch 126-127)
- Merge from emacs--devo--0
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-105
author | Miles Bader <miles@gnu.org> |
---|---|
date | Mon, 28 Aug 2006 04:33:45 +0000 |
parents | 4094c5298ae1 aba79a1f03ed |
children | c358d0861b16 |
comparison
equal
deleted
inserted
replaced
90595:fd59c4164a14 | 90596:6823a91487f2 |
---|---|
44 (defvar quail-current-str) | 44 (defvar quail-current-str) |
45 (defvar zmacs-region-stays) | 45 (defvar zmacs-region-stays) |
46 (defvar mark-even-if-inactive) | 46 (defvar mark-even-if-inactive) |
47 (defvar init-message) | 47 (defvar init-message) |
48 (defvar initial) | 48 (defvar initial) |
49 (defvar undo-beg-posn) | |
50 (defvar undo-end-posn) | |
49 | 51 |
50 ;; loading happens only in non-interactive compilation | 52 ;; loading happens only in non-interactive compilation |
51 ;; in order to spare non-viperized emacs from being viperized | 53 ;; in order to spare non-viperized emacs from being viperized |
52 (if noninteractive | 54 (if noninteractive |
53 (eval-when-compile | 55 (eval-when-compile |
194 (string= (viper-get-cursor-color) viper-insert-state-cursor-color) | 196 (string= (viper-get-cursor-color) viper-insert-state-cursor-color) |
195 ;; save current color, if not already saved | 197 ;; save current color, if not already saved |
196 (viper-save-cursor-color 'before-insert-mode)) | 198 (viper-save-cursor-color 'before-insert-mode)) |
197 ;; set insert mode cursor color | 199 ;; set insert mode cursor color |
198 (viper-change-cursor-color viper-insert-state-cursor-color))) | 200 (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)) |
200 (let ((has-saved-cursor-color-in-emacs-mode | 202 (let ((has-saved-cursor-color-in-emacs-mode |
201 (stringp (viper-get-saved-cursor-color-in-emacs-mode)))) | 203 (stringp (viper-get-saved-cursor-color-in-emacs-mode)))) |
202 (or has-saved-cursor-color-in-emacs-mode | 204 (or has-saved-cursor-color-in-emacs-mode |
203 (string= (viper-get-cursor-color) viper-emacs-state-cursor-color) | 205 (string= (viper-get-cursor-color) viper-emacs-state-cursor-color) |
204 ;; save current color, if not already saved | 206 ;; save current color, if not already saved |
720 (interactive) | 722 (interactive) |
721 (or (viper-overlay-p viper-replace-overlay) | 723 (or (viper-overlay-p viper-replace-overlay) |
722 (viper-set-replace-overlay (point-min) (point-min))) | 724 (viper-set-replace-overlay (point-min) (point-min))) |
723 (viper-hide-replace-overlay) | 725 (viper-hide-replace-overlay) |
724 | 726 |
725 (let ((has-saved-cursor-color-in-emacs-mode | 727 (if viper-emacs-state-cursor-color |
726 (stringp (viper-get-saved-cursor-color-in-emacs-mode)))) | 728 (let ((has-saved-cursor-color-in-emacs-mode |
727 (or has-saved-cursor-color-in-emacs-mode | 729 (stringp (viper-get-saved-cursor-color-in-emacs-mode)))) |
728 (string= (viper-get-cursor-color) viper-emacs-state-cursor-color) | 730 (or has-saved-cursor-color-in-emacs-mode |
729 (viper-save-cursor-color 'before-emacs-mode)) | 731 (string= (viper-get-cursor-color) viper-emacs-state-cursor-color) |
730 (viper-change-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))) | |
731 | 734 |
732 (viper-change-state 'emacs-state) | 735 (viper-change-state 'emacs-state) |
733 | 736 |
734 ;; Protect against user errors in hooks | 737 ;; Protect against user errors in hooks |
735 (condition-case conds | 738 (condition-case conds |
1028 (let ((event last-input-event) | 1031 (let ((event last-input-event) |
1029 (keyseq [nil]) | 1032 (keyseq [nil]) |
1030 (inhibit-quit t)) | 1033 (inhibit-quit t)) |
1031 (if (viper-ESC-event-p event) | 1034 (if (viper-ESC-event-p event) |
1032 (progn | 1035 (progn |
1033 ;; Emacs 22.50.8 introduced a bug, which makes even a single ESC into | 1036 ;; Some versions of Emacs (eg., 22.50.8 have a bug, which makes even |
1034 ;; a fast keyseq. To guard against this, we added a check if there | 1037 ;; a single ESC into ;; a fast keyseq. To guard against this, we |
1035 ;; are other events as well | 1038 ;; added a check if there are other events as well. Keep the next |
1036 (if (and (viper-fast-keysequence-p) unread-command-events) | 1039 ;; line for the next time the bug reappears, so that will remember to |
1040 ;; report it. | |
1041 ;;(if (and (viper-fast-keysequence-p) unread-command-events) | |
1042 (if (viper-fast-keysequence-p) ;; for Emacsen without the above bug | |
1037 (progn | 1043 (progn |
1038 (let (minor-mode-map-alist emulation-mode-map-alists) | 1044 (let (minor-mode-map-alist emulation-mode-map-alists) |
1039 (viper-set-unread-command-events event) | 1045 (viper-set-unread-command-events event) |
1040 (setq keyseq (read-key-sequence nil 'continue-echo)) | 1046 (setq keyseq (read-key-sequence nil 'continue-echo)) |
1041 ) ; let | 1047 ) ; let |
1742 | 1748 |
1743 (add-hook 'after-change-functions 'viper-undo-sentinel) | 1749 (add-hook 'after-change-functions 'viper-undo-sentinel) |
1744 | 1750 |
1745 ;; Hook used in viper-undo | 1751 ;; Hook used in viper-undo |
1746 (defun viper-after-change-undo-hook (beg end len) | 1752 (defun viper-after-change-undo-hook (beg end len) |
1747 (setq undo-beg-posn beg | 1753 (if undo-in-progress |
1748 undo-end-posn (or end beg)) | 1754 (setq undo-beg-posn beg |
1749 ;; some other hooks may be changing various text properties in | 1755 undo-end-posn (or end beg)) |
1750 ;; the buffer in response to 'undo'; so remove this hook to avoid | 1756 ;; some other hooks may be changing various text properties in |
1751 ;; its repeated invocation | 1757 ;; the buffer in response to 'undo'; so remove this hook to avoid |
1752 (remove-hook 'viper-undo-functions 'viper-after-change-undo-hook 'local)) | 1758 ;; its repeated invocation |
1759 (remove-hook 'viper-undo-functions 'viper-after-change-undo-hook 'local) | |
1760 )) | |
1753 | 1761 |
1754 (defun viper-undo () | 1762 (defun viper-undo () |
1755 "Undo previous change." | 1763 "Undo previous change." |
1756 (interactive) | 1764 (interactive) |
1757 (message "undo!") | 1765 (message "undo!") |
1762 ;; the viper-after-change-undo-hook removes itself after the 1st invocation | 1770 ;; 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) | 1771 (add-hook 'viper-undo-functions 'viper-after-change-undo-hook nil 'local) |
1764 | 1772 |
1765 (undo-start) | 1773 (undo-start) |
1766 (undo-more 2) | 1774 (undo-more 2) |
1767 (setq undo-beg-posn (or undo-beg-posn before-undo-pt) | 1775 ;;(setq undo-beg-posn (or undo-beg-posn (point)) |
1768 undo-end-posn (or undo-end-posn undo-beg-posn)) | 1776 ;; undo-end-posn (or undo-end-posn (point))) |
1769 | 1777 ;;(setq undo-beg-posn (or undo-beg-posn before-undo-pt) |
1770 (goto-char undo-beg-posn) | 1778 ;; undo-end-posn (or undo-end-posn undo-beg-posn)) |
1771 (sit-for 0) | 1779 |
1772 (if (and viper-keep-point-on-undo | 1780 (if (and undo-beg-posn undo-end-posn) |
1773 (pos-visible-in-window-p before-undo-pt)) | |
1774 (progn | 1781 (progn |
1775 (push-mark (point-marker) t) | 1782 (goto-char undo-beg-posn) |
1776 (viper-sit-for-short 300) | 1783 (sit-for 0) |
1777 (goto-char undo-end-posn) | 1784 (if (and viper-keep-point-on-undo |
1778 (viper-sit-for-short 300) | 1785 (pos-visible-in-window-p before-undo-pt)) |
1779 (if (and (> (viper-chars-in-region undo-beg-posn before-undo-pt) 1) | 1786 (progn |
1780 (> (viper-chars-in-region undo-end-posn before-undo-pt) 1)) | 1787 (push-mark (point-marker) t) |
1781 (goto-char before-undo-pt) | 1788 (viper-sit-for-short 300) |
1782 (goto-char undo-beg-posn))) | 1789 (goto-char undo-end-posn) |
1783 (push-mark before-undo-pt t)) | 1790 (viper-sit-for-short 300) |
1791 (if (pos-visible-in-window-p undo-beg-posn) | |
1792 (goto-char before-undo-pt) | |
1793 (goto-char undo-beg-posn))) | |
1794 (push-mark before-undo-pt t)) | |
1795 )) | |
1796 | |
1784 (if (and (eolp) (not (bolp))) (backward-char 1)) | 1797 (if (and (eolp) (not (bolp))) (backward-char 1)) |
1785 ;;(if (not modified) (set-buffer-modified-p t)) | |
1786 ) | 1798 ) |
1787 (setq this-command 'viper-undo)) | 1799 (setq this-command 'viper-undo)) |
1788 | 1800 |
1789 ;; Continue undoing previous changes. | 1801 ;; Continue undoing previous changes. |
1790 (defun viper-undo-more () | 1802 (defun viper-undo-more () |
3950 "Repeat previous search." | 3962 "Repeat previous search." |
3951 (interactive "P") | 3963 (interactive "P") |
3952 (let ((val (viper-p-val arg)) | 3964 (let ((val (viper-p-val arg)) |
3953 (com (viper-getcom arg)) | 3965 (com (viper-getcom arg)) |
3954 debug-on-error) | 3966 debug-on-error) |
3955 (if (null viper-s-string) (error viper-NoPrevSearch)) | 3967 (if (or (null viper-s-string) (string= viper-s-string "")) |
3968 (error viper-NoPrevSearch)) | |
3956 (viper-search viper-s-string viper-s-forward arg) | 3969 (viper-search viper-s-string viper-s-forward arg) |
3957 (if com | 3970 (if com |
3958 (progn | 3971 (progn |
3959 (viper-move-marker-locally 'viper-com-point (mark t)) | 3972 (viper-move-marker-locally 'viper-com-point (mark t)) |
3960 (viper-execute-com 'viper-search-next val com))))) | 3973 (viper-execute-com 'viper-search-next val com))))) |