/[emacs]/emacs/lisp/emulation/viper-cmd.el
ViewVC logotype

Diff of /emacs/lisp/emulation/viper-cmd.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.40 by miles, Mon Sep 1 15:45:22 2003 UTC revision 1.41 by kifer, Sat Feb 19 19:32:47 2005 UTC
# Line 1063  as a Meta key and any number of multiple Line 1063  as a Meta key and any number of multiple
1063    
1064      ;; call the actual function to execute ESC (if no other symbols followed)      ;; call the actual function to execute ESC (if no other symbols followed)
1065      ;; or the key bound to the ESC sequence (if the sequence was issued      ;; or the key bound to the ESC sequence (if the sequence was issued
1066      ;; with very short delay between characters.      ;; with very short delay between characters).
1067      (if (eq cmd 'viper-intercept-ESC-key)      (if (eq cmd 'viper-intercept-ESC-key)
1068          (setq cmd          (setq cmd
1069                (cond ((eq viper-current-state 'vi-state)                (cond ((eq viper-current-state 'vi-state)
# Line 1529  as a Meta key and any number of multiple Line 1529  as a Meta key and any number of multiple
1529    nil)    nil)
1530    
1531  (defun viper-exec-buffer-search (m-com com)  (defun viper-exec-buffer-search (m-com com)
1532    (setq viper-s-string (buffer-substring (point) viper-com-point))    (setq viper-s-string
1533            (regexp-quote (buffer-substring (point) viper-com-point)))
1534    (setq viper-s-forward t)    (setq viper-s-forward t)
1535    (setq viper-search-history (cons viper-s-string viper-search-history))    (setq viper-search-history (cons viper-s-string viper-search-history))
1536    (setq viper-intermediate-command 'viper-exec-buffer-search)    (setq viper-intermediate-command 'viper-exec-buffer-search)
# Line 1982  Undo previous insertion and inserts new. Line 1983  Undo previous insertion and inserts new.
1983    (let ((hook (if viper-vi-style-in-minibuffer    (let ((hook (if viper-vi-style-in-minibuffer
1984                    'viper-change-state-to-insert                    'viper-change-state-to-insert
1985                  'viper-change-state-to-emacs)))                  'viper-change-state-to-emacs)))
1986        ;; making buffer-local variables so that normal buffers won't affect the
1987        ;; minibuffer and vice versa. Otherwise, command arguments will affect
1988        ;; minibuffer ops and insertions from the minibuffer will change those in
1989        ;; the normal buffers
1990        (make-local-variable 'viper-d-com)
1991        (make-local-variable 'viper-last-insertion)
1992        (make-local-variable 'viper-command-ring)
1993        (setq viper-d-com nil
1994              viper-last-insertion nil
1995              viper-command-ring nil)
1996      (funcall hook)      (funcall hook)
1997      ))      ))
1998    
# Line 2707  On reaching beginning of line, stop and Line 2718  On reaching beginning of line, stop and
2718      (viper-backward-char-carefully)      (viper-backward-char-carefully)
2719      (if (looking-at "\n")      (if (looking-at "\n")
2720          (viper-skip-all-separators-backward 'within-line)          (viper-skip-all-separators-backward 'within-line)
2721        (or (bobp) (forward-char)))))        (or (viper-looking-at-separator) (forward-char)))))
2722    
2723    
2724  (defun viper-forward-word-kernel (val)  (defun viper-forward-word-kernel (val)
# Line 3630  the Emacs binding of `/'." Line 3641  the Emacs binding of `/'."
3641             (setq msg "Search style remains unchanged")))             (setq msg "Search style remains unchanged")))
3642      (princ msg t)))      (princ msg t)))
3643    
3644  (defun viper-set-searchstyle-toggling-macros (unset)  (defun viper-set-searchstyle-toggling-macros (unset &optional major-mode)
3645    "Set the macros for toggling the search style in Viper's vi-state.    "Set the macros for toggling the search style in Viper's vi-state.
3646  The macro that toggles case sensitivity is bound to `//', and the one that  The macro that toggles case sensitivity is bound to `//', and the one that
3647  toggles regexp search is bound to `///'.  toggles regexp search is bound to `///'.
3648  With a prefix argument, this function unsets the macros. "  With a prefix argument, this function unsets the macros.
3649    If MAJOR-MODE is set, set the macros only in that major mode."
3650    (interactive "P")    (interactive "P")
3651    (or noninteractive    (let (scope)
3652        (if (not unset)      (if (and major-mode (symbolp major-mode))
3653            (progn          (setq scope major-mode)
3654              ;; toggle case sensitivity in search        (setq scope 't))
3655              (viper-record-kbd-macro      (or noninteractive
3656               "//" 'vi-state          (if (not unset)
3657               [1 (meta x) v i p e r - t o g g l e - s e a r c h - s t y l e return]              (progn
3658               't)                ;; toggle case sensitivity in search
3659              ;; toggle regexp/vanila search                (viper-record-kbd-macro
3660              (viper-record-kbd-macro                 "//" 'vi-state
3661               "///" 'vi-state                 [1 (meta x) v i p e r - t o g g l e - s e a r c h - s t y l e return]
3662               [2 (meta x) v i p e r - t o g g l e - s e a r c h - s t y l e return]                 scope)
3663               't)                ;; toggle regexp/vanila search
3664              (if (interactive-p)                (viper-record-kbd-macro
3665                  (message                 "///" 'vi-state
3666                   "// and /// now toggle case-sensitivity and regexp search")))                 [2 (meta x) v i p e r - t o g g l e - s e a r c h - s t y l e return]
3667          (viper-unrecord-kbd-macro "//" 'vi-state)                 scope)
3668          (sit-for 2)                (if (interactive-p)
3669          (viper-unrecord-kbd-macro "///" 'vi-state))))                    (message
3670                       "// and /// now toggle case-sensitivity and regexp search")))
3671              (viper-unrecord-kbd-macro "//" 'vi-state)
3672              (sit-for 2)
3673              (viper-unrecord-kbd-macro "///" 'vi-state)))
3674        ))
3675      
3676      
3677  (defun viper-set-parsing-style-toggling-macro (unset)  (defun viper-set-parsing-style-toggling-macro (unset)
3678    "Set `%%%' to be a macro that toggles whether comment fields should be parsed for matching parentheses.    "Set `%%%' to be a macro that toggles whether comment fields should be parsed for matching parentheses.
3679  This is used in conjunction with the `%' command.  This is used in conjunction with the `%' command.
# Line 4112  Null string will repeat previous search. Line 4129  Null string will repeat previous search.
4129    (interactive)    (interactive)
4130    (if (and viper-ex-style-editing (bolp))    (if (and viper-ex-style-editing (bolp))
4131        (beep 1)        (beep 1)
4132      (delete-backward-char 1 t)))      ;; don't put on kill ring
4133        (delete-backward-char 1 nil)))
4134    
4135    
4136  (defun viper-del-backward-char-in-replace ()  (defun viper-del-backward-char-in-replace ()
# Line 4124  cursor move past the beginning of line." Line 4142  cursor move past the beginning of line."
4142    (interactive)    (interactive)
4143    (cond (viper-delete-backwards-in-replace    (cond (viper-delete-backwards-in-replace
4144           (cond ((not (bolp))           (cond ((not (bolp))
4145                  (delete-backward-char 1 t))                  ;; don't put on kill ring
4146                    (delete-backward-char 1 nil))
4147                 (viper-ex-style-editing                 (viper-ex-style-editing
4148                  (beep 1))                  (beep 1))
4149                 ((bobp)                 ((bobp)
4150                  (beep 1))                  (beep 1))
4151                 (t                 (t
4152                  (delete-backward-char 1 t))))                  ;; don't put on kill ring
4153                    (delete-backward-char 1 nil))))
4154          (viper-ex-style-editing          (viper-ex-style-editing
4155           (if (bolp)           (if (bolp)
4156               (beep 1)               (beep 1)

Legend:
Removed from v.1.40  
changed lines
  Added in v.1.41

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26