aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/emulation
diff options
context:
space:
mode:
authorMichael Kifer1995-10-14 02:32:56 +0000
committerMichael Kifer1995-10-14 02:32:56 +0000
commit04090c34c54027da11b761e32d5a94f654f857f7 (patch)
tree4e35992730cd4e8c5b435e1412930a570dfe6e54 /lisp/emulation
parente0c82342d8242b50b8f98db67fa4dc01e3571ac4 (diff)
downloademacs-04090c34c54027da11b761e32d5a94f654f857f7.tar.gz
emacs-04090c34c54027da11b761e32d5a94f654f857f7.zip
(vip-set-hooks): Use view-mode-hook in emacs and view
hook in xemacs. (vip-read-string-with-history): minibuffer-setup-hook no longer waits for the user to type, if there are unread events. Added (vip-leave-region-active) to all simple movement commands. Harnessed view-minor-mode. Viper now understands syntactic tables. (vip-read-string-with-history,vip-search): won't pause inside macros any more.
Diffstat (limited to 'lisp/emulation')
-rw-r--r--lisp/emulation/viper.el249
1 files changed, 115 insertions, 134 deletions
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el
index bb1ed4b90b6..40f1f588369 100644
--- a/lisp/emulation/viper.el
+++ b/lisp/emulation/viper.el
@@ -6,7 +6,7 @@
6;; Keywords: emulations 6;; Keywords: emulations
7;; Author: Michael Kifer <kifer@cs.sunysb.edu> 7;; Author: Michael Kifer <kifer@cs.sunysb.edu>
8 8
9(defconst viper-version "2.81 of August 7, 1995" 9(defconst viper-version "2.82 of October 12, 1995"
10 "The current version of Viper") 10 "The current version of Viper")
11 11
12;; Copyright (C) 1994, 1995 Free Software Foundation, Inc. 12;; Copyright (C) 1994, 1995 Free Software Foundation, Inc.
@@ -411,7 +411,7 @@ that deletes a file.")
411 411
412;;; ISO characters 412;;; ISO characters
413 413
414(defvar vip-automatic-iso-accents nil 414(vip-deflocalvar vip-automatic-iso-accents nil
415 "*If non-nil, ISO accents will be turned on in insert/replace emacs states and turned off in vi-state. 415 "*If non-nil, ISO accents will be turned on in insert/replace emacs states and turned off in vi-state.
416For some users, this behavior may be too primitive. In this case, use 416For some users, this behavior may be too primitive. In this case, use
417insert/emacs/vi state hooks.") 417insert/emacs/vi state hooks.")
@@ -797,10 +797,8 @@ These buffers can be cycled through via :R and :P commands.")
797 797
798;;; Miscellaneous 798;;; Miscellaneous
799 799
800;; setup emacs-supported vi-style feel 800;; don't bark when mark is inactive
801(setq mark-even-if-inactive t 801(setq mark-even-if-inactive t)
802 next-line-add-newlines nil
803 require-final-newline t)
804 802
805(defvar vip-inhibit-startup-message nil 803(defvar vip-inhibit-startup-message nil
806 "Whether Viper startup message should be inhibited.") 804 "Whether Viper startup message should be inhibited.")
@@ -837,11 +835,11 @@ Should be set in `~/.vip' file.")
837(vip-deflocalvar vip-insert-minibuffer-minor-mode nil 835(vip-deflocalvar vip-insert-minibuffer-minor-mode nil
838 "Minor mode that forces Vi-style when the Minibuffer is in Insert state.") 836 "Minor mode that forces Vi-style when the Minibuffer is in Insert state.")
839 837
840(vip-deflocalvar vip-add-newline-at-eob t 838;; setup emacs-supported vi-style feel
841 "If t, always add a newline at the end of buffer. 839(setq next-line-add-newlines nil
842Usually, Viper adds a newline character at the end of the last 840 require-final-newline t)
843line in a buffer, if it's missing. In some major modes, however, like 841
844shell-mode, this is undesirable and must be set to nil. See vip-set-hooks.") 842(make-variable-buffer-local 'require-final-newline)
845 843
846 844
847;; Mode line 845;; Mode line
@@ -864,16 +862,16 @@ shell-mode, this is undesirable and must be set to nil. See vip-set-hooks.")
864 (append '("" vip-mode-string) (cdr global-mode-string)))) 862 (append '("" vip-mode-string) (cdr global-mode-string))))
865 863
866 864
867(defvar vip-vi-state-hooks nil 865(defvar vip-vi-state-hook nil
868 "*Hooks run just before the switch to Vi mode is completed.") 866 "*Hooks run just before the switch to Vi mode is completed.")
869(defvar vip-insert-state-hooks nil 867(defvar vip-insert-state-hook nil
870 "*Hooks run just before the switch to Insert mode is completed.") 868 "*Hooks run just before the switch to Insert mode is completed.")
871(defvar vip-replace-state-hooks nil 869(defvar vip-replace-state-hook nil
872 "*Hooks run just before the switch to Replace mode is completed.") 870 "*Hooks run just before the switch to Replace mode is completed.")
873(defvar vip-emacs-state-hooks nil 871(defvar vip-emacs-state-hook nil
874 "*Hooks run just before the switch to Emacs mode is completed.") 872 "*Hooks run just before the switch to Emacs mode is completed.")
875 873
876(defvar vip-load-hooks nil 874(defvar vip-load-hook nil
877 "Hooks run just after loading Viper.") 875 "Hooks run just after loading Viper.")
878 876
879 877
@@ -1306,7 +1304,7 @@ This startup message appears whenever you load Viper, unless you type `y' now."
1306 1304
1307 ;; Protection against user errors in hooks 1305 ;; Protection against user errors in hooks
1308 (condition-case conds 1306 (condition-case conds
1309 (run-hooks 'vip-vi-state-hooks) 1307 (run-hooks 'vip-vi-state-hook)
1310 (error 1308 (error
1311 (vip-message-conditions conds))))) 1309 (vip-message-conditions conds)))))
1312 1310
@@ -1319,7 +1317,7 @@ This startup message appears whenever you load Viper, unless you type `y' now."
1319 1317
1320 ;; Protection against user errors in hooks 1318 ;; Protection against user errors in hooks
1321 (condition-case conds 1319 (condition-case conds
1322 (run-hooks 'vip-insert-state-hooks) 1320 (run-hooks 'vip-insert-state-hook)
1323 (error 1321 (error
1324 (vip-message-conditions conds)))) 1322 (vip-message-conditions conds))))
1325 1323
@@ -1338,7 +1336,7 @@ This startup message appears whenever you load Viper, unless you type `y' now."
1338 (iso-accents-mode 1)) ; turn iso accents on 1336 (iso-accents-mode 1)) ; turn iso accents on
1339 ;; Run insert-state-hook 1337 ;; Run insert-state-hook
1340 (condition-case conds 1338 (condition-case conds
1341 (run-hooks 'vip-insert-state-hooks 'vip-replace-state-hooks) 1339 (run-hooks 'vip-insert-state-hook 'vip-replace-state-hook)
1342 (error 1340 (error
1343 (vip-message-conditions conds))) 1341 (vip-message-conditions conds)))
1344 1342
@@ -1358,7 +1356,7 @@ This startup message appears whenever you load Viper, unless you type `y' now."
1358 1356
1359 ;; Protection agains user errors in hooks 1357 ;; Protection agains user errors in hooks
1360 (condition-case conds 1358 (condition-case conds
1361 (run-hooks 'vip-emacs-state-hooks) 1359 (run-hooks 'vip-emacs-state-hook)
1362 (error 1360 (error
1363 (vip-message-conditions conds)))) 1361 (vip-message-conditions conds))))
1364 1362
@@ -1761,7 +1759,9 @@ behaves as in Emacs, any number of multiple escapes is allowed."
1761;; Get value part of prefix-argument ARG. 1759;; Get value part of prefix-argument ARG.
1762(defsubst vip-p-val (arg) 1760(defsubst vip-p-val (arg)
1763 (cond ((null arg) 1) 1761 (cond ((null arg) 1)
1764 ((consp arg) (if (null (car arg)) 1 (car arg))) 1762 ((consp arg)
1763 (if (or (null (car arg)) (equal (car arg) '(nil)))
1764 1 (car arg)))
1765 (t arg))) 1765 (t arg)))
1766 1766
1767;; Get raw value part of prefix-argument ARG. 1767;; Get raw value part of prefix-argument ARG.
@@ -1895,7 +1895,6 @@ behaves as in Emacs, any number of multiple escapes is allowed."
1895 (if vip-use-register 1895 (if vip-use-register
1896 (progn 1896 (progn
1897 (cond ((vip-valid-register vip-use-register '(letter digit)) 1897 (cond ((vip-valid-register vip-use-register '(letter digit))
1898 ;;(vip-valid-register vip-use-register '(letter))
1899 (copy-to-register 1898 (copy-to-register
1900 vip-use-register (mark t) (point) nil)) 1899 vip-use-register (mark t) (point) nil))
1901 ((vip-valid-register vip-use-register '(Letter)) 1900 ((vip-valid-register vip-use-register '(Letter))
@@ -1906,6 +1905,7 @@ behaves as in Emacs, any number of multiple escapes is allowed."
1906 (setq vip-use-register nil))) 1905 (setq vip-use-register nil)))
1907 (setq last-command nil) 1906 (setq last-command nil)
1908 (copy-region-as-kill (mark t) (point))) 1907 (copy-region-as-kill (mark t) (point)))
1908 (vip-deactivate-mark)
1909 (goto-char vip-com-point)) 1909 (goto-char vip-com-point))
1910 1910
1911(defun vip-exec-bang (m-com com) 1911(defun vip-exec-bang (m-com com)
@@ -2276,11 +2276,11 @@ Undo previous insertion and inserts new."
2276 (save-excursion 2276 (save-excursion
2277 (end-of-line) 2277 (end-of-line)
2278 ;; make sure all lines end with newline, unless in the minibuffer or 2278 ;; make sure all lines end with newline, unless in the minibuffer or
2279 ;; when requested otherwise (vip-add-newline-at-eob is nil) 2279 ;; when requested otherwise (require-final-newline is nil)
2280 (if (and 2280 (if (and
2281 (eobp) 2281 (eobp)
2282 (not (bolp)) 2282 (not (bolp))
2283 vip-add-newline-at-eob 2283 require-final-newline
2284 (not (vip-is-in-minibuffer))) 2284 (not (vip-is-in-minibuffer)))
2285 (insert "\n")))) 2285 (insert "\n"))))
2286 2286
@@ -2488,8 +2488,9 @@ Undo previous insertion and inserts new."
2488 '(lambda () 2488 '(lambda ()
2489 (if (stringp initial) 2489 (if (stringp initial)
2490 (progn 2490 (progn
2491 ;; don't wait if we have unread events 2491 ;; don't wait if we have unread events or in kbd macro
2492 (or unread-command-events 2492 (or unread-command-events
2493 executing-kbd-macro
2493 (sit-for 840)) 2494 (sit-for 840))
2494 (erase-buffer) 2495 (erase-buffer)
2495 (insert initial))) 2496 (insert initial)))
@@ -3014,18 +3015,31 @@ These keys are ESC, RET, and LineFeed"
3014 (if (and (eolp) (bolp)) (error "No character to replace here")) 3015 (if (and (eolp) (bolp)) (error "No character to replace here"))
3015 (let ((val (vip-p-val arg)) 3016 (let ((val (vip-p-val arg))
3016 (com (vip-getcom arg))) 3017 (com (vip-getcom arg)))
3017 (vip-replace-char-subr (if (equal com ?r) vip-d-char (read-char)) val) 3018 (vip-replace-char-subr com val)
3018 (if (and (eolp) (not (bolp))) (forward-char 1)) 3019 (if (and (eolp) (not (bolp))) (forward-char 1))
3019 (vip-set-destructive-command 3020 (vip-set-destructive-command
3020 (list 'vip-replace-char val ?r nil vip-d-char nil)) 3021 (list 'vip-replace-char val ?r nil vip-d-char nil))
3021 )) 3022 ))
3022 3023
3023(defun vip-replace-char-subr (char arg) 3024(defun vip-replace-char-subr (com arg)
3024 (delete-char arg t) 3025 (let ((take-care-of-iso-accents
3025 (setq vip-d-char char) 3026 (and (boundp 'iso-accents-mode) vip-automatic-iso-accents))
3026 (vip-loop (if (> arg 0) arg (- arg)) 3027 char)
3028 (setq char (if (equal com ?r)
3029 vip-d-char
3030 (read-char)))
3031 (if (and take-care-of-iso-accents (memq char '(?' ?\" ?^ ?~)))
3032 ;; get European characters
3033 (progn
3034 (iso-accents-mode 1)
3035 (vip-set-unread-command-events char)
3036 (setq char (aref (read-key-sequence nil) 0))
3037 (iso-accents-mode -1)))
3038 (delete-char arg t)
3039 (setq vip-d-char char)
3040 (vip-loop (if (> arg 0) arg (- arg))
3027 (if (eq char ?\C-m) (insert "\n") (insert char))) 3041 (if (eq char ?\C-m) (insert "\n") (insert char)))
3028 (backward-char arg)) 3042 (backward-char arg)))
3029 3043
3030 3044
3031;; basic cursor movement. j, k, l, h commands. 3045;; basic cursor movement. j, k, l, h commands.
@@ -3093,45 +3107,34 @@ On reaching beginning of line, stop and signal error."
3093;; Words are formed from alpha's and nonalphas - <sp>,\t\n are separators 3107;; Words are formed from alpha's and nonalphas - <sp>,\t\n are separators
3094;; for word movement. When executed with a destructive command, \n is 3108;; for word movement. When executed with a destructive command, \n is
3095;; usually left untouched for the last word. 3109;; usually left untouched for the last word.
3110;; Viper uses syntax table to determine what is a word and what is a
3111;; separator. However, \n is always a separator. Also, if vip-syntax-preference
3112;; is 'vi, then `_' is part of the word.
3096 3113
3097;; skip only one \n 3114;; skip only one \n
3098(defun vip-skip-separators (forward) 3115(defun vip-skip-separators (forward)
3099 (if forward 3116 (if forward
3100 (progn 3117 (progn
3101 (skip-chars-forward " \t") 3118 (vip-skip-all-separators-forward 'within-line)
3102 (if (looking-at "\n") 3119 (if (looking-at "\n")
3103 (progn 3120 (progn
3104 (forward-char) 3121 (forward-char)
3105 (skip-chars-forward " \t")))) 3122 (vip-skip-all-separators-forward 'within-line))))
3106 (skip-chars-backward " \t") 3123 (vip-skip-all-separators-backward 'within-line)
3107 (backward-char) 3124 (backward-char)
3108 (if (looking-at "\n") 3125 (if (looking-at "\n")
3109 (skip-chars-backward " \t") 3126 (vip-skip-all-separators-backward 'within-line)
3110 (forward-char)))) 3127 (forward-char))))
3111 3128
3112(defconst vip-ALPHA "a-zA-Z0-9_")
3113(defconst vip-ALPHA-B (concat "[" vip-ALPHA "]"))
3114(defconst vip-NONALPHA (concat "^" vip-ALPHA))
3115(defconst vip-NONALPHA-B (concat "[" vip-NONALPHA "]"))
3116(defconst vip-SEP " \t\n")
3117(defconst vip-SEP-B (concat "[" vip-SEP "]"))
3118(defconst vip-NONSEP (concat "^" vip-SEP))
3119(defconst vip-NONSEP-B (concat "[" vip-NONSEP "]"))
3120(defconst vip-ALPHASEP (concat vip-ALPHA vip-SEP))
3121(defconst vip-ALPHASEP-B (concat "[" vip-ALPHASEP "]"))
3122(defconst vip-NONALPHASEP (concat "^" vip-ALPHASEP ))
3123(defconst vip-NONALPHASEP-B (concat "[" vip-NONALPHASEP "]"))
3124
3125
3126(defun vip-forward-word-kernel (val) 3129(defun vip-forward-word-kernel (val)
3127 (while (> val 0) 3130 (while (> val 0)
3128 (cond ((looking-at vip-ALPHA-B) 3131 (cond ((vip-looking-at-alpha)
3129 (skip-chars-forward vip-ALPHA) 3132 (vip-skip-alpha-forward "_")
3130 (vip-skip-separators t)) 3133 (vip-skip-separators t))
3131 ((looking-at vip-SEP-B) 3134 ((vip-looking-at-separator)
3132 (vip-skip-separators t)) 3135 (vip-skip-separators t))
3133 ((looking-at vip-NONALPHASEP-B) 3136 ((not (vip-looking-at-alphasep))
3134 (skip-chars-forward vip-NONALPHASEP) 3137 (vip-skip-nonalphasep-forward)
3135 (vip-skip-separators t))) 3138 (vip-skip-separators t)))
3136 (setq val (1- val)))) 3139 (setq val (1- val))))
3137 3140
@@ -3175,7 +3178,7 @@ On reaching beginning of line, stop and signal error."
3175 (if com (vip-move-marker-locally 'vip-com-point (point))) 3178 (if com (vip-move-marker-locally 'vip-com-point (point)))
3176 (vip-loop val 3179 (vip-loop val
3177 (progn 3180 (progn
3178 (skip-chars-forward vip-NONSEP) 3181 (vip-skip-nonseparators 'forward)
3179 (vip-skip-separators t))) 3182 (vip-skip-separators t)))
3180 (if com (progn 3183 (if com (progn
3181 (cond ((memq com (list ?c (- ?c))) 3184 (cond ((memq com (list ?c (- ?c)))
@@ -3192,53 +3195,23 @@ On reaching beginning of line, stop and signal error."
3192;; makes no sense whatsoever 3195;; makes no sense whatsoever
3193(defun vip-end-of-word-kernel () 3196(defun vip-end-of-word-kernel ()
3194 (if (vip-end-of-word-p) (forward-char)) 3197 (if (vip-end-of-word-p) (forward-char))
3195 (if (looking-at "[ \t\n]") 3198 (if (vip-looking-at-separator)
3196 (skip-chars-forward vip-SEP)) 3199 (vip-skip-all-separators-forward))
3197 3200
3198 (cond ((looking-at vip-ALPHA-B) (skip-chars-forward vip-ALPHA)) 3201 (cond ((vip-looking-at-alpha) (vip-skip-alpha-forward "_"))
3199 ((looking-at vip-NONALPHASEP-B) 3202 ((not (vip-looking-at-alphasep)) (vip-skip-nonalphasep-forward)))
3200 (skip-chars-forward vip-NONALPHASEP)))
3201 (vip-backward-char-carefully)) 3203 (vip-backward-char-carefully))
3202 3204
3203(defun vip-end-of-word-p () 3205(defun vip-end-of-word-p ()
3204 (if (eobp) t 3206 (or (eobp)
3205 (save-excursion 3207 (save-excursion
3206 (cond ((looking-at vip-ALPHA-B) 3208 (cond ((vip-looking-at-alpha)
3207 (forward-char) 3209 (forward-char)
3208 (looking-at vip-NONALPHA-B)) 3210 (not (vip-looking-at-alpha)))
3209 ((looking-at vip-NONALPHASEP-B) 3211 ((not (vip-looking-at-alphasep))
3210 (forward-char) 3212 (forward-char)
3211 (looking-at vip-ALPHASEP-B)))))) 3213 (vip-looking-at-alphasep))))))
3212 3214
3213(defun vip-one-char-word-p ()
3214 (let ((step 2))
3215 (save-excursion
3216 (cond ((looking-at vip-ALPHA-B)
3217 (if (bobp) (setq step 1) (backward-char))
3218 (if (or (bobp) (looking-at vip-NONALPHA-B))
3219 (progn
3220 (forward-char step)
3221 (looking-at vip-NONALPHA-B))
3222 nil))
3223 ((looking-at vip-NONALPHASEP-B)
3224 (if (bobp) (setq step 1) (backward-char))
3225 (if (or (bobp) (looking-at vip-ALPHASEP-B))
3226 (progn
3227 (forward-char step)
3228 (looking-at vip-ALPHASEP-B))
3229 nil))))))
3230
3231(defun vip-one-char-Word-p ()
3232 (and (looking-at vip-NONSEP-B)
3233 (save-excursion
3234 (if (bobp)
3235 t
3236 (backward-char)
3237 (looking-at vip-SEP-B)))
3238 (save-excursion
3239 (forward-char)
3240 (or (eobp)
3241 (looking-at vip-SEP-B)))))
3242 3215
3243(defun vip-end-of-word (arg &optional careful) 3216(defun vip-end-of-word (arg &optional careful)
3244 "Move point to end of current word." 3217 "Move point to end of current word."
@@ -3261,13 +3234,10 @@ On reaching beginning of line, stop and signal error."
3261 (com (vip-getcom arg))) 3234 (com (vip-getcom arg)))
3262 (if com (vip-move-marker-locally 'vip-com-point (point))) 3235 (if com (vip-move-marker-locally 'vip-com-point (point)))
3263 (vip-loop val 3236 (vip-loop val
3264 (progn 3237 (progn
3265 (vip-end-of-word-kernel) 3238 (vip-end-of-word-kernel)
3266 (if (not (re-search-forward 3239 (vip-skip-nonseparators 'forward)
3267 vip-SEP-B nil t 1)) 3240 (backward-char)))
3268 (goto-char (point-max)))
3269 (skip-chars-backward vip-SEP)
3270 (backward-char)))
3271 (if com 3241 (if com
3272 (progn 3242 (progn
3273 (forward-char) 3243 (forward-char)
@@ -3276,19 +3246,19 @@ On reaching beginning of line, stop and signal error."
3276(defun vip-backward-word-kernel (val) 3246(defun vip-backward-word-kernel (val)
3277 (while (> val 0) 3247 (while (> val 0)
3278 (backward-char) 3248 (backward-char)
3279 (cond ((looking-at vip-ALPHA-B) 3249 (cond ((vip-looking-at-alpha)
3280 (skip-chars-backward vip-ALPHA)) 3250 (vip-skip-alpha-backward "_"))
3281 ((looking-at vip-SEP-B) 3251 ((vip-looking-at-separator)
3282 (forward-char) 3252 (forward-char)
3283 (vip-skip-separators nil) 3253 (vip-skip-separators nil)
3284 (backward-char) 3254 (backward-char)
3285 (cond ((looking-at vip-ALPHA-B) 3255 (cond ((vip-looking-at-alpha)
3286 (skip-chars-backward vip-ALPHA)) 3256 (vip-skip-alpha-backward "_"))
3287 ((looking-at vip-NONALPHASEP-B) 3257 ((not (vip-looking-at-alphasep))
3288 (skip-chars-backward vip-NONALPHASEP)) 3258 (vip-skip-nonalphasep-backward))
3289 (t (forward-char)))) 3259 (t (forward-char))))
3290 ((looking-at vip-NONALPHASEP-B) 3260 ((not (vip-looking-at-alphasep))
3291 (skip-chars-backward vip-NONALPHASEP))) 3261 (vip-skip-nonalphasep-backward)))
3292 (setq val (1- val)))) 3262 (setq val (1- val))))
3293 3263
3294(defun vip-backward-word (arg) 3264(defun vip-backward-word (arg)
@@ -3321,7 +3291,7 @@ On reaching beginning of line, stop and signal error."
3321 (vip-loop val 3291 (vip-loop val
3322 (progn 3292 (progn
3323 (vip-skip-separators nil) 3293 (vip-skip-separators nil)
3324 (skip-chars-backward vip-NONSEP))) 3294 (vip-skip-nonseparators 'backward)))
3325 (if com (vip-execute-com 'vip-backward-Word val com)))) 3295 (if com (vip-execute-com 'vip-backward-Word val com))))
3326 3296
3327 3297
@@ -3991,12 +3961,14 @@ Null string will repeat previous search."
3991;; Search for COUNT's occurrence of STRING. 3961;; Search for COUNT's occurrence of STRING.
3992;; Search is forward if FORWARD is non-nil, otherwise backward. 3962;; Search is forward if FORWARD is non-nil, otherwise backward.
3993;; INIT-POINT is the position where search is to start. 3963;; INIT-POINT is the position where search is to start.
3994;; Arguments: (STRING FORWARD COUNT &optional NO-OFFSET INIT-POINT LIMIT)." 3964;; Arguments:
3995(defun vip-search (string forward arg &optional no-offset init-point) 3965;; (STRING FORW COUNT &optional NO-OFFSET INIT-POINT LIMIT FAIL-IF-NOT-FOUND)
3966(defun vip-search (string forward arg
3967 &optional no-offset init-point fail-if-not-found)
3996 (if (not (equal string "")) 3968 (if (not (equal string ""))
3997 (let ((val (vip-p-val arg)) 3969 (let ((val (vip-p-val arg))
3998 (com (vip-getcom arg)) 3970 (com (vip-getcom arg))
3999 (null-arg (null (vip-P-val arg))) (offset (not no-offset)) 3971 (offset (not no-offset))
4000 (case-fold-search vip-case-fold-search) 3972 (case-fold-search vip-case-fold-search)
4001 (start-point (or init-point (point)))) 3973 (start-point (or init-point (point))))
4002 (vip-deactivate-mark) 3974 (vip-deactivate-mark)
@@ -4010,17 +3982,21 @@ Null string will repeat previous search."
4010 (re-search-backward string)) 3982 (re-search-backward string))
4011 (search-forward string nil nil val) 3983 (search-forward string nil nil val)
4012 (search-backward string)) 3984 (search-backward string))
4013 (vip-flash-search-pattern) 3985 ;; don't wait and don't flash in macros
3986 (or executing-kbd-macro
3987 (vip-flash-search-pattern))
4014 (if (not (equal start-point (point))) 3988 (if (not (equal start-point (point)))
4015 (push-mark start-point t))) 3989 (push-mark start-point t)))
4016 (search-failed 3990 (search-failed
4017 (if (and null-arg vip-search-wrap-around-t) 3991 (if (and (not fail-if-not-found) vip-search-wrap-around-t)
4018 (progn 3992 (progn
4019 (message "Search wrapped around end of buffer") 3993 (message "Search wrapped around end of buffer")
4020 (goto-char (point-min)) 3994 (goto-char (point-min))
4021 (vip-search string forward (cons 1 com) t start-point) 3995 (vip-search string forward (cons 1 com) t start-point 'fail)
4022 ;; delete the wrapped around message 3996 ;; don't wait in macros
4023 (sit-for 2)(message "") 3997 (or executing-kbd-macro (sit-for 2))
3998 ;; delete the wrap-around message
3999 (message "")
4024 ) 4000 )
4025 (goto-char start-point) 4001 (goto-char start-point)
4026 (error "`%s': %s not found" 4002 (error "`%s': %s not found"
@@ -4033,17 +4009,21 @@ Null string will repeat previous search."
4033 (if vip-re-search 4009 (if vip-re-search
4034 (re-search-backward string nil nil val) 4010 (re-search-backward string nil nil val)
4035 (search-backward string nil nil val)) 4011 (search-backward string nil nil val))
4036 (vip-flash-search-pattern) 4012 ;; don't wait and don't flash in macros
4013 (or executing-kbd-macro
4014 (vip-flash-search-pattern))
4037 (if (not (equal start-point (point))) 4015 (if (not (equal start-point (point)))
4038 (push-mark start-point t))) 4016 (push-mark start-point t)))
4039 (search-failed 4017 (search-failed
4040 (if (and null-arg vip-search-wrap-around-t) 4018 (if (and (not fail-if-not-found) vip-search-wrap-around-t)
4041 (progn 4019 (progn
4042 (message "Search wrapped around beginning of buffer") 4020 (message "Search wrapped around beginning of buffer")
4043 (goto-char (point-max)) 4021 (goto-char (point-max))
4044 (vip-search string forward (cons 1 com) t start-point) 4022 (vip-search string forward (cons 1 com) t start-point 'fail)
4045 ;; delete the wrapped around message 4023 ;; don't wait in macros
4046 (sit-for 2)(message "") 4024 (or executing-kbd-macro (sit-for 2))
4025 ;; delete the wrap-around message
4026 (message "")
4047 ) 4027 )
4048 (goto-char start-point) 4028 (goto-char start-point)
4049 (error "`%s': %s not found" 4029 (error "`%s': %s not found"
@@ -5166,10 +5146,10 @@ Please, specify your level now: ")
5166 'vip-ex-style-editing-in-insert 5146 'vip-ex-style-editing-in-insert
5167 'vip-delete-backwards-in-replace 5147 'vip-delete-backwards-in-replace
5168 'vip-vi-style-in-minibuffer 5148 'vip-vi-style-in-minibuffer
5169 'vip-vi-state-hooks 5149 'vip-vi-state-hook
5170 'vip-insert-state-hooks 5150 'vip-insert-state-hook
5171 'vip-replace-state-hooks 5151 'vip-replace-state-hook
5172 'vip-emacs-state-hooks 5152 'vip-emacs-state-hook
5173 'ex-cycle-other-window 5153 'ex-cycle-other-window
5174 'ex-cycle-through-non-files 5154 'ex-cycle-through-non-files
5175 'vip-expert-level 5155 'vip-expert-level
@@ -5308,7 +5288,7 @@ Mail anyway (y or n)? ")
5308 5288
5309;; This hook designed to enable Vi-style editing in comint-based modes." 5289;; This hook designed to enable Vi-style editing in comint-based modes."
5310(defun vip-comint-mode-hook () 5290(defun vip-comint-mode-hook ()
5311 (setq vip-add-newline-at-eob nil) 5291 (setq require-final-newline nil)
5312 (setq vip-ex-style-editing-in-insert nil 5292 (setq vip-ex-style-editing-in-insert nil
5313 vip-ex-style-motion nil) 5293 vip-ex-style-motion nil)
5314 (vip-add-local-keys 'vi-state 5294 (vip-add-local-keys 'vi-state
@@ -5320,7 +5300,7 @@ Mail anyway (y or n)? ")
5320 ) 5300 )
5321 5301
5322 5302
5323;; This sets major mode hooks to make them come up in vip-state. 5303;; This sets major mode hooks to make them come up in vi-state.
5324(defun vip-set-hooks () 5304(defun vip-set-hooks ()
5325 5305
5326 ;; It is of course a misnomer to call viper-mode a `major mode'. 5306 ;; It is of course a misnomer to call viper-mode a `major mode'.
@@ -5493,6 +5473,7 @@ Mail anyway (y or n)? ")
5493(vip-set-search-face) 5473(vip-set-search-face)
5494(if vip-buffer-search-char 5474(if vip-buffer-search-char
5495 (vip-buffer-search-enable)) 5475 (vip-buffer-search-enable))
5476(vip-update-alphanumeric-class)
5496 5477
5497;;; Familiarize Viper with some minor modes that have their own keymaps 5478;;; Familiarize Viper with some minor modes that have their own keymaps
5498(vip-harness-minor-mode "compile") 5479(vip-harness-minor-mode "compile")
@@ -5544,7 +5525,7 @@ Mail anyway (y or n)? ")
5544 )) 5525 ))
5545 5526
5546 5527
5547(run-hooks 'vip-load-hooks) ; the last chance to change something 5528(run-hooks 'vip-load-hook) ; the last chance to change something
5548 5529
5549(provide 'viper) 5530(provide 'viper)
5550(provide 'vip19) 5531(provide 'vip19)