Mercurial > emacs
comparison lisp/emulation/viper-init.el @ 26429:e20b16957cdd
* emulation/viper-init.el (viper-deflocalvar, viper-loop,
viper-buffer-live-p, viper-kbd-buf-alist, viper-kbd-buf-pair,
viper-kbd-buf-definition, viper-kbd-mode-alist,
viper-kbd-mode-pair, viper-kbd-mode-definition,
viper-kbd-global-pair, viper-kbd-global-definition):
Use the new backquote syntax.
* emulation/viper-cmd.el (viper-test-com-defun,
viper-prefix-arg-value, viper-prefix-arg-com):
Use the new backquote syntax.
author | Sam Steingold <sds@gnu.org> |
---|---|
date | Fri, 12 Nov 1999 18:40:24 +0000 |
parents | 4f315ca65976 |
children | 42f9a58e0fc4 |
comparison
equal
deleted
inserted
replaced
26428:f572944ca41f | 26429:e20b16957cdd |
---|---|
37 | 37 |
38 | 38 |
39 ;; Viper version | 39 ;; Viper version |
40 (defun viper-version () | 40 (defun viper-version () |
41 (interactive) | 41 (interactive) |
42 (message "Viper version is %s" viper-version)) | 42 (message "Viper version is %s" viper-version)) |
43 | 43 |
44 ;; Is it XEmacs? | 44 ;; Is it XEmacs? |
45 (defconst viper-xemacs-p (string-match "XEmacs" emacs-version)) | 45 (defconst viper-xemacs-p (string-match "XEmacs" emacs-version)) |
46 ;; Is it Emacs? | 46 ;; Is it Emacs? |
47 (defconst viper-emacs-p (not viper-xemacs-p)) | 47 (defconst viper-emacs-p (not viper-xemacs-p)) |
82 | 82 |
83 | 83 |
84 ;;; Macros | 84 ;;; Macros |
85 | 85 |
86 (defmacro viper-deflocalvar (var default-value &optional documentation) | 86 (defmacro viper-deflocalvar (var default-value &optional documentation) |
87 (` (progn | 87 `(progn |
88 (defvar (, var) (, default-value) | 88 (defvar ,var ,default-value |
89 (, (format "%s\n\(buffer local\)" documentation))) | 89 ,(format "%s\n\(buffer local\)" documentation)) |
90 (make-variable-buffer-local '(, var)) | 90 (make-variable-buffer-local ',var))) |
91 ))) | |
92 | 91 |
93 ;; (viper-loop COUNT BODY) Execute BODY COUNT times. | 92 ;; (viper-loop COUNT BODY) Execute BODY COUNT times. |
94 (defmacro viper-loop (count &rest body) | 93 (defmacro viper-loop (count &rest body) |
95 (` (let ((count (, count))) | 94 `(let ((count ,count)) |
96 (while (> count 0) | 95 (while (> count 0) |
97 (progn | 96 ,@body |
98 (,@ body) | 97 (setq count (1- count))))) |
99 (setq count (1- count)) | |
100 )) | |
101 ))) | |
102 | 98 |
103 (defmacro viper-buffer-live-p (buf) | 99 (defmacro viper-buffer-live-p (buf) |
104 (` (and (, buf) (get-buffer (, buf)) (buffer-name (get-buffer (, buf)))))) | 100 `(and ,buf (get-buffer ,buf) (buffer-name (get-buffer ,buf)))) |
105 | 101 |
106 ;; return buffer-specific macro definition, given a full macro definition | 102 ;; return buffer-specific macro definition, given a full macro definition |
107 (defmacro viper-kbd-buf-alist (macro-elt) | 103 (defmacro viper-kbd-buf-alist (macro-elt) |
108 (` (nth 1 (, macro-elt)))) | 104 `(nth 1 ,macro-elt)) |
109 ;; get a pair: (curr-buffer . macro-definition) | 105 ;; get a pair: (curr-buffer . macro-definition) |
110 (defmacro viper-kbd-buf-pair (macro-elt) | 106 (defmacro viper-kbd-buf-pair (macro-elt) |
111 (` (assoc (buffer-name) (viper-kbd-buf-alist (, macro-elt))))) | 107 `(assoc (buffer-name) (viper-kbd-buf-alist ,macro-elt))) |
112 ;; get macro definition for current buffer | 108 ;; get macro definition for current buffer |
113 (defmacro viper-kbd-buf-definition (macro-elt) | 109 (defmacro viper-kbd-buf-definition (macro-elt) |
114 (` (cdr (viper-kbd-buf-pair (, macro-elt))))) | 110 `(cdr (viper-kbd-buf-pair ,macro-elt))) |
115 | 111 |
116 ;; return mode-specific macro definitions, given a full macro definition | 112 ;; return mode-specific macro definitions, given a full macro definition |
117 (defmacro viper-kbd-mode-alist (macro-elt) | 113 (defmacro viper-kbd-mode-alist (macro-elt) |
118 (` (nth 2 (, macro-elt)))) | 114 `(nth 2 ,macro-elt)) |
119 ;; get a pair: (major-mode . macro-definition) | 115 ;; get a pair: (major-mode . macro-definition) |
120 (defmacro viper-kbd-mode-pair (macro-elt) | 116 (defmacro viper-kbd-mode-pair (macro-elt) |
121 (` (assoc major-mode (viper-kbd-mode-alist (, macro-elt))))) | 117 `(assoc major-mode (viper-kbd-mode-alist ,macro-elt))) |
122 ;; get macro definition for the current major mode | 118 ;; get macro definition for the current major mode |
123 (defmacro viper-kbd-mode-definition (macro-elt) | 119 (defmacro viper-kbd-mode-definition (macro-elt) |
124 (` (cdr (viper-kbd-mode-pair (, macro-elt))))) | 120 `(cdr (viper-kbd-mode-pair ,macro-elt))) |
125 | 121 |
126 ;; return global macro definition, given a full macro definition | 122 ;; return global macro definition, given a full macro definition |
127 (defmacro viper-kbd-global-pair (macro-elt) | 123 (defmacro viper-kbd-global-pair (macro-elt) |
128 (` (nth 3 (, macro-elt)))) | 124 `(nth 3 ,macro-elt)) |
129 ;; get global macro definition from an elt of macro-alist | 125 ;; get global macro definition from an elt of macro-alist |
130 (defmacro viper-kbd-global-definition (macro-elt) | 126 (defmacro viper-kbd-global-definition (macro-elt) |
131 (` (cdr (viper-kbd-global-pair (, macro-elt))))) | 127 `(cdr (viper-kbd-global-pair ,macro-elt))) |
132 | 128 |
133 ;; last elt of a sequence | 129 ;; last elt of a sequence |
134 (defsubst viper-seq-last-elt (seq) | 130 (defsubst viper-seq-last-elt (seq) |
135 (elt seq (1- (length seq)))) | 131 (elt seq (1- (length seq)))) |
136 | 132 |
137 (defsubst viper-string-to-list (string) | 133 (defsubst viper-string-to-list (string) |
144 (defun viper-char-at-pos (direction &optional offset) | 140 (defun viper-char-at-pos (direction &optional offset) |
145 (or (integerp offset) (setq offset 0)) | 141 (or (integerp offset) (setq offset 0)) |
146 (if (eq direction 'forward) | 142 (if (eq direction 'forward) |
147 (char-after (+ (point) offset)) | 143 (char-after (+ (point) offset)) |
148 (char-before (- (point) offset)))) | 144 (char-before (- (point) offset)))) |
149 | 145 |
150 | 146 |
151 (defvar viper-minibuffer-overlay-priority 300) | 147 (defvar viper-minibuffer-overlay-priority 300) |
152 (defvar viper-replace-overlay-priority 400) | 148 (defvar viper-replace-overlay-priority 400) |
153 (defvar viper-search-overlay-priority 500) | 149 (defvar viper-search-overlay-priority 500) |
154 | 150 |
155 | 151 |
156 ;;; Viper minor modes | 152 ;;; Viper minor modes |
157 | 153 |
158 ;; Mode for vital things like \e, C-z. | 154 ;; Mode for vital things like \e, C-z. |
159 (viper-deflocalvar viper-vi-intercept-minor-mode nil) | 155 (viper-deflocalvar viper-vi-intercept-minor-mode nil) |
160 | 156 |
161 (viper-deflocalvar viper-vi-basic-minor-mode nil | 157 (viper-deflocalvar viper-vi-basic-minor-mode nil |
162 "Viper's minor mode for Vi bindings.") | 158 "Viper's minor mode for Vi bindings.") |
163 | 159 |
164 (viper-deflocalvar viper-vi-local-user-minor-mode nil | 160 (viper-deflocalvar viper-vi-local-user-minor-mode nil |
165 "Auxiliary minor mode for user-defined local bindings in Vi state.") | 161 "Auxiliary minor mode for user-defined local bindings in Vi state.") |
166 | 162 |
167 (viper-deflocalvar viper-vi-global-user-minor-mode nil | 163 (viper-deflocalvar viper-vi-global-user-minor-mode nil |
168 "Auxiliary minor mode for user-defined global bindings in Vi state.") | 164 "Auxiliary minor mode for user-defined global bindings in Vi state.") |
209 | 205 |
210 ;; Mode for vital things like \C-z and \C-x) This is set to t, when viper-mode | 206 ;; Mode for vital things like \C-z and \C-x) This is set to t, when viper-mode |
211 ;; is invoked. So, any new buffer will have C-z defined as switch to Vi, | 207 ;; is invoked. So, any new buffer will have C-z defined as switch to Vi, |
212 ;; unless we switched states in this buffer | 208 ;; unless we switched states in this buffer |
213 (viper-deflocalvar viper-emacs-intercept-minor-mode nil) | 209 (viper-deflocalvar viper-emacs-intercept-minor-mode nil) |
214 | 210 |
215 (viper-deflocalvar viper-emacs-local-user-minor-mode nil | 211 (viper-deflocalvar viper-emacs-local-user-minor-mode nil |
216 "Minor mode for local user bindings effective in Emacs state. | 212 "Minor mode for local user bindings effective in Emacs state. |
217 Users can use it to override Emacs bindings when Viper is in its Emacs | 213 Users can use it to override Emacs bindings when Viper is in its Emacs |
218 state.") | 214 state.") |
219 | 215 |
220 (viper-deflocalvar viper-emacs-global-user-minor-mode nil | 216 (viper-deflocalvar viper-emacs-global-user-minor-mode nil |
221 "Minor mode for global user bindings in effect in Emacs state. | 217 "Minor mode for global user bindings in effect in Emacs state. |
222 Users can use it to override Emacs bindings when Viper is in its Emacs | 218 Users can use it to override Emacs bindings when Viper is in its Emacs |
223 state.") | 219 state.") |
224 | 220 |
225 (viper-deflocalvar viper-emacs-kbd-minor-mode nil | 221 (viper-deflocalvar viper-emacs-kbd-minor-mode nil |
226 "Minor mode for Vi style macros in Emacs state. | 222 "Minor mode for Vi style macros in Emacs state. |
227 The corresponding keymap stores key bindings of Vi macros defined with | 223 The corresponding keymap stores key bindings of Vi macros defined with |
228 `viper-record-kbd-macro' command. There is no Ex-level command to do this | 224 `viper-record-kbd-macro' command. There is no Ex-level command to do this |
236 (viper-deflocalvar viper-vi-minibuffer-minor-mode nil | 232 (viper-deflocalvar viper-vi-minibuffer-minor-mode nil |
237 "Minor mode that forces Vi-style when the Minibuffer is in Vi state.") | 233 "Minor mode that forces Vi-style when the Minibuffer is in Vi state.") |
238 | 234 |
239 (viper-deflocalvar viper-insert-minibuffer-minor-mode nil | 235 (viper-deflocalvar viper-insert-minibuffer-minor-mode nil |
240 "Minor mode that forces Vi-style when the Minibuffer is in Insert state.") | 236 "Minor mode that forces Vi-style when the Minibuffer is in Insert state.") |
241 | 237 |
242 | 238 |
243 | 239 |
244 ;; Some common error messages | 240 ;; Some common error messages |
245 | 241 |
246 (defconst viper-SpuriousText "Spurious text after command" "") | 242 (defconst viper-SpuriousText "Spurious text after command" "") |
254 (defconst viper-InvalidViCommand "Invalid command" "") | 250 (defconst viper-InvalidViCommand "Invalid command" "") |
255 (defconst viper-BadAddress "Ill-formed address" "") | 251 (defconst viper-BadAddress "Ill-formed address" "") |
256 (defconst viper-FirstAddrExceedsSecond "First address exceeds second" "") | 252 (defconst viper-FirstAddrExceedsSecond "First address exceeds second" "") |
257 (defconst viper-NoFileSpecified "No file specified" "") | 253 (defconst viper-NoFileSpecified "No file specified" "") |
258 | 254 |
259 ;; Is t until viper-mode executes for the very first time. | 255 ;; Is t until viper-mode executes for the very first time. |
260 ;; Prevents recursive descend into startup messages. | 256 ;; Prevents recursive descend into startup messages. |
261 (defvar viper-first-time t) | 257 (defvar viper-first-time t) |
262 | 258 |
263 (defvar viper-expert-level (if (boundp 'viper-expert-level) viper-expert-level 0) | 259 (defvar viper-expert-level (if (boundp 'viper-expert-level) viper-expert-level 0) |
264 "User's expert level. | 260 "User's expert level. |
281 (viper-deflocalvar viper-automatic-iso-accents nil "") | 277 (viper-deflocalvar viper-automatic-iso-accents nil "") |
282 ;; Set iso-accents-mode to ARG. Check if it is bound first | 278 ;; Set iso-accents-mode to ARG. Check if it is bound first |
283 (defsubst viper-set-iso-accents-mode (arg) | 279 (defsubst viper-set-iso-accents-mode (arg) |
284 (if (boundp 'iso-accents-mode) | 280 (if (boundp 'iso-accents-mode) |
285 (setq iso-accents-mode arg))) | 281 (setq iso-accents-mode arg))) |
286 | 282 |
287 ;; Internal flag used to control when viper mule hooks are run. | 283 ;; Internal flag used to control when viper mule hooks are run. |
288 ;; Don't change this! | 284 ;; Don't change this! |
289 (defvar viper-mule-hook-flag t) | 285 (defvar viper-mule-hook-flag t) |
290 ;; If non-nil, the default intl. input method is turned on. | 286 ;; If non-nil, the default intl. input method is turned on. |
291 (viper-deflocalvar viper-special-input-method nil "") | 287 (viper-deflocalvar viper-special-input-method nil "") |
292 | 288 |
293 ;; viper hook to run on input-method activation | 289 ;; viper hook to run on input-method activation |
294 (defun viper-activate-input-method-action () | 290 (defun viper-activate-input-method-action () |
295 (if (null viper-mule-hook-flag) | 291 (if (null viper-mule-hook-flag) |
296 () | 292 () |
297 (setq viper-special-input-method t) | 293 (setq viper-special-input-method t) |
299 (if (eq viper-current-state 'vi-state) | 295 (if (eq viper-current-state 'vi-state) |
300 (viper-set-input-method nil)) | 296 (viper-set-input-method nil)) |
301 (if (memq viper-current-state '(vi-state insert-state replace-state)) | 297 (if (memq viper-current-state '(vi-state insert-state replace-state)) |
302 (message "Viper special input method%s: on" | 298 (message "Viper special input method%s: on" |
303 (if (or current-input-method default-input-method) | 299 (if (or current-input-method default-input-method) |
304 (format " %S" | 300 (format " %S" |
305 (or current-input-method default-input-method)) | 301 (or current-input-method default-input-method)) |
306 ""))) | 302 ""))) |
307 )) | 303 )) |
308 | 304 |
309 ;; viper hook to run on input-method deactivation | 305 ;; viper hook to run on input-method deactivation |
321 (defun viper-inactivate-input-method () | 317 (defun viper-inactivate-input-method () |
322 (cond ((and viper-emacs-p (fboundp 'inactivate-input-method)) | 318 (cond ((and viper-emacs-p (fboundp 'inactivate-input-method)) |
323 (inactivate-input-method)) | 319 (inactivate-input-method)) |
324 ((and viper-xemacs-p (boundp 'current-input-method)) | 320 ((and viper-xemacs-p (boundp 'current-input-method)) |
325 ;; XEmacs had broken quil-mode for some time, so we are working around | 321 ;; XEmacs had broken quil-mode for some time, so we are working around |
326 ;; it here | 322 ;; it here |
327 (setq quail-mode nil) | 323 (setq quail-mode nil) |
328 (if (featurep 'quail) | 324 (if (featurep 'quail) |
329 (quail-delete-overlays)) | 325 (quail-delete-overlays)) |
330 (setq describe-current-input-method-function nil) | 326 (setq describe-current-input-method-function nil) |
331 (setq current-input-method nil) | 327 (setq current-input-method nil) |
365 "*Non-nil means not to move point while undoing commands. | 361 "*Non-nil means not to move point while undoing commands. |
366 This style is different from Emacs and Vi. Try it to see if | 362 This style is different from Emacs and Vi. Try it to see if |
367 it better fits your working style." | 363 it better fits your working style." |
368 :type 'boolean | 364 :type 'boolean |
369 :tag "Preserve Position of Point After Undo" | 365 :tag "Preserve Position of Point After Undo" |
370 :group 'viper) | 366 :group 'viper) |
371 | 367 |
372 ;; Replace mode and changing text | 368 ;; Replace mode and changing text |
373 | 369 |
374 ;; Hack used to pass global states around for short period of time | 370 ;; Hack used to pass global states around for short period of time |
375 (viper-deflocalvar viper-intermediate-command nil "") | 371 (viper-deflocalvar viper-intermediate-command nil "") |
376 | 372 |
377 ;; This is used to pass the right Vi command key sequence to | 373 ;; This is used to pass the right Vi command key sequence to |
378 ;; viper-set-destructive-command whenever (this-command-keys) doesn't give the | 374 ;; viper-set-destructive-command whenever (this-command-keys) doesn't give the |
379 ;; right result. For instance, in commands like c/bla<RET>, | 375 ;; right result. For instance, in commands like c/bla<RET>, |
380 ;; (this-command-keys) will return ^M, which invoked exit-minibuffer, while we | 376 ;; (this-command-keys) will return ^M, which invoked exit-minibuffer, while we |
381 ;; need "c/" | 377 ;; need "c/" |
382 (defconst viper-this-command-keys nil) | 378 (defconst viper-this-command-keys nil) |
383 | 379 |
384 ;; Indicates that the current destructive command has started in replace mode. | 380 ;; Indicates that the current destructive command has started in replace mode. |
385 (viper-deflocalvar viper-began-as-replace nil "") | 381 (viper-deflocalvar viper-began-as-replace nil "") |
386 | 382 |
401 :type 'string | 397 :type 'string |
402 :group 'viper) | 398 :group 'viper) |
403 | 399 |
404 ;; internal var, used to remember the default cursor color of emacs frames | 400 ;; internal var, used to remember the default cursor color of emacs frames |
405 (defvar viper-vi-state-cursor-color nil) | 401 (defvar viper-vi-state-cursor-color nil) |
406 | 402 |
407 (viper-deflocalvar viper-replace-overlay nil "") | 403 (viper-deflocalvar viper-replace-overlay nil "") |
408 (put 'viper-replace-overlay 'permanent-local t) | 404 (put 'viper-replace-overlay 'permanent-local t) |
409 | 405 |
410 (defcustom viper-replace-region-end-delimiter "$" | 406 (defcustom viper-replace-region-end-delimiter "$" |
411 "A string marking the end of replacement regions. | 407 "A string marking the end of replacement regions. |
417 "A string marking the beginning of replacement regions. | 413 "A string marking the beginning of replacement regions. |
418 It is used only with TTYs or if `viper-use-replace-region-delimiters' | 414 It is used only with TTYs or if `viper-use-replace-region-delimiters' |
419 is non-nil." | 415 is non-nil." |
420 :type 'string | 416 :type 'string |
421 :group 'viper) | 417 :group 'viper) |
422 (defcustom viper-use-replace-region-delimiters | 418 (defcustom viper-use-replace-region-delimiters |
423 (or (not (viper-has-face-support-p)) | 419 (or (not (viper-has-face-support-p)) |
424 (and viper-xemacs-p (eq (viper-device-type) 'tty))) | 420 (and viper-xemacs-p (eq (viper-device-type) 'tty))) |
425 "*If non-nil, Viper will always use `viper-replace-region-end-delimiter' and | 421 "*If non-nil, Viper will always use `viper-replace-region-end-delimiter' and |
426 `viper-replace-region-start-delimiter' to delimit replacement regions, even on | 422 `viper-replace-region-start-delimiter' to delimit replacement regions, even on |
427 color displays. By default, the delimiters are used only on TTYs." | 423 color displays. By default, the delimiters are used only on TTYs." |
430 | 426 |
431 (defcustom viper-read-buffer-function 'read-buffer | 427 (defcustom viper-read-buffer-function 'read-buffer |
432 "Function to use for prompting the user for a buffer name." | 428 "Function to use for prompting the user for a buffer name." |
433 :type 'symbol | 429 :type 'symbol |
434 :group 'viper) | 430 :group 'viper) |
435 | 431 |
436 ;; XEmacs requires glyphs | 432 ;; XEmacs requires glyphs |
437 (if viper-xemacs-p | 433 (if viper-xemacs-p |
438 (progn | 434 (progn |
439 (or (glyphp viper-replace-region-end-delimiter) | 435 (or (glyphp viper-replace-region-end-delimiter) |
440 (setq viper-replace-region-end-delimiter | 436 (setq viper-replace-region-end-delimiter |
441 (make-glyph viper-replace-region-end-delimiter))) | 437 (make-glyph viper-replace-region-end-delimiter))) |
442 (or (glyphp viper-replace-region-start-delimiter) | 438 (or (glyphp viper-replace-region-start-delimiter) |
443 (setq viper-replace-region-start-delimiter | 439 (setq viper-replace-region-start-delimiter |
444 (make-glyph viper-replace-region-start-delimiter))) | 440 (make-glyph viper-replace-region-start-delimiter))) |
445 )) | 441 )) |
446 | 442 |
447 | 443 |
448 ;; These are local marker that must be initialized to nil and moved with | 444 ;; These are local marker that must be initialized to nil and moved with |
449 ;; `viper-move-marker-locally' | 445 ;; `viper-move-marker-locally' |
450 ;; | 446 ;; |
451 ;; Remember the last position inside the replace region. | 447 ;; Remember the last position inside the replace region. |
452 (viper-deflocalvar viper-last-posn-in-replace-region nil) | 448 (viper-deflocalvar viper-last-posn-in-replace-region nil) |
455 (put 'viper-last-posn-in-replace-region 'permanent-local t) | 451 (put 'viper-last-posn-in-replace-region 'permanent-local t) |
456 (put 'viper-last-posn-while-in-insert-state 'permanent-local t) | 452 (put 'viper-last-posn-while-in-insert-state 'permanent-local t) |
457 | 453 |
458 (viper-deflocalvar viper-sitting-in-replace nil "") | 454 (viper-deflocalvar viper-sitting-in-replace nil "") |
459 (put 'viper-sitting-in-replace 'permanent-local t) | 455 (put 'viper-sitting-in-replace 'permanent-local t) |
460 | 456 |
461 ;; Remember the number of characters that have to be deleted in replace | 457 ;; Remember the number of characters that have to be deleted in replace |
462 ;; mode to compensate for the inserted characters. | 458 ;; mode to compensate for the inserted characters. |
463 (viper-deflocalvar viper-replace-chars-to-delete 0 "") | 459 (viper-deflocalvar viper-replace-chars-to-delete 0 "") |
464 ;; This variable is used internally by the before/after changed functions to | 460 ;; This variable is used internally by the before/after changed functions to |
465 ;; determine how many chars were deleted by the change. This can't be | 461 ;; determine how many chars were deleted by the change. This can't be |
557 "*If t, don't move point when repeating previous command. | 553 "*If t, don't move point when repeating previous command. |
558 This is useful for doing repeated changes with the '.' key. | 554 This is useful for doing repeated changes with the '.' key. |
559 The user can change this to nil, if she likes when the cursor moves | 555 The user can change this to nil, if she likes when the cursor moves |
560 to a new place after repeating previous Vi command." | 556 to a new place after repeating previous Vi command." |
561 :type 'boolean | 557 :type 'boolean |
562 :group 'viper) | 558 :group 'viper) |
563 | 559 |
564 ;; Remember insert point as a marker. This is a local marker that must be | 560 ;; Remember insert point as a marker. This is a local marker that must be |
565 ;; initialized to nil and moved with `viper-move-marker-locally'. | 561 ;; initialized to nil and moved with `viper-move-marker-locally'. |
566 (viper-deflocalvar viper-insert-point nil) | 562 (viper-deflocalvar viper-insert-point nil) |
567 (put 'viper-insert-point 'permanent-local t) | 563 (put 'viper-insert-point 'permanent-local t) |
587 (viper-deflocalvar viper-pre-command-point nil) | 583 (viper-deflocalvar viper-pre-command-point nil) |
588 (put 'viper-pre-command-point 'permanent-local t) ; this is probably an overkill | 584 (put 'viper-pre-command-point 'permanent-local t) ; this is probably an overkill |
589 | 585 |
590 ;; This is used for saving inserted text. | 586 ;; This is used for saving inserted text. |
591 (defvar viper-last-insertion nil) | 587 (defvar viper-last-insertion nil) |
592 | 588 |
593 ;; Remembers the last replaced region. | 589 ;; Remembers the last replaced region. |
594 (defvar viper-last-replace-region "") | 590 (defvar viper-last-replace-region "") |
595 | 591 |
596 ;; Remember com point as a marker. | 592 ;; Remember com point as a marker. |
597 ;; This is a local marker. Should be moved with `viper-move-marker-locally' | 593 ;; This is a local marker. Should be moved with `viper-move-marker-locally' |
598 (viper-deflocalvar viper-com-point nil) | 594 (viper-deflocalvar viper-com-point nil) |
599 | 595 |
600 ;; If non-nil, the value is a list (M-COM VAL COM REG inserted-text cmd-keys) | 596 ;; If non-nil, the value is a list (M-COM VAL COM REG inserted-text cmd-keys) |
723 (defcustom viper-search-wrap-around-t t | 719 (defcustom viper-search-wrap-around-t t |
724 "*If t, search wraps around." | 720 "*If t, search wraps around." |
725 :type 'boolean | 721 :type 'boolean |
726 :tag "Search Wraps Around" | 722 :tag "Search Wraps Around" |
727 :group 'viper-search) | 723 :group 'viper-search) |
728 | 724 |
729 (viper-deflocalvar viper-related-files-and-buffers-ring nil "") | 725 (viper-deflocalvar viper-related-files-and-buffers-ring nil "") |
730 (defcustom viper-related-files-and-buffers-ring nil | 726 (defcustom viper-related-files-and-buffers-ring nil |
731 "*List of file and buffer names that are considered to be related to the current buffer. | 727 "*List of file and buffer names that are considered to be related to the current buffer. |
732 Related buffers can be cycled through via :R and :P commands." | 728 Related buffers can be cycled through via :R and :P commands." |
733 :type 'boolean | 729 :type 'boolean |
741 | 737 |
742 ;; the search overlay | 738 ;; the search overlay |
743 (viper-deflocalvar viper-search-overlay nil) | 739 (viper-deflocalvar viper-search-overlay nil) |
744 | 740 |
745 | 741 |
746 (defvar viper-heading-start | 742 (defvar viper-heading-start |
747 (concat "^\\s-*(\\s-*defun\\s-\\|" ; lisp | 743 (concat "^\\s-*(\\s-*defun\\s-\\|" ; lisp |
748 "^{\\s-*$\\|^[_a-zA-Z][^()]*[()].*{\\s-*$\\|" ; C/C++ | 744 "^{\\s-*$\\|^[_a-zA-Z][^()]*[()].*{\\s-*$\\|" ; C/C++ |
749 "^\\s-*class.*{\\|^\\s-*struct.*{\\|^\\s-*enum.*{\\|" | 745 "^\\s-*class.*{\\|^\\s-*struct.*{\\|^\\s-*enum.*{\\|" |
750 "^\\\\[sb][a-z]*{.*}\\s-*$\\|" ; latex | 746 "^\\\\[sb][a-z]*{.*}\\s-*$\\|" ; latex |
751 "^@node\\|@table\\|^@m?enu\\|^@itemize\\|^@if\\|" ; texinfo | 747 "^@node\\|@table\\|^@m?enu\\|^@itemize\\|^@if\\|" ; texinfo |
752 "^.+:-") ; prolog | 748 "^.+:-") ; prolog |
753 "*Regexps for Headings. Used by \[\[ and \]\].") | 749 "*Regexps for Headings. Used by \[\[ and \]\].") |
754 | 750 |
755 (defvar viper-heading-end | 751 (defvar viper-heading-end |
756 (concat "^}\\|" ; C/C++ | 752 (concat "^}\\|" ; C/C++ |
757 "^\\\\end{\\|" ; latex | 753 "^\\\\end{\\|" ; latex |
758 "^@end \\|" ; texinfo | 754 "^@end \\|" ; texinfo |
759 ")\n\n[ \t\n]*\\|" ; lisp | 755 ")\n\n[ \t\n]*\\|" ; lisp |
760 "\\.\\s-*$") ; prolog | 756 "\\.\\s-*$") ; prolog |
817 "Face used to flash out the search pattern. | 813 "Face used to flash out the search pattern. |
818 DO NOT CHANGE this variable. Instead, use the customization widget | 814 DO NOT CHANGE this variable. Instead, use the customization widget |
819 to customize the actual face object `viper-search-face' | 815 to customize the actual face object `viper-search-face' |
820 this variable represents.") | 816 this variable represents.") |
821 (viper-hide-face 'viper-search-face) | 817 (viper-hide-face 'viper-search-face) |
822 | 818 |
823 | 819 |
824 (defface viper-replace-overlay-face | 820 (defface viper-replace-overlay-face |
825 '((((class color)) (:foreground "Black" :background "darkseagreen2")) | 821 '((((class color)) (:foreground "Black" :background "darkseagreen2")) |
826 (t (:underline t :stipple "gray3"))) | 822 (t (:underline t :stipple "gray3"))) |
827 "*Face for highlighting replace regions on a window display." | 823 "*Face for highlighting replace regions on a window display." |
845 "Face used in the Minibuffer when it is in Emacs state. | 841 "Face used in the Minibuffer when it is in Emacs state. |
846 DO NOT CHANGE this variable. Instead, use the customization widget | 842 DO NOT CHANGE this variable. Instead, use the customization widget |
847 to customize the actual face object `viper-minibuffer-emacs-face' | 843 to customize the actual face object `viper-minibuffer-emacs-face' |
848 this variable represents.") | 844 this variable represents.") |
849 (viper-hide-face 'viper-minibuffer-emacs-face) | 845 (viper-hide-face 'viper-minibuffer-emacs-face) |
850 | 846 |
851 | 847 |
852 (defface viper-minibuffer-insert-face | 848 (defface viper-minibuffer-insert-face |
853 '((((class color)) (:foreground "Black" :background "pink")) | 849 '((((class color)) (:foreground "Black" :background "pink")) |
854 (t (:italic t))) | 850 (t (:italic t))) |
855 "Face used in the Minibuffer when it is in Insert state." | 851 "Face used in the Minibuffer when it is in Insert state." |
859 "Face used in the Minibuffer when it is in Insert state. | 855 "Face used in the Minibuffer when it is in Insert state. |
860 DO NOT CHANGE this variable. Instead, use the customization widget | 856 DO NOT CHANGE this variable. Instead, use the customization widget |
861 to customize the actual face object `viper-minibuffer-insert-face' | 857 to customize the actual face object `viper-minibuffer-insert-face' |
862 this variable represents.") | 858 this variable represents.") |
863 (viper-hide-face 'viper-minibuffer-insert-face) | 859 (viper-hide-face 'viper-minibuffer-insert-face) |
864 | 860 |
865 | 861 |
866 (defface viper-minibuffer-vi-face | 862 (defface viper-minibuffer-vi-face |
867 '((((class color)) (:foreground "DarkGreen" :background "grey")) | 863 '((((class color)) (:foreground "DarkGreen" :background "grey")) |
868 (t (:inverse-video t))) | 864 (t (:inverse-video t))) |
869 "Face used in the Minibuffer when it is in Vi state." | 865 "Face used in the Minibuffer when it is in Vi state." |
873 "Face used in the Minibuffer when it is in Vi state. | 869 "Face used in the Minibuffer when it is in Vi state. |
874 DO NOT CHANGE this variable. Instead, use the customization widget | 870 DO NOT CHANGE this variable. Instead, use the customization widget |
875 to customize the actual face object `viper-minibuffer-vi-face' | 871 to customize the actual face object `viper-minibuffer-vi-face' |
876 this variable represents.") | 872 this variable represents.") |
877 (viper-hide-face 'viper-minibuffer-vi-face) | 873 (viper-hide-face 'viper-minibuffer-vi-face) |
878 | 874 |
879 ;; the current face to be used in the minibuffer | 875 ;; the current face to be used in the minibuffer |
880 (viper-deflocalvar | 876 (viper-deflocalvar |
881 viper-minibuffer-current-face viper-minibuffer-emacs-face "") | 877 viper-minibuffer-current-face viper-minibuffer-emacs-face "") |
882 | 878 |
883 | 879 |
909 (defcustom viper-vi-style-in-minibuffer t | 905 (defcustom viper-vi-style-in-minibuffer t |
910 "If t, use vi-style editing in minibuffer. | 906 "If t, use vi-style editing in minibuffer. |
911 Should be set in `~/.viper' file." | 907 Should be set in `~/.viper' file." |
912 :type 'boolean | 908 :type 'boolean |
913 :group 'viper) | 909 :group 'viper) |
914 | 910 |
915 ;; overlay used in the minibuffer to indicate which state it is in | 911 ;; overlay used in the minibuffer to indicate which state it is in |
916 (viper-deflocalvar viper-minibuffer-overlay nil) | 912 (viper-deflocalvar viper-minibuffer-overlay nil) |
917 (put 'viper-minibuffer-overlay 'permanent-local t) | 913 (put 'viper-minibuffer-overlay 'permanent-local t) |
918 | 914 |
919 ;; Hook, specific to Viper, which is run just *before* exiting the minibuffer. | 915 ;; Hook, specific to Viper, which is run just *before* exiting the minibuffer. |
920 ;; This is needed because beginning with Emacs 19.26, the standard | 916 ;; This is needed because beginning with Emacs 19.26, the standard |
921 ;; `minibuffer-exit-hook' is run *after* exiting the minibuffer | 917 ;; `minibuffer-exit-hook' is run *after* exiting the minibuffer |
922 (defvar viper-minibuffer-exit-hook nil) | 918 (defvar viper-minibuffer-exit-hook nil) |
923 | 919 |
924 | 920 |
925 ;; Mode line | 921 ;; Mode line |
926 (defconst viper-vi-state-id "<V> " | 922 (defconst viper-vi-state-id "<V> " |
927 "Mode line tag identifying the Vi mode of Viper.") | 923 "Mode line tag identifying the Vi mode of Viper.") |
928 (defconst viper-emacs-state-id "<E> " | 924 (defconst viper-emacs-state-id "<E> " |
952 :group 'viper-hooks) | 948 :group 'viper-hooks) |
953 (defcustom viper-emacs-state-hook nil | 949 (defcustom viper-emacs-state-hook nil |
954 "*Hooks run just before the switch to Emacs mode is completed." | 950 "*Hooks run just before the switch to Emacs mode is completed." |
955 :type 'hook | 951 :type 'hook |
956 :group 'viper-hooks) | 952 :group 'viper-hooks) |
957 | 953 |
958 (defcustom viper-load-hook nil | 954 (defcustom viper-load-hook nil |
959 "Hooks run just after loading Viper." | 955 "Hooks run just after loading Viper." |
960 :type 'hook | 956 :type 'hook |
961 :group 'viper-hooks) | 957 :group 'viper-hooks) |
962 | 958 |
963 | 959 |
964 ;;; Local Variables: | 960 ;;; Local Variables: |
965 ;;; eval: (put 'viper-deflocalvar 'lisp-indent-hook 'defun) | 961 ;;; eval: (put 'viper-deflocalvar 'lisp-indent-hook 'defun) |
966 ;;; End: | 962 ;;; End: |
967 | 963 |