aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/emulation
diff options
context:
space:
mode:
authorMiles Bader2005-08-26 09:51:52 +0000
committerMiles Bader2005-08-26 09:51:52 +0000
commitd4cccb140682cfa548a8658f905764ceb4a38cb2 (patch)
tree5230af18ee25b37efed50fa38cac1eefb47d03fc /lisp/emulation
parent5e10f34207ff594cd6570928bc0292a7b53297b8 (diff)
parentf3f01d5df3156fb408b43da0c670796c37ed084f (diff)
downloademacs-d4cccb140682cfa548a8658f905764ceb4a38cb2.tar.gz
emacs-d4cccb140682cfa548a8658f905764ceb4a38cb2.zip
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-78
Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 514-518) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 104-105) - Update from CVS
Diffstat (limited to 'lisp/emulation')
-rw-r--r--lisp/emulation/cua-base.el17
-rw-r--r--lisp/emulation/viper-cmd.el28
-rw-r--r--lisp/emulation/viper-init.el7
-rw-r--r--lisp/emulation/viper-util.el2
-rw-r--r--lisp/emulation/viper.el51
5 files changed, 72 insertions, 33 deletions
diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el
index beb30d500d4..0e60e60b4c4 100644
--- a/lisp/emulation/cua-base.el
+++ b/lisp/emulation/cua-base.el
@@ -575,6 +575,7 @@ a cons (TYPE . COLOR), then both properties are affected."
575 575
576;; Current region was started using cua-set-mark. 576;; Current region was started using cua-set-mark.
577(defvar cua--explicit-region-start nil) 577(defvar cua--explicit-region-start nil)
578(make-variable-buffer-local 'cua--explicit-region-start)
578 579
579;; Latest region was started using shifted movement command. 580;; Latest region was started using shifted movement command.
580(defvar cua--last-region-shifted nil) 581(defvar cua--last-region-shifted nil)
@@ -585,6 +586,7 @@ a cons (TYPE . COLOR), then both properties are affected."
585 586
586;; status string for mode line indications 587;; status string for mode line indications
587(defvar cua--status-string nil) 588(defvar cua--status-string nil)
589(make-variable-buffer-local 'cua--status-string)
588 590
589(defvar cua--debug nil) 591(defvar cua--debug nil)
590 592
@@ -759,14 +761,19 @@ Save a copy in register 0 if `cua-delete-copy-to-register-0' is non-nil."
759 (cons (current-buffer) 761 (cons (current-buffer)
760 (and (consp buffer-undo-list) 762 (and (consp buffer-undo-list)
761 (car buffer-undo-list)))) 763 (car buffer-undo-list))))
762 (cua--deactivate))) 764 (cua--deactivate)
765 (/= start end)))
763 766
764(defun cua-replace-region () 767(defun cua-replace-region ()
765 "Replace the active region with the character you type." 768 "Replace the active region with the character you type."
766 (interactive) 769 (interactive)
767 (cua-delete-region) 770 (let ((not-empty (cua-delete-region)))
768 (unless (eq this-original-command this-command) 771 (unless (eq this-original-command this-command)
769 (cua--fallback))) 772 (let ((overwrite-mode
773 (and overwrite-mode
774 not-empty
775 (not (eq this-original-command 'self-insert-command)))))
776 (cua--fallback)))))
770 777
771(defun cua-copy-region (arg) 778(defun cua-copy-region (arg)
772 "Copy the region to the kill ring. 779 "Copy the region to the kill ring.
@@ -1359,8 +1366,6 @@ the prefix fallback behavior."
1359 :link '(emacs-commentary-link "cua-base.el") 1366 :link '(emacs-commentary-link "cua-base.el")
1360 (setq mark-even-if-inactive t) 1367 (setq mark-even-if-inactive t)
1361 (setq highlight-nonselected-windows nil) 1368 (setq highlight-nonselected-windows nil)
1362 (make-variable-buffer-local 'cua--explicit-region-start)
1363 (make-variable-buffer-local 'cua--status-string)
1364 1369
1365 (unless cua--keymaps-initalized 1370 (unless cua--keymaps-initalized
1366 (cua--init-keymaps) 1371 (cua--init-keymaps)
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el
index ce8b61fd022..99a130e7f1d 100644
--- a/lisp/emulation/viper-cmd.el
+++ b/lisp/emulation/viper-cmd.el
@@ -942,8 +942,10 @@ Suffixes such as .el or .elc should be stripped."
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
@@ -1421,7 +1423,8 @@ as a Meta key and any number of multiple escapes is allowed."
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
@@ -1447,7 +1450,8 @@ as a Meta key and any number of multiple escapes is allowed."
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)))
@@ -1472,7 +1476,8 @@ as a Meta key and any number of multiple escapes is allowed."
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
@@ -1496,7 +1501,8 @@ as a Meta key and any number of multiple escapes is allowed."
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
@@ -4020,8 +4026,9 @@ Null string will repeat previous search."
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
@@ -4062,8 +4069,9 @@ Null string will repeat previous search."
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
diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el
index 3c984a3596e..9c1df1b0ad5 100644
--- a/lisp/emulation/viper-init.el
+++ b/lisp/emulation/viper-init.el
@@ -424,13 +424,20 @@ delete the text being replaced, as in standard Vi."
424 "*Cursor color when Viper is in Replace state." 424 "*Cursor color when Viper is in Replace state."
425 :type 'string 425 :type 'string
426 :group 'viper) 426 :group 'viper)
427(if (fboundp 'make-variable-frame-local)
428 (make-variable-frame-local 'viper-replace-overlay-cursor-color))
429
427(defcustom viper-insert-state-cursor-color "Green" 430(defcustom viper-insert-state-cursor-color "Green"
428 "Cursor color when Viper is in insert state." 431 "Cursor color when Viper is in insert state."
429 :type 'string 432 :type 'string
430 :group 'viper) 433 :group 'viper)
434(if (fboundp 'make-variable-frame-local)
435 (make-variable-frame-local 'viper-insert-state-cursor-color))
431 436
432;; internal var, used to remember the default cursor color of emacs frames 437;; internal var, used to remember the default cursor color of emacs frames
433(defvar viper-vi-state-cursor-color nil) 438(defvar viper-vi-state-cursor-color nil)
439(if (fboundp 'make-variable-frame-local)
440 (make-variable-frame-local 'viper-vi-state-cursor-color))
434 441
435(viper-deflocalvar viper-replace-overlay nil "") 442(viper-deflocalvar viper-replace-overlay nil "")
436(put 'viper-replace-overlay 'permanent-local t) 443(put 'viper-replace-overlay 'permanent-local t)
diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el
index 5bd67e1735f..cc9f42b9800 100644
--- a/lisp/emulation/viper-util.el
+++ b/lisp/emulation/viper-util.el
@@ -360,7 +360,7 @@
360 (setq lis2 (delq elt lis2))) 360 (setq lis2 (delq elt lis2)))
361 (setq temp (cdr temp))) 361 (setq temp (cdr temp)))
362 362
363 (nconc lis1 lis2))) 363 (append lis1 lis2)))
364 364
365 365
366 366
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el
index edc1fb1e9de..bfa730cc434 100644
--- a/lisp/emulation/viper.el
+++ b/lisp/emulation/viper.el
@@ -9,7 +9,7 @@
9;; Author: Michael Kifer <kifer@cs.stonybrook.edu> 9;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
10;; Keywords: emulations 10;; Keywords: emulations
11 11
12(defconst viper-version "3.11.5 of July 8, 2005" 12(defconst viper-version "3.11.5 of August 6, 2005"
13 "The current version of Viper") 13 "The current version of Viper")
14 14
15;; This file is part of GNU Emacs. 15;; This file is part of GNU Emacs.
@@ -372,7 +372,6 @@ widget."
372(defcustom viper-vi-state-mode-list 372(defcustom viper-vi-state-mode-list
373 '(fundamental-mode 373 '(fundamental-mode
374 makefile-mode 374 makefile-mode
375 help-mode
376 375
377 awk-mode 376 awk-mode
378 m4-mode 377 m4-mode
@@ -398,7 +397,7 @@ widget."
398 tex-mode latex-mode bibtex-mode 397 tex-mode latex-mode bibtex-mode
399 ps-mode 398 ps-mode
400 399
401 completion-list-mode 400 ;; completion-list-mode
402 diff-mode 401 diff-mode
403 idl-mode 402 idl-mode
404 403
@@ -426,6 +425,7 @@ widget."
426 425
427 browse-kill-ring-mode 426 browse-kill-ring-mode
428 recentf-mode 427 recentf-mode
428 recentf-dialog-mode
429 occur-mode 429 occur-mode
430 430
431 mh-folder-mode 431 mh-folder-mode
@@ -433,6 +433,9 @@ widget."
433 gnus-group-mode 433 gnus-group-mode
434 gnus-summary-mode 434 gnus-summary-mode
435 435
436 completion-list-mode
437 help-mode
438
436 Info-mode 439 Info-mode
437 Buffer-menu-mode 440 Buffer-menu-mode
438 compilation-mode 441 compilation-mode
@@ -523,7 +526,7 @@ If Viper is enabled, turn it off. Otherwise, turn it on."
523 526
524;;;###autoload 527;;;###autoload
525(defun viper-mode () 528(defun viper-mode ()
526 "Turn on Viper emulation of Vi." 529 "Turn on Viper emulation of Vi in Emacs. See Info node `(viper)Viper'."
527 (interactive) 530 (interactive)
528 (if (not noninteractive) 531 (if (not noninteractive)
529 (progn 532 (progn
@@ -656,8 +659,7 @@ This function tries to do as good a job as possible. However, it may undo some
656user customization, unrelated to Viper. For instance, if the user advised 659user customization, unrelated to Viper. For instance, if the user advised
657`read-file-name', `describe-key', and some others, then this advice will be 660`read-file-name', `describe-key', and some others, then this advice will be
658undone. 661undone.
659It also doesn't undo some Viper settings. For instance, `minor-mode-map-alist' 662It also can't undo some Viper settings."
660remains buffer-local."
661 (interactive) 663 (interactive)
662 664
663 ;; restore non-viper vars 665 ;; restore non-viper vars
@@ -683,7 +685,9 @@ remains buffer-local."
683 'mark-even-if-inactive viper-saved-non-viper-variables))) 685 'mark-even-if-inactive viper-saved-non-viper-variables)))
684 686
685 ;; Ideally, we would like to be able to de-localize local variables 687 ;; Ideally, we would like to be able to de-localize local variables
686 (viper-delocalize-var 'minor-mode-map-alist) 688 (unless
689 (and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists))
690 (viper-delocalize-var 'minor-mode-map-alist))
687 (viper-delocalize-var 'require-final-newline) 691 (viper-delocalize-var 'require-final-newline)
688 (if viper-xemacs-p (viper-delocalize-var 'bar-cursor)) 692 (if viper-xemacs-p (viper-delocalize-var 'bar-cursor))
689 693
@@ -889,6 +893,14 @@ remains buffer-local."
889 ad-do-it 893 ad-do-it
890 )) 894 ))
891 895
896 (defadvice set-cursor-color (after viper-set-cursor-color-ad activate)
897 "Change cursor color in VI state."
898 ;;(setq viper-vi-state-cursor-color (ad-get-arg 0))
899 (modify-frame-parameters
900 (selected-frame)
901 (list (cons 'viper-vi-state-cursor-color (ad-get-arg 0))))
902 )
903
892 (when (and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists)) 904 (when (and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists))
893 ;; needs to be as early as possible 905 ;; needs to be as early as possible
894 (add-to-ordered-list 906 (add-to-ordered-list
@@ -993,7 +1005,10 @@ remains buffer-local."
993 ;; viper-vi-local-user-map, viper-insert-local-user-map, and others can have 1005 ;; viper-vi-local-user-map, viper-insert-local-user-map, and others can have
994 ;; different keymaps for different buffers. Also, the keymaps associated 1006 ;; different keymaps for different buffers. Also, the keymaps associated
995 ;; with viper-vi/insert-state-modifier-minor-mode can be different. 1007 ;; with viper-vi/insert-state-modifier-minor-mode can be different.
996 (make-variable-buffer-local 'minor-mode-map-alist) 1008 ;; ***This is needed only in case emulation-mode-map-alists is not defined
1009 (unless
1010 (and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists))
1011 (make-variable-buffer-local 'minor-mode-map-alist))
997 1012
998 ;; Viper changes the default mode-line-buffer-identification 1013 ;; Viper changes the default mode-line-buffer-identification
999 (setq-default mode-line-buffer-identification '(" %b")) 1014 (setq-default mode-line-buffer-identification '(" %b"))
@@ -1088,9 +1103,11 @@ remains buffer-local."
1088 viper-advice-add-minor-mode 1103 viper-advice-add-minor-mode
1089 (toggle name &optional keymap after toggle-fun) 1104 (toggle name &optional keymap after toggle-fun)
1090 activate) 1105 activate)
1091 "Run viper-normalize-minor-mode-map-alist after adding a minor mode." 1106 "Run viper-normalize-minor-mode-map-alist after adding a minor mode."
1092 (viper-normalize-minor-mode-map-alist) 1107 (viper-normalize-minor-mode-map-alist)
1093 (setq-default minor-mode-map-alist minor-mode-map-alist)) 1108 (unless
1109 (and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists))
1110 (setq-default minor-mode-map-alist minor-mode-map-alist)))
1094 1111
1095 ;; catch frame switching event 1112 ;; catch frame switching event
1096 (if (viper-window-display-p) 1113 (if (viper-window-display-p)
@@ -1264,11 +1281,10 @@ These two lines must come in the order given.
1264(define-key 1281(define-key
1265 viper-emacs-intercept-map viper-toggle-key 'viper-change-state-to-vi) 1282 viper-emacs-intercept-map viper-toggle-key 'viper-change-state-to-vi)
1266 1283
1284;;; Removed to avoid bad interaction with cua-mode.
1267;;; Escape from Emacs and Insert modes to Vi for one command 1285;;; Escape from Emacs and Insert modes to Vi for one command
1268(define-key 1286;;(define-key viper-emacs-intercept-map "\C-c\\" 'viper-escape-to-vi)
1269 viper-emacs-intercept-map "\C-c\\" 'viper-escape-to-vi) 1287;;(define-key viper-insert-intercept-map "\C-c\\" 'viper-escape-to-vi)
1270(define-key
1271 viper-insert-intercept-map "\C-c\\" 'viper-escape-to-vi)
1272 1288
1273(if viper-mode 1289(if viper-mode
1274 (setq-default viper-emacs-intercept-minor-mode t 1290 (setq-default viper-emacs-intercept-minor-mode t
@@ -1296,7 +1312,10 @@ These two lines must come in the order given.
1296(if (and viper-mode (eq viper-current-state 'emacs-state)) 1312(if (and viper-mode (eq viper-current-state 'emacs-state))
1297 (progn 1313 (progn
1298 (viper-change-state-to-emacs) 1314 (viper-change-state-to-emacs)
1299 (setq-default minor-mode-map-alist minor-mode-map-alist) 1315 (unless
1316 (and (fboundp 'add-to-ordered-list)
1317 (boundp 'emulation-mode-map-alists))
1318 (setq-default minor-mode-map-alist minor-mode-map-alist))
1300 )) 1319 ))
1301 1320
1302(if (and viper-mode (this-major-mode-requires-vi-state major-mode)) 1321(if (and viper-mode (this-major-mode-requires-vi-state major-mode))