diff options
Diffstat (limited to 'lisp/emulation')
-rw-r--r-- | lisp/emulation/cua-base.el | 15 | ||||
-rw-r--r-- | lisp/emulation/tpu-edt.el | 321 | ||||
-rw-r--r-- | lisp/emulation/tpu-mapper.el | 6 | ||||
-rw-r--r-- | lisp/emulation/viper-cmd.el | 10 | ||||
-rw-r--r-- | lisp/emulation/viper-init.el | 15 | ||||
-rw-r--r-- | lisp/emulation/viper-keym.el | 4 | ||||
-rw-r--r-- | lisp/emulation/viper-util.el | 6 | ||||
-rw-r--r-- | lisp/emulation/viper.el | 104 |
8 files changed, 226 insertions, 255 deletions
diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el index 9b18bb69d2e..d0ec55781e7 100644 --- a/lisp/emulation/cua-base.el +++ b/lisp/emulation/cua-base.el @@ -898,9 +898,6 @@ If global mark is active, copy from register or one character." (t ;; Must save register here, since delete may override reg 0. (if mark-active - ;; Before a yank command, make sure we don't yank - ;; the same region that we are going to delete. - ;; That would make yank a no-op. (if cua--rectangle (progn (goto-char (min (mark) (point))) @@ -908,8 +905,16 @@ If global mark is active, copy from register or one character." (setq paste-lines (cua--delete-rectangle)) (if (= paste-lines 1) (setq paste-lines nil))) ;; paste all - (if (string= (filter-buffer-substring (point) (mark)) - (car kill-ring)) + ;; Before a yank command, make sure we don't yank the + ;; head of the kill-ring that really comes from the + ;; currently active region we are going to delete + ;; (when last-command is one that uses copy-region-as-kill + ;; or kill-new). That would make yank a no-op. + (if (and (string= (filter-buffer-substring (point) (mark)) + (car kill-ring)) + (memq last-command + '(mouse-set-region mouse-drag-region + mouse-save-then-kill mouse-secondary-save-then-kill))) (current-kill 1)) (cua-delete-region))) (cond diff --git a/lisp/emulation/tpu-edt.el b/lisp/emulation/tpu-edt.el index f164fb8eb29..f1cdc0ca864 100644 --- a/lisp/emulation/tpu-edt.el +++ b/lisp/emulation/tpu-edt.el @@ -207,16 +207,16 @@ ;; ; The emacs universal-argument function is very useful. ;; ; This line maps universal-argument to Gold-PF1. -;; (define-key GOLD-SS3-map "P" 'universal-argument) ; Gold-PF1 +;; (define-key tpu-gold-map [kp_f1] 'universal-argument) ; Gold-PF1 ;; ; Make KP7 move by paragraphs, instead of pages. -;; (define-key SS3-map "w" 'tpu-paragraph) ; KP7 +;; (define-key tpu-global-map [kf_7] 'tpu-paragraph) ; KP7 ;; ; Repeat the preceding mappings for X-windows. ;; (cond ;; (window-system -;; (global-set-key [kp_7] 'tpu-paragraph) ; KP7 -;; (define-key GOLD-map [kp_f1] 'universal-argument))) ; GOLD-PF1 +;; (define-key tpu-global-map [kp_7] 'tpu-paragraph) ; KP7 +;; (define-key tpu-gold-map [kp_f1] 'universal-argument))) ; GOLD-PF1 ;; ; Display the TPU-edt version. ;; (tpu-version) @@ -292,146 +292,88 @@ ;;; User Configurable Variables ;;; (defcustom tpu-have-ispell t - "*If non-nil (default), TPU-edt uses ispell for spell checking." + "If non-nil (default), TPU-edt uses ispell for spell checking." :type 'boolean :group 'tpu) (defcustom tpu-kill-buffers-silently nil - "*If non-nil, TPU-edt kills modified buffers without asking." + "If non-nil, TPU-edt kills modified buffers without asking." :type 'boolean :group 'tpu) (defcustom tpu-percent-scroll 75 - "*Percentage of the screen to scroll for next/previous screen commands." + "Percentage of the screen to scroll for next/previous screen commands." :type 'integer :group 'tpu) (defcustom tpu-pan-columns 16 - "*Number of columns the tpu-pan functions scroll left or right." + "Number of columns the tpu-pan functions scroll left or right." :type 'integer :group 'tpu) ;;; -;;; Emacs version identifiers - currently referenced by -;;; -;;; o tpu-mark o tpu-set-mark -;;; o mode line section o tpu-load-xkeys -;;; -(defconst tpu-lucid-emacs-p - (string-match "Lucid" emacs-version) - "Non-nil if we are running Lucid Emacs.") - -;;; ;;; Global Keymaps ;;; -(defvar CSI-map - (let ((map (make-sparse-keymap))) - (define-key map "A" 'tpu-previous-line) ; up - (define-key map "B" 'tpu-next-line) ; down - (define-key map "D" 'tpu-backward-char) ; left - (define-key map "C" 'tpu-forward-char) ; right - - (define-key map "1~" 'tpu-search) ; Find - (define-key map "2~" 'tpu-paste) ; Insert Here - (define-key map "3~" 'tpu-cut) ; Remove - (define-key map "4~" 'tpu-select) ; Select - (define-key map "5~" 'tpu-scroll-window-down) ; Prev Screen - (define-key map "6~" 'tpu-scroll-window-up) ; Next Screen - - (define-key map "11~" 'nil) ; F1 - (define-key map "12~" 'nil) ; F2 - (define-key map "13~" 'nil) ; F3 - (define-key map "14~" 'nil) ; F4 - (define-key map "15~" 'nil) ; F5 - (define-key map "17~" 'nil) ; F6 - (define-key map "18~" 'nil) ; F7 - (define-key map "19~" 'nil) ; F8 - (define-key map "20~" 'nil) ; F9 - (define-key map "21~" 'tpu-exit) ; F10 - (define-key map "23~" 'tpu-insert-escape) ; F11 (ESC) - (define-key map "24~" 'tpu-next-beginning-of-line) ; F12 (BS) - (define-key map "25~" 'tpu-delete-previous-word) ; F13 (LF) - (define-key map "26~" 'tpu-toggle-overwrite-mode) ; F14 - (define-key map "28~" 'tpu-help) ; HELP - (define-key map "29~" 'execute-extended-command) ; DO - (define-key map "31~" 'tpu-goto-breadcrumb) ; F17 - (define-key map "32~" 'nil) ; F18 - (define-key map "33~" 'nil) ; F19 - (define-key map "34~" 'nil) ; F20 - map) - "Maps the CSI function keys on the VT100 keyboard. -CSI is DEC's name for the sequence <ESC>[.") -(defvar GOLD-CSI-map - (let ((map (make-sparse-keymap))) - (define-key map "A" 'tpu-move-to-beginning) ; up-arrow - (define-key map "B" 'tpu-move-to-end) ; down-arrow - (define-key map "C" 'end-of-line) ; right-arrow - (define-key map "D" 'beginning-of-line) ; left-arrow - - (define-key map "1~" 'nil) ; Find - (define-key map "2~" 'nil) ; Insert Here - (define-key map "3~" 'tpu-store-text) ; Remove - (define-key map "4~" 'tpu-unselect) ; Select - (define-key map "5~" 'tpu-previous-window) ; Prev Screen - (define-key map "6~" 'tpu-next-window) ; Next Screen - - (define-key map "11~" 'nil) ; F1 - (define-key map "12~" 'nil) ; F2 - (define-key map "13~" 'nil) ; F3 - (define-key map "14~" 'nil) ; F4 - (define-key map "16~" 'nil) ; F5 - (define-key map "17~" 'nil) ; F6 - (define-key map "18~" 'nil) ; F7 - (define-key map "19~" 'nil) ; F8 - (define-key map "20~" 'nil) ; F9 - (define-key map "21~" 'nil) ; F10 - (define-key map "23~" 'nil) ; F11 - (define-key map "24~" 'nil) ; F12 - (define-key map "25~" 'nil) ; F13 - (define-key map "26~" 'nil) ; F14 - (define-key map "28~" 'describe-bindings) ; HELP - (define-key map "29~" 'nil) ; DO - (define-key map "31~" 'tpu-drop-breadcrumb) ; F17 - (define-key map "32~" 'nil) ; F18 - (define-key map "33~" 'nil) ; F19 - (define-key map "34~" 'nil) ; F20 - map) - "Maps the function keys on the VT100 keyboard preceded by GOLD-CSI.") - -(defvar GOLD-SS3-map - (let ((map (make-sparse-keymap))) - (define-key map "A" 'tpu-move-to-beginning) ; up-arrow - (define-key map "B" 'tpu-move-to-end) ; down-arrow - (define-key map "C" 'end-of-line) ; right-arrow - (define-key map "D" 'beginning-of-line) ; left-arrow - - (define-key map "P" 'keyboard-quit) ; PF1 - (define-key map "Q" 'help-for-help) ; PF2 - (define-key map "R" 'tpu-search) ; PF3 - (define-key map "S" 'tpu-undelete-lines) ; PF4 - (define-key map "p" 'open-line) ; KP0 - (define-key map "q" 'tpu-change-case) ; KP1 - (define-key map "r" 'tpu-delete-to-eol) ; KP2 - (define-key map "s" 'tpu-special-insert) ; KP3 - (define-key map "t" 'tpu-move-to-end) ; KP4 - (define-key map "u" 'tpu-move-to-beginning) ; KP5 - (define-key map "v" 'tpu-paste) ; KP6 - (define-key map "w" 'execute-extended-command) ; KP7 - (define-key map "x" 'tpu-fill) ; KP8 - (define-key map "y" 'tpu-replace) ; KP9 - (define-key map "m" 'tpu-undelete-words) ; KP- - (define-key map "l" 'tpu-undelete-char) ; KP, - (define-key map "n" 'tpu-unselect) ; KP. - (define-key map "M" 'tpu-substitute) ; KPenter - map) - "Maps the function keys on the VT100 keyboard preceded by GOLD-SS3.") - -(defvar GOLD-map +(defvar tpu-gold-map (let ((map (make-keymap))) - (define-key map "\e[" GOLD-CSI-map) ; GOLD-CSI map - (define-key map "\eO" GOLD-SS3-map) ; GOLD-SS3 map + ;; Previously we used escape sequences here. We now instead presume + ;; that term/*.el does its job to map the escape sequence to the right + ;; key-symbol. + + (define-key map [up] 'tpu-move-to-beginning) ; up-arrow + (define-key map [down] 'tpu-move-to-end) ; down-arrow + (define-key map [right] 'end-of-line) ; right-arrow + (define-key map [left] 'beginning-of-line) ; left-arrow + + (define-key map [find] 'nil) ; Find + (define-key map [insert] 'nil) ; Insert Here + (define-key map [delete] 'tpu-store-text) ; Remove + (define-key map [select] 'tpu-unselect) ; Select + (define-key map [prior] 'tpu-previous-window) ; Prev Screen + (define-key map [next] 'tpu-next-window) ; Next Screen + + (define-key map [f1] 'nil) ; F1 + (define-key map [f2] 'nil) ; F2 + (define-key map [f3] 'nil) ; F3 + (define-key map [f4] 'nil) ; F4 + (define-key map [f5] 'nil) ; F5 + (define-key map [f6] 'nil) ; F6 + (define-key map [f7] 'nil) ; F7 + (define-key map [f8] 'nil) ; F8 + (define-key map [f9] 'nil) ; F9 + (define-key map [f10] 'nil) ; F10 + (define-key map [f11] 'nil) ; F11 + (define-key map [f12] 'nil) ; F12 + (define-key map [f13] 'nil) ; F13 + (define-key map [f14] 'nil) ; F14 + (define-key map [help] 'describe-bindings) ; HELP + (define-key map [menu] 'nil) ; DO + (define-key map [f17] 'tpu-drop-breadcrumb) ; F17 + (define-key map [f18] 'nil) ; F18 + (define-key map [f19] 'nil) ; F19 + (define-key map [f20] 'nil) ; F20 + + (define-key map [kp-f1] 'keyboard-quit) ; PF1 + (define-key map [kp-f2] 'help-for-help) ; PF2 + (define-key map [kp-f3] 'tpu-search) ; PF3 + (define-key map [kp-f4] 'tpu-undelete-lines) ; PF4 + (define-key map [kp-0] 'open-line) ; KP0 + (define-key map [kp-1] 'tpu-change-case) ; KP1 + (define-key map [kp-2] 'tpu-delete-to-eol) ; KP2 + (define-key map [kp-3] 'tpu-special-insert) ; KP3 + (define-key map [kp-4] 'tpu-move-to-end) ; KP4 + (define-key map [kp-5] 'tpu-move-to-beginning) ; KP5 + (define-key map [kp-6] 'tpu-paste) ; KP6 + (define-key map [kp-7] 'execute-extended-command) ; KP7 + (define-key map [kp-8] 'tpu-fill) ; KP8 + (define-key map [kp-9] 'tpu-replace) ; KP9 + (define-key map [kp-subtract] 'tpu-undelete-words) ; KP- + (define-key map [kp-separator] 'tpu-undelete-char) ; KP, + (define-key map [kp-decimal] 'tpu-unselect) ; KP. + (define-key map [kp-enter] 'tpu-substitute) ; KPenter + ;; (define-key map "\C-A" 'tpu-toggle-overwrite-mode) ; ^A (define-key map "\C-B" 'nil) ; ^B @@ -553,48 +495,72 @@ CSI is DEC's name for the sequence <ESC>[.") map) "Maps the function keys on the VT100 keyboard preceded by PF1. GOLD is the ASCII 7-bit escape sequence <ESC>OP.") +(define-obsolete-variable-alias 'GOLD-map 'tpu-gold-map "23.1") -(defvar SS3-map +(defvar tpu-global-map (let ((map (make-sparse-keymap))) - (define-key map "P" GOLD-map) ; GOLD map + + ;; Previously defined in CSI-map. We now presume that term/*.el does + ;; its job to map the escape sequence to the right key-symbol. + (define-key map [find] 'tpu-search) ; Find + (define-key map [insert] 'tpu-paste) ; Insert Here + (define-key map [delete] 'tpu-cut) ; Remove + (define-key map [select] 'tpu-select) ; Select + (define-key map [prior] 'tpu-scroll-window-down) ; Prev Screen + (define-key map [next] 'tpu-scroll-window-up) ; Next Screen + + (define-key map [f1] 'nil) ; F1 + (define-key map [f2] 'nil) ; F2 + (define-key map [f3] 'nil) ; F3 + (define-key map [f4] 'nil) ; F4 + (define-key map [f5] 'nil) ; F5 + (define-key map [f6] 'nil) ; F6 + (define-key map [f7] 'nil) ; F7 + (define-key map [f8] 'nil) ; F8 + (define-key map [f9] 'nil) ; F9 + (define-key map [f10] 'tpu-exit) ; F10 + (define-key map [f11] 'tpu-insert-escape) ; F11 (ESC) + (define-key map [f12] 'tpu-next-beginning-of-line) ; F12 (BS) + (define-key map [f13] 'tpu-delete-previous-word) ; F13 (LF) + (define-key map [f14] 'tpu-toggle-overwrite-mode) ; F14 + (define-key map [help] 'tpu-help) ; HELP + (define-key map [menu] 'execute-extended-command) ; DO + (define-key map [f17] 'tpu-goto-breadcrumb) ; F17 + (define-key map [f18] 'nil) ; F18 + (define-key map [f19] 'nil) ; F19 + (define-key map [f20] 'nil) ; F20 + + + ;; Previously defined in SS3-map. We now presume that term/*.el does + ;; its job to map the escape sequence to the right key-symbol. + (define-key map [kp-f1] tpu-gold-map) ; GOLD map ;; - (define-key map "A" 'tpu-previous-line) ; up - (define-key map "B" 'tpu-next-line) ; down - (define-key map "C" 'tpu-forward-char) ; right - (define-key map "D" 'tpu-backward-char) ; left - - (define-key map "Q" 'tpu-help) ; PF2 - (define-key map "R" 'tpu-search-again) ; PF3 - (define-key map "S" 'tpu-delete-current-line) ; PF4 - (define-key map "p" 'tpu-line) ; KP0 - (define-key map "q" 'tpu-word) ; KP1 - (define-key map "r" 'tpu-end-of-line) ; KP2 - (define-key map "s" 'tpu-char) ; KP3 - (define-key map "t" 'tpu-advance-direction) ; KP4 - (define-key map "u" 'tpu-backup-direction) ; KP5 - (define-key map "v" 'tpu-cut) ; KP6 - (define-key map "w" 'tpu-page) ; KP7 - (define-key map "x" 'tpu-scroll-window) ; KP8 - (define-key map "y" 'tpu-append-region) ; KP9 - (define-key map "m" 'tpu-delete-current-word) ; KP- - (define-key map "l" 'tpu-delete-current-char) ; KP, - (define-key map "n" 'tpu-select) ; KP. - (define-key map "M" 'newline) ; KPenter - map) - "Maps the SS3 function keys on the VT100 keyboard. -SS3 is DEC's name for the sequence <ESC>O.") + (define-key map [up] 'tpu-previous-line) ; up + (define-key map [down] 'tpu-next-line) ; down + (define-key map [right] 'tpu-forward-char) ; right + (define-key map [left] 'tpu-backward-char) ; left + + (define-key map [kp-f2] 'tpu-help) ; PF2 + (define-key map [kp-f3] 'tpu-search-again) ; PF3 + (define-key map [kp-f4] 'tpu-delete-current-line) ; PF4 + (define-key map [kp-0] 'tpu-line) ; KP0 + (define-key map [kp-1] 'tpu-word) ; KP1 + (define-key map [kp-2] 'tpu-end-of-line) ; KP2 + (define-key map [kp-3] 'tpu-char) ; KP3 + (define-key map [kp-4] 'tpu-advance-direction) ; KP4 + (define-key map [kp-5] 'tpu-backup-direction) ; KP5 + (define-key map [kp-6] 'tpu-cut) ; KP6 + (define-key map [kp-7] 'tpu-page) ; KP7 + (define-key map [kp-8] 'tpu-scroll-window) ; KP8 + (define-key map [kp-9] 'tpu-append-region) ; KP9 + (define-key map [kp-subtract] 'tpu-delete-current-word) ; KP- + (define-key map [kp-separator] 'tpu-delete-current-char) ; KP, + (define-key map [kp-decimal] 'tpu-select) ; KP. + (define-key map [kp-enter] 'newline) ; KPenter -(defvar tpu-global-map - (let ((map (make-sparse-keymap))) - (define-key map "\e[" CSI-map) - (define-key map "\eO" SS3-map) map) "TPU-edt global keymap.") -(and (not (boundp 'minibuffer-local-ns-map)) - (defvar minibuffer-local-ns-map (make-sparse-keymap) - "Hack to give Lucid Emacs the same maps as ordinary Emacs.")) - ;;; ;;; Global Variables @@ -697,7 +663,7 @@ SS3 is DEC's name for the sequence <ESC>O.") (setq tpu-mark-flag (if transient-mark-mode "" (if (tpu-mark) " @" " "))) (force-mode-line-update)) -(cond (tpu-lucid-emacs-p +(cond ((featurep 'xemacs) (add-hook 'zmacs-deactivate-region-hook 'tpu-update-mode-line) (add-hook 'zmacs-activate-region-hook 'tpu-update-mode-line)) (t @@ -778,7 +744,7 @@ Otherwise sets the tpu-match markers to nil and returns nil." "TPU-edt version of the mark function. Return the appropriate value of the mark for the current version of Emacs." - (cond (tpu-lucid-emacs-p (mark (not zmacs-regions))) + (cond ((featurep 'xemacs) (mark (not zmacs-regions))) (t (and mark-active (mark (not transient-mark-mode)))))) (defun tpu-set-mark (pos) @@ -2366,7 +2332,7 @@ If FILE is nil, try to load a default file. The default file names are (setq file (expand-file-name file))) (tpu-xkeys-file (setq file (expand-file-name tpu-xkeys-file))) - (tpu-lucid-emacs-p + ((featurep 'xemacs) (setq file (convert-standard-filename (expand-file-name "~/.tpu-lucid-keys")))) (t @@ -2382,34 +2348,11 @@ If FILE is nil, try to load a default file. The default file names are (cond ((file-readable-p file) (load-file file)) (t - (switch-to-buffer "*scratch*") - (erase-buffer) - (insert " - - Ack!! You're running TPU-edt under X-windows without loading an - X key definition file. To create a TPU-edt X key definition - file, run the tpu-mapper.el program. It came with TPU-edt. It - even includes directions on how to use it! Perhaps it's lying - around here someplace. ") - (let ((file "tpu-mapper.el") - (found nil) - (path nil) - (search-list (append (list (expand-file-name ".")) load-path))) - (while (and (not found) search-list) - (setq path (concat (car search-list) - (if (string-match "/$" (car search-list)) "" "/") - file)) - (if (and (file-exists-p path) (not (file-directory-p path))) - (setq found t)) - (setq search-list (cdr search-list))) - (cond (found - (insert (format - "Ah yes, there it is, in \n\n %s \n\n" path)) - (if (tpu-y-or-n-p "Do you want to run it now? ") - (load-file path))) - (t - (insert "Nope, I can't seem to find it. :-(\n\n") - (sit-for 120))))))) + ;; FIXME: This used to force the user to build `file'. With the + ;; new code, such a file is not even necessary, but we'll keep + ;; a warning message. + (message "%s not found: use tpu-mapper.el to create it" + (abbreviate-file-name file))))) (defun tpu-copy-keyfile (oldname newname) "Copy the TPU-edt X key definitions file to the new default name." diff --git a/lisp/emulation/tpu-mapper.el b/lisp/emulation/tpu-mapper.el index 7f843964870..3e5af7a38bd 100644 --- a/lisp/emulation/tpu-mapper.el +++ b/lisp/emulation/tpu-mapper.el @@ -202,9 +202,9 @@ (setq tpu-key (concat "[" (format "%s" tpu-key-seq) "]")) (cond ((not (equal tpu-key tpu-return)) (set-buffer "Keys") - (insert (format"(global-set-key %s %s)\n" tpu-key func)) + (insert (format"(define-key tpu-global-map %s %s)\n" tpu-key func)) (set-buffer "Gold-Keys") - (insert (format "(define-key GOLD-map %s %s)\n" tpu-key gold-func)) + (insert (format "(define-key tpu-gold-map %s %s)\n" tpu-key gold-func)) (set-buffer "Directions")) ;; bogosity to get next prompt to come up, if the user hits <CR>! ;; check periodically to see if this is still needed... @@ -393,5 +393,5 @@ ") (goto-char (point-min)) -;;; arch-tag: bab5872f-cd3a-4c1c-aedb-047b67646f6c +;; arch-tag: bab5872f-cd3a-4c1c-aedb-047b67646f6c ;;; tpu-mapper.el ends here diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index 9c1ccf37e61..8dd22e9ea1f 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el @@ -106,7 +106,7 @@ ;; define viper-charpair-command-p (viper-test-com-defun viper-charpair-command) -(defconst viper-movement-commands '(?b ?B ?e ?E ?f ?F ?G ?h ?H ?j ?k ?l +(defconst viper-movement-commands '(?b ?B ?e ?E ?f ?F ?G ?h ?j ?k ?l ?H ?M ?L ?n ?t ?T ?w ?W ?$ ?% ?^ ?( ?) ?- ?+ ?| ?{ ?} ?[ ?] ?' ?` ?\; ?, ?0 ?? ?/ ?\ ?\C-m @@ -1321,10 +1321,10 @@ as a Meta key and any number of multiple escapes is allowed." (setq last-command-event (viper-copy-event (if viper-xemacs-p (character-to-event char) char))) - (condition-case nil + (condition-case err (funcall cmd-to-exec-at-end cmd-info) (error - (error ""))))) + (error "%s" (error-message-string err)))))) )) (defun viper-describe-arg (arg) @@ -1902,7 +1902,7 @@ With prefix argument, find next destructive command." (setq viper-intermediate-command 'repeating-display-destructive-command) ;; first search through command history--set temp ring - (setq viper-temp-command-ring (copy-list viper-command-ring))) + (setq viper-temp-command-ring (copy-sequence viper-command-ring))) (setq cmd (if next (viper-special-ring-rotate1 viper-temp-command-ring 1) (viper-special-ring-rotate1 viper-temp-command-ring -1))) @@ -1936,7 +1936,7 @@ to in the global map, instead of cycling through the insertion ring." (length viper-last-inserted-string-from-insertion-ring)))) ) ;;first search through insertion history - (setq viper-temp-insertion-ring (copy-list viper-insertion-ring))) + (setq viper-temp-insertion-ring (copy-sequence viper-insertion-ring))) (setq this-command 'viper-insert-from-insertion-ring) ;; so that things will be undone properly (setq buffer-undo-list (cons nil buffer-undo-list)) diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el index dc681772c18..2b0e886b9cb 100644 --- a/lisp/emulation/viper-init.el +++ b/lisp/emulation/viper-init.el @@ -97,6 +97,13 @@ :tag "Is it VMS?" :group 'viper-misc) +(defcustom viper-suppress-input-method-change-message nil + "If t, the message notifying about changes in the input method is not displayed. +Normally, a message is displayed each time on enters the vi, insert or replace +state." + :type 'boolean + :group 'viper-misc) + (defcustom viper-force-faces nil "If t, Viper will think that it is running on a display that supports faces. This is provided as a temporary relief for users of graphics-capable terminals @@ -326,7 +333,8 @@ Use `M-x viper-set-expert-level' to change this.") ;; turn off special input methods in vi-state (if (eq viper-current-state 'vi-state) (viper-set-input-method nil)) - (if (memq viper-current-state '(vi-state insert-state replace-state)) + (if (and (memq viper-current-state '(vi-state insert-state replace-state)) + (not viper-suppress-input-method-change-message)) (message "Viper special input method%s: on" (if (or current-input-method default-input-method) (format " %S" @@ -339,7 +347,8 @@ Use `M-x viper-set-expert-level' to change this.") (if (null viper-mule-hook-flag) () (setq viper-special-input-method nil) - (if (memq viper-current-state '(vi-state insert-state replace-state)) + (if (and (memq viper-current-state '(vi-state insert-state replace-state)) + (not viper-suppress-input-method-change-message)) (message "Viper special input method%s: off" (if (or current-input-method default-input-method) (format " %S" @@ -369,7 +378,7 @@ Use `M-x viper-set-expert-level' to change this.") ;; Set quail-mode to ARG (defun viper-set-input-method (arg) (setq viper-mule-hook-flag t) ; just a precaution - (let (viper-mule-hook-flag) ; temporarily inactivate viper mule hooks + (let (viper-mule-hook-flag) ; temporarily deactivate viper mule hooks (cond ((and arg (> (prefix-numeric-value arg) 0) default-input-method) ;; activate input method (viper-activate-input-method)) diff --git a/lisp/emulation/viper-keym.el b/lisp/emulation/viper-keym.el index 086605df79a..ac7231a3cac 100644 --- a/lisp/emulation/viper-keym.el +++ b/lisp/emulation/viper-keym.el @@ -339,8 +339,8 @@ If running in a terminal, [(escape)] is not understood, so must use \"\\e\"." (define-key viper-vi-basic-map "\C-m" 'viper-next-line-at-bol) (define-key viper-vi-basic-map "\C-u" 'viper-scroll-down) (define-key viper-vi-basic-map "\C-y" 'viper-scroll-down-one) -(define-key viper-vi-basic-map "\C-s" 'viper-isearch-forward) -(define-key viper-vi-basic-map "\C-r" 'viper-isearch-backward) +;;(define-key viper-vi-basic-map "\C-s" 'viper-isearch-forward) +;;(define-key viper-vi-basic-map "\C-r" 'viper-isearch-backward) (define-key viper-vi-basic-map "\C-c/" 'viper-toggle-search-style) (define-key viper-vi-basic-map "\C-c\C-g" 'viper-info-on-file) diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el index 82e9025e75b..eebf09aed22 100644 --- a/lisp/emulation/viper-util.el +++ b/lisp/emulation/viper-util.el @@ -168,7 +168,7 @@ (defun viper-set-cursor-color-according-to-state (&optional frame) (cond ((eq viper-current-state 'replace-state) - (viper-change-cursor-color viper-replace-state-cursor-color frame)) + (viper-change-cursor-color viper-replace-overlay-cursor-color frame)) ((and (eq viper-current-state 'emacs-state) viper-emacs-state-cursor-color) (viper-change-cursor-color viper-emacs-state-cursor-color frame)) @@ -889,9 +889,7 @@ ;; Sit for VAL milliseconds. XEmacs doesn't support the millisecond arg ;; in sit-for, so this function smoothes out the differences. (defsubst viper-sit-for-short (val &optional nodisp) - (if viper-xemacs-p - (sit-for (/ val 1000.0) nodisp) - (sit-for 0 val nodisp))) + (sit-for (/ val 1000.0) nodisp)) ;; EVENT may be a single event of a sequence of events (defsubst viper-ESC-event-p (event) diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el index d03e85d298c..63cafb4a734 100644 --- a/lisp/emulation/viper.el +++ b/lisp/emulation/viper.el @@ -9,7 +9,7 @@ ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> ;; Keywords: emulations -(defconst viper-version "3.13.1 of October 23, 2006" +(defconst viper-version "3.14 of June 14, 2007" "The current version of Viper") ;; This file is part of GNU Emacs. @@ -298,7 +298,6 @@ ;;; Code: (require 'advice) -(require 'cl) (require 'ring) ;; compiler pacifier @@ -457,6 +456,7 @@ unless it is coming up in a wrong Viper state." (defcustom viper-insert-state-mode-list '(internal-ange-ftp-mode comint-mode + gud-mode inferior-emacs-lisp-mode erc-mode eshell-mode @@ -481,6 +481,7 @@ unless it is coming up in a wrong Viper state." '((help-mode emacs-state viper-slash-and-colon-map) (comint-mode insert-state viper-comint-mode-modifier-map) (comint-mode vi-state viper-comint-mode-modifier-map) + (gud-mode insert-state viper-comint-mode-modifier-map) (shell-mode insert-state viper-comint-mode-modifier-map) (inferior-emacs-lisp-mode insert-state viper-comint-mode-modifier-map) (shell-mode vi-state viper-comint-mode-modifier-map) @@ -1025,48 +1026,63 @@ It also can't undo some Viper settings." (setq global-mode-string (append '("" viper-mode-string) (cdr global-mode-string)))) - (defadvice describe-key (before viper-describe-key-ad protect activate) - "Force to read key via `viper-read-key-sequence'." - (interactive (let (key) - (setq key (viper-read-key-sequence - "Describe key (or click or menu item): ")) - (list key - (prefix-numeric-value current-prefix-arg) - ;; If KEY is a down-event, read also the - ;; corresponding up-event. - (and (vectorp key) - (let ((last-idx (1- (length key)))) - (and (eventp (aref key last-idx)) - (memq 'down (event-modifiers - (aref key last-idx))))) - (or (and (eventp (aref key 0)) - (memq 'down (event-modifiers - (aref key 0))) - ;; For the C-down-mouse-2 popup - ;; menu, there is no subsequent up-event. - (= (length key) 1)) - (and (> (length key) 1) - (eventp (aref key 1)) - (memq 'down (event-modifiers (aref key 1))))) - (read-event)))))) - - (defadvice describe-key-briefly - (before viper-describe-key-briefly-ad protect activate) - "Force to read key via `viper-read-key-sequence'." - (interactive (let (key) - (setq key (viper-read-key-sequence - "Describe key (or click or menu item): ")) - ;; If KEY is a down-event, read and discard the - ;; corresponding up-event. - (and (vectorp key) - (let ((last-idx (1- (length key)))) - (and (eventp (aref key last-idx)) - (memq 'down (event-modifiers (aref key last-idx))))) - (read-event)) - (list key - (if current-prefix-arg - (prefix-numeric-value current-prefix-arg)) - 1)))) + (viper-cond-compile-for-xemacs-or-emacs + ;; XEmacs + (defadvice describe-key (before viper-describe-key-ad protect activate) + "Force to read key via `viper-read-key-sequence'." + (interactive (list (viper-read-key-sequence "Describe key: ")))) + ;; Emacs + (defadvice describe-key (before viper-describe-key-ad protect activate) + "Force to read key via `viper-read-key-sequence'." + (interactive (let (key) + (setq key (viper-read-key-sequence + "Describe key (or click or menu item): ")) + (list key + (prefix-numeric-value current-prefix-arg) + ;; If KEY is a down-event, read also the + ;; corresponding up-event. + (and (vectorp key) + (let ((last-idx (1- (length key)))) + (and (eventp (aref key last-idx)) + (memq 'down (event-modifiers + (aref key last-idx))))) + (or (and (eventp (aref key 0)) + (memq 'down (event-modifiers + (aref key 0))) + ;; For the C-down-mouse-2 popup menu, + ;; there is no subsequent up-event + (= (length key) 1)) + (and (> (length key) 1) + (eventp (aref key 1)) + (memq 'down (event-modifiers (aref key 1))))) + (read-event)))))) + ) ; viper-cond-compile-for-xemacs-or-emacs + + (viper-cond-compile-for-xemacs-or-emacs + ;; XEmacs + (defadvice describe-key-briefly + (before viper-describe-key-briefly-ad protect activate) + "Force to read key via `viper-read-key-sequence'." + (interactive (list (viper-read-key-sequence "Describe key briefly: ")))) + ;; Emacs + (defadvice describe-key-briefly + (before viper-describe-key-briefly-ad protect activate) + "Force to read key via `viper-read-key-sequence'." + (interactive (let (key) + (setq key (viper-read-key-sequence + "Describe key (or click or menu item): ")) + ;; If KEY is a down-event, read and discard the + ;; corresponding up-event. + (and (vectorp key) + (let ((last-idx (1- (length key)))) + (and (eventp (aref key last-idx)) + (memq 'down (event-modifiers (aref key last-idx))))) + (read-event)) + (list key + (if current-prefix-arg + (prefix-numeric-value current-prefix-arg)) + 1)))) + ) ;; viper-cond-compile-for-xemacs-or-emacs (defadvice find-file (before viper-add-suffix-advice activate) "Use `read-file-name' for reading arguments." |