Mercurial > emacs
comparison lisp/emulation/viper-cmd.el @ 64750:fbdb9482b6fc
2005-08-06 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-harness-minor-mode,viper-exec-delete,
viper-exec-yank,viper-put-back): don't display modification msg if in
the minibuffer.
* viper-init.el (viper-replace-overlay-cursor-color,
viper-insert-state-cursor-color,viper-vi-state-cursor-color): make
variables frame local.
* viper-util.el (viper-append-filter-alist): use append instead of
nconc.
* viper.el (viper-vi-state-mode-list,viper-emacs-state-mode-list): move
help-mode and completion-list-mode from the first list to the second.
(viper-mode): docstring.
(viper-go-away,viper-non-hook-settings): don't localize
minor-mode-alist in newer emacsen.
Add advice to set-cursor-color.
Don't bind "\C-c\\".
author | Michael Kifer <kifer@cs.stonybrook.edu> |
---|---|
date | Sat, 06 Aug 2005 16:58:54 +0000 |
parents | 34bd8e434dd7 |
children | 511f8e9d22ca 2d92f5c9d6ae |
comparison
equal
deleted
inserted
replaced
64749:5e716228ee1e | 64750:fbdb9482b6fc |
---|---|
940 | 940 |
941 (eval-after-load load-file '(viper-normalize-minor-mode-map-alist)) | 941 (eval-after-load load-file '(viper-normalize-minor-mode-map-alist)) |
942 | 942 |
943 ;; Change the default for minor-mode-map-alist each time a harnessed minor | 943 ;; Change the default for minor-mode-map-alist each time a harnessed minor |
944 ;; mode adds its own keymap to the a-list. | 944 ;; mode adds its own keymap to the a-list. |
945 (eval-after-load | 945 (unless |
946 load-file '(setq-default minor-mode-map-alist minor-mode-map-alist)) | 946 (and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists)) |
947 (eval-after-load | |
948 load-file '(setq-default minor-mode-map-alist minor-mode-map-alist))) | |
947 ) | 949 ) |
948 | 950 |
949 | 951 |
950 (defun viper-ESC (arg) | 952 (defun viper-ESC (arg) |
951 "Emulate ESC key in Emacs. | 953 "Emulate ESC key in Emacs. |
1419 (setq viper-use-register nil))) | 1421 (setq viper-use-register nil))) |
1420 (setq last-command | 1422 (setq last-command |
1421 (if (eq last-command 'd-command) 'kill-region nil)) | 1423 (if (eq last-command 'd-command) 'kill-region nil)) |
1422 (setq chars-deleted (abs (- (point) viper-com-point))) | 1424 (setq chars-deleted (abs (- (point) viper-com-point))) |
1423 (if (> chars-deleted viper-change-notification-threshold) | 1425 (if (> chars-deleted viper-change-notification-threshold) |
1424 (message "Deleted %d characters" chars-deleted)) | 1426 (unless (viper-is-in-minibuffer) |
1427 (message "Deleted %d characters" chars-deleted))) | |
1425 (kill-region viper-com-point (point)) | 1428 (kill-region viper-com-point (point)) |
1426 (setq this-command 'd-command) | 1429 (setq this-command 'd-command) |
1427 (if viper-ex-style-motion | 1430 (if viper-ex-style-motion |
1428 (if (and (eolp) (not (bolp))) (backward-char 1))))) | 1431 (if (and (eolp) (not (bolp))) (backward-char 1))))) |
1429 | 1432 |
1445 (setq viper-use-register nil))) | 1448 (setq viper-use-register nil))) |
1446 (setq last-command | 1449 (setq last-command |
1447 (if (eq last-command 'D-command) 'kill-region nil)) | 1450 (if (eq last-command 'D-command) 'kill-region nil)) |
1448 (setq lines-deleted (count-lines (point) viper-com-point)) | 1451 (setq lines-deleted (count-lines (point) viper-com-point)) |
1449 (if (> lines-deleted viper-change-notification-threshold) | 1452 (if (> lines-deleted viper-change-notification-threshold) |
1450 (message "Deleted %d lines" lines-deleted)) | 1453 (unless (viper-is-in-minibuffer) |
1454 (message "Deleted %d lines" lines-deleted))) | |
1451 (kill-region (mark t) (point)) | 1455 (kill-region (mark t) (point)) |
1452 (if (eq m-com 'viper-line) (setq this-command 'D-command))) | 1456 (if (eq m-com 'viper-line) (setq this-command 'D-command))) |
1453 (back-to-indentation))) | 1457 (back-to-indentation))) |
1454 | 1458 |
1455 ;; save region | 1459 ;; save region |
1470 (setq viper-use-register nil))) | 1474 (setq viper-use-register nil))) |
1471 (setq last-command nil) | 1475 (setq last-command nil) |
1472 (copy-region-as-kill viper-com-point (point)) | 1476 (copy-region-as-kill viper-com-point (point)) |
1473 (setq chars-saved (abs (- (point) viper-com-point))) | 1477 (setq chars-saved (abs (- (point) viper-com-point))) |
1474 (if (> chars-saved viper-change-notification-threshold) | 1478 (if (> chars-saved viper-change-notification-threshold) |
1475 (message "Saved %d characters" chars-saved)) | 1479 (unless (viper-is-in-minibuffer) |
1480 (message "Saved %d characters" chars-saved))) | |
1476 (goto-char viper-com-point))) | 1481 (goto-char viper-com-point))) |
1477 | 1482 |
1478 ;; save lines | 1483 ;; save lines |
1479 (defun viper-exec-Yank (m-com com) | 1484 (defun viper-exec-Yank (m-com com) |
1480 (save-excursion | 1485 (save-excursion |
1494 (setq viper-use-register nil))) | 1499 (setq viper-use-register nil))) |
1495 (setq last-command nil) | 1500 (setq last-command nil) |
1496 (copy-region-as-kill (mark t) (point)) | 1501 (copy-region-as-kill (mark t) (point)) |
1497 (setq lines-saved (count-lines (mark t) (point))) | 1502 (setq lines-saved (count-lines (mark t) (point))) |
1498 (if (> lines-saved viper-change-notification-threshold) | 1503 (if (> lines-saved viper-change-notification-threshold) |
1499 (message "Saved %d lines" lines-saved)))) | 1504 (unless (viper-is-in-minibuffer) |
1505 (message "Saved %d lines" lines-saved))))) | |
1500 (viper-deactivate-mark) | 1506 (viper-deactivate-mark) |
1501 (goto-char viper-com-point)) | 1507 (goto-char viper-com-point)) |
1502 | 1508 |
1503 (defun viper-exec-bang (m-com com) | 1509 (defun viper-exec-bang (m-com com) |
1504 (save-excursion | 1510 (save-excursion |
4018 (viper-loop val (viper-yank text)) | 4024 (viper-loop val (viper-yank text)) |
4019 (setq chars-inserted (abs (- (point) sv-point)) | 4025 (setq chars-inserted (abs (- (point) sv-point)) |
4020 lines-inserted (abs (count-lines (point) sv-point))) | 4026 lines-inserted (abs (count-lines (point) sv-point))) |
4021 (if (or (> chars-inserted viper-change-notification-threshold) | 4027 (if (or (> chars-inserted viper-change-notification-threshold) |
4022 (> lines-inserted viper-change-notification-threshold)) | 4028 (> lines-inserted viper-change-notification-threshold)) |
4023 (message "Inserted %d character(s), %d line(s)" | 4029 (unless (viper-is-in-minibuffer) |
4024 chars-inserted lines-inserted))) | 4030 (message "Inserted %d character(s), %d line(s)" |
4031 chars-inserted lines-inserted)))) | |
4025 ;; Vi puts cursor on the last char when the yanked text doesn't contain a | 4032 ;; Vi puts cursor on the last char when the yanked text doesn't contain a |
4026 ;; newline; it leaves the cursor at the beginning when the text contains | 4033 ;; newline; it leaves the cursor at the beginning when the text contains |
4027 ;; a newline | 4034 ;; a newline |
4028 (if (viper-same-line (point) (mark)) | 4035 (if (viper-same-line (point) (mark)) |
4029 (or (= (point) (mark)) (viper-backward-char-carefully)) | 4036 (or (= (point) (mark)) (viper-backward-char-carefully)) |
4060 (viper-loop val (viper-yank text)) | 4067 (viper-loop val (viper-yank text)) |
4061 (setq chars-inserted (abs (- (point) sv-point)) | 4068 (setq chars-inserted (abs (- (point) sv-point)) |
4062 lines-inserted (abs (count-lines (point) sv-point))) | 4069 lines-inserted (abs (count-lines (point) sv-point))) |
4063 (if (or (> chars-inserted viper-change-notification-threshold) | 4070 (if (or (> chars-inserted viper-change-notification-threshold) |
4064 (> lines-inserted viper-change-notification-threshold)) | 4071 (> lines-inserted viper-change-notification-threshold)) |
4065 (message "Inserted %d character(s), %d line(s)" | 4072 (unless (viper-is-in-minibuffer) |
4066 chars-inserted lines-inserted))) | 4073 (message "Inserted %d character(s), %d line(s)" |
4074 chars-inserted lines-inserted)))) | |
4067 ;; Vi puts cursor on the last char when the yanked text doesn't contain a | 4075 ;; Vi puts cursor on the last char when the yanked text doesn't contain a |
4068 ;; newline; it leaves the cursor at the beginning when the text contains | 4076 ;; newline; it leaves the cursor at the beginning when the text contains |
4069 ;; a newline | 4077 ;; a newline |
4070 (if (viper-same-line (point) (mark)) | 4078 (if (viper-same-line (point) (mark)) |
4071 (or (= (point) (mark)) (viper-backward-char-carefully)) | 4079 (or (= (point) (mark)) (viper-backward-char-carefully)) |