From 8ea74b0e4570fe6e3ee583b0655bf6137d82dc28 Mon Sep 17 00:00:00 2001 From: Michael Kifer Date: Sun, 10 Jul 2005 18:46:24 +0000 Subject: [PATCH] * viper-cmd.el (viper--key-maps): new variable. (viper-normalize-minor-mode-map-alist): use viper--key-maps and emulation-mode-map-alists. (viper-envelop-ESC-key): use viper-subseq. (viper-search-forward/backward/next): disable debug-on-error. * viper-keym.el (viper-toggle-key,viper-quoted-insert-key, viper-ESC-key): new defcustoms. * viper-macs.el (ex-map-read-args): use viper-subseq. * viper-util.el (viper-key-to-emacs-key): use viper-subseq. (viper-subseq): copy of subseq from cl.el. * viper.el (viper-go-away,viper-set-hooks): use emulation-mode-map-alists, advise self-insert-command, add-minor-mode. * viper-mous.el (viper-current-frame-saved): use defvar. * viper-init.el: got rid of -face in face names. * ediff-diff.el (ediff-extract-diffs,ediff-extract-diffs3): Make it work with longlines mode * ediff-mult.el (ediff-meta-mode-hook): new variable. * ediff-ptch.el (ediff-file-name-sans-prefix): quote regexp. * ediff-init: got rid of -face in face names. --- lisp/ChangeLog | 32 ++++++++++++ lisp/ediff-diff.el | 122 ++++++++++++++++++++++++++++++------------- lisp/ediff-init.el | 108 ++++++++++++++------------------------ lisp/ediff-mult.el | 9 +++- lisp/ediff-ptch.el | 2 +- lisp/ediff-util.el | 13 +++-- lisp/ediff-vers.el | 5 +- lisp/ediff.el | 10 ++-- lisp/emulation/viper-cmd.el | 72 +++++++++++++++---------- lisp/emulation/viper-init.el | 30 ++++------- lisp/emulation/viper-keym.el | 97 +++++++++++++++++++++++++++------- lisp/emulation/viper-macs.el | 12 ++--- lisp/emulation/viper-mous.el | 2 +- lisp/emulation/viper-util.el | 30 ++++++++++- lisp/emulation/viper.el | 35 ++++++++++++- man/viper.texi | 2 + 16 files changed, 383 insertions(+), 198 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 06cf972aac2..57441880d78 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,35 @@ +2005-07-10 Michael Kifer + + * viper-cmd.el (viper--key-maps): new variable. + (viper-normalize-minor-mode-map-alist): use viper--key-maps and + emulation-mode-map-alists. + (viper-envelop-ESC-key): use viper-subseq. + (viper-search-forward/backward/next): disable debug-on-error. + + * viper-keym.el (viper-toggle-key,viper-quoted-insert-key, + viper-ESC-key): new defcustoms. + + * viper-macs.el (ex-map-read-args): use viper-subseq. + + * viper-util.el (viper-key-to-emacs-key): use viper-subseq. + (viper-subseq): copy of subseq from cl.el. + + * viper.el (viper-go-away,viper-set-hooks): use + emulation-mode-map-alists, advise self-insert-command, add-minor-mode. + + * viper-mous.el (viper-current-frame-saved): use defvar. + + * viper-init.el: got rid of -face in face names. + + * ediff-diff.el (ediff-extract-diffs,ediff-extract-diffs3): + Make it work with longlines mode + + * ediff-mult.el (ediff-meta-mode-hook): new variable. + + * ediff-ptch.el (ediff-file-name-sans-prefix): quote regexp. + + * ediff-init: got rid of -face in face names. + 2005-07-10 Richard M. Stallman * emacs-lisp/edebug.el (edebug-enter): Call with-timeout-suspend diff --git a/lisp/ediff-diff.el b/lisp/ediff-diff.el index 659c4ffedb0..6d6b36692bc 100644 --- a/lisp/ediff-diff.el +++ b/lisp/ediff-diff.el @@ -459,24 +459,46 @@ one optional arguments, diff-number to refine.") c-prev c-end) ;; else convert lines to points (ediff-with-current-buffer A-buffer - (forward-line (- a-begin a-prev)) - (setq a-begin-pt (point)) - (forward-line (- a-end a-begin)) - (setq a-end-pt (point) - a-prev a-end)) + (let ((longlines-mode-val + (if (and (boundp 'longlines-mode) longlines-mode) 1 0))) + ;; we must disable and then restore longlines-mode + (if (eq longlines-mode-val 1) + (longlines-mode 0)) + (forward-line (- a-begin a-prev)) + (setq a-begin-pt (point)) + (forward-line (- a-end a-begin)) + (setq a-end-pt (point) + a-prev a-end) + (if (eq longlines-mode-val 1) + (longlines-mode longlines-mode-val)) + )) (ediff-with-current-buffer B-buffer - (forward-line (- b-begin b-prev)) - (setq b-begin-pt (point)) - (forward-line (- b-end b-begin)) - (setq b-end-pt (point) - b-prev b-end)) + (let ((longlines-mode-val + (if (and (boundp 'longlines-mode) longlines-mode) 1 0))) + (if (eq longlines-mode-val 1) + (longlines-mode 0)) + (forward-line (- b-begin b-prev)) + (setq b-begin-pt (point)) + (forward-line (- b-end b-begin)) + (setq b-end-pt (point) + b-prev b-end) + (if (eq longlines-mode-val 1) + (longlines-mode longlines-mode-val)) + )) (if (ediff-buffer-live-p C-buffer) (ediff-with-current-buffer C-buffer - (forward-line (- c-begin c-prev)) - (setq c-begin-pt (point)) - (forward-line (- c-end c-begin)) - (setq c-end-pt (point) - c-prev c-end))) + (let ((longlines-mode-val + (if (and (boundp 'longlines-mode) longlines-mode) 1 0))) + (if (eq longlines-mode-val 1) + (longlines-mode 0)) + (forward-line (- c-begin c-prev)) + (setq c-begin-pt (point)) + (forward-line (- c-end c-begin)) + (setq c-end-pt (point) + c-prev c-end) + (if (eq longlines-mode-val 1) + (longlines-mode longlines-mode-val)) + ))) (setq diff-list (nconc diff-list @@ -1060,30 +1082,59 @@ delimiter regions")) c-prev c-end) ;; else convert lines to points (ediff-with-current-buffer A-buffer - (forward-line (- a-begin a-prev)) - (setq a-begin-pt (point)) - (forward-line (- a-end a-begin)) - (setq a-end-pt (point) - a-prev a-end)) + (let ((longlines-mode-val + (if (and (boundp 'longlines-mode) longlines-mode) 1 0))) + ;; we must disable and then restore longlines-mode + (if (eq longlines-mode-val 1) + (longlines-mode 0)) + (forward-line (- a-begin a-prev)) + (setq a-begin-pt (point)) + (forward-line (- a-end a-begin)) + (setq a-end-pt (point) + a-prev a-end) + (if (eq longlines-mode-val 1) + (longlines-mode longlines-mode-val)) + )) (ediff-with-current-buffer B-buffer - (forward-line (- b-begin b-prev)) - (setq b-begin-pt (point)) - (forward-line (- b-end b-begin)) - (setq b-end-pt (point) - b-prev b-end)) + (let ((longlines-mode-val + (if (and (boundp 'longlines-mode) longlines-mode) 1 0))) + (if (eq longlines-mode-val 1) + (longlines-mode 0)) + (forward-line (- b-begin b-prev)) + (setq b-begin-pt (point)) + (forward-line (- b-end b-begin)) + (setq b-end-pt (point) + b-prev b-end) + (if (eq longlines-mode-val 1) + (longlines-mode longlines-mode-val)) + )) (ediff-with-current-buffer C-buffer - (forward-line (- c-begin c-prev)) - (setq c-begin-pt (point)) - (forward-line (- c-end c-begin)) - (setq c-end-pt (point) - c-prev c-end)) + (let ((longlines-mode-val + (if (and (boundp 'longlines-mode) longlines-mode) 1 0))) + (if (eq longlines-mode-val 1) + (longlines-mode 0)) + (forward-line (- c-begin c-prev)) + (setq c-begin-pt (point)) + (forward-line (- c-end c-begin)) + (setq c-end-pt (point) + c-prev c-end) + (if (eq longlines-mode-val 1) + (longlines-mode longlines-mode-val)) + )) (if (ediff-buffer-live-p anc-buffer) (ediff-with-current-buffer anc-buffer - (forward-line (- c-or-anc-begin anc-prev)) - (setq anc-begin-pt (point)) - (forward-line (- c-or-anc-end c-or-anc-begin)) - (setq anc-end-pt (point) - anc-prev c-or-anc-end))) + (let ((longlines-mode-val + (if (and (boundp 'longlines-mode) longlines-mode) 1 0))) + (if (eq longlines-mode-val 1) + (longlines-mode 0)) + (forward-line (- c-or-anc-begin anc-prev)) + (setq anc-begin-pt (point)) + (forward-line (- c-or-anc-end c-or-anc-begin)) + (setq anc-end-pt (point) + anc-prev c-or-anc-end) + (if (eq longlines-mode-val 1) + (longlines-mode longlines-mode-val)) + ))) (setq diff-list (nconc diff-list @@ -1425,6 +1476,5 @@ affects only files whose names match the expression." ;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) ;;; End: - ;;; arch-tag: a86d448e-58d7-4572-a1d9-fdedfa22f648 ;;; ediff-diff.el ends here diff --git a/lisp/ediff-init.el b/lisp/ediff-init.el index 18e1a7128f1..8af930ec27e 100644 --- a/lisp/ediff-init.el +++ b/lisp/ediff-init.el @@ -854,10 +854,10 @@ to temp files when Ediff needs to find fine differences." ;; A-list of current-diff-face-* symbols associated with buf types (defconst ediff-current-diff-face-alist - '((A . ediff-current-diff-face-A) - (B . ediff-current-diff-face-B) - (C . ediff-current-diff-face-C) - (Ancestor . ediff-current-diff-face-Ancestor))) + '((A . ediff-current-diff-A) + (B . ediff-current-diff-B) + (C . ediff-current-diff-C) + (Ancestor . ediff-current-diff-Ancestor))) (defun ediff-set-overlay-face (extent face) @@ -915,8 +915,6 @@ to temp files when Ediff needs to find fine differences." (t (:inverse-video t)))) "Face for highlighting the selected difference in buffer A." :group 'ediff-highlighting) -;; backward-compatibility alias -(put 'ediff-current-diff-face-A 'face-alias 'ediff-current-diff-A) ;; An internal variable. Ediff takes the face from here. When unhighlighting, ;; this variable is set to nil, then again to the appropriate face. (defvar ediff-current-diff-face-A 'ediff-current-diff-A @@ -924,13 +922,13 @@ to temp files when Ediff needs to find fine differences." DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-current-diff-A' this variable represents.") -(ediff-hide-face 'ediff-current-diff-A) +(ediff-hide-face ediff-current-diff-face-A) ;; Until custom.el for XEmacs starts supporting :inverse-video we do this. ;; This means that some user customization may be trashed. (if (and ediff-xemacs-p (ediff-has-face-support-p) (not (ediff-color-display-p))) - (copy-face 'modeline 'ediff-current-diff-A)) + (copy-face 'modeline ediff-current-diff-face-A)) @@ -948,8 +946,6 @@ this variable represents.") (t (:inverse-video t)))) "Face for highlighting the selected difference in buffer B." :group 'ediff-highlighting) -;; backward-compatibility alias -(put 'ediff-current-diff-face-B 'face-alias 'ediff-current-diff-B) ;; An internal variable. Ediff takes the face from here. When unhighlighting, ;; this variable is set to nil, then again to the appropriate face. (defvar ediff-current-diff-face-B 'ediff-current-diff-B @@ -957,13 +953,13 @@ this variable represents.") this variable. Instead, use the customization widget to customize the actual face `ediff-current-diff-B' this variable represents.") -(ediff-hide-face 'ediff-current-diff-B) +(ediff-hide-face ediff-current-diff-face-B) ;; Until custom.el for XEmacs starts supporting :inverse-video we do this. ;; This means that some user customization may be trashed. (if (and ediff-xemacs-p (ediff-has-face-support-p) (not (ediff-color-display-p))) - (copy-face 'modeline 'ediff-current-diff-B)) + (copy-face 'modeline ediff-current-diff-face-B)) (defface ediff-current-diff-C @@ -978,8 +974,6 @@ this variable represents.") (t (:inverse-video t)))) "Face for highlighting the selected difference in buffer C." :group 'ediff-highlighting) -;; backward-compatibility alias -(put 'ediff-current-diff-face-C 'face-alias 'ediff-current-diff-C) ;; An internal variable. Ediff takes the face from here. When unhighlighting, ;; this variable is set to nil, then again to the appropriate face. (defvar ediff-current-diff-face-C 'ediff-current-diff-C @@ -987,13 +981,13 @@ this variable represents.") DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-current-diff-C' this variable represents.") -(ediff-hide-face 'ediff-current-diff-C) +(ediff-hide-face ediff-current-diff-face-C) ;; Until custom.el for XEmacs starts supporting :inverse-video we do this. ;; This means that some user customization may be trashed. (if (and ediff-xemacs-p (ediff-has-face-support-p) (not (ediff-color-display-p))) - (copy-face 'modeline 'ediff-current-diff-C)) + (copy-face 'modeline ediff-current-diff-face-C)) (defface ediff-current-diff-Ancestor @@ -1008,8 +1002,6 @@ this variable represents.") (t (:inverse-video t)))) "Face for highlighting the selected difference in buffer Ancestor." :group 'ediff-highlighting) -;; backward-compatibility alias -(put 'ediff-current-diff-face-Ancestor 'face-alias 'ediff-current-diff-Ancestor) ;; An internal variable. Ediff takes the face from here. When unhighlighting, ;; this variable is set to nil, then again to the appropriate face. (defvar ediff-current-diff-face-Ancestor 'ediff-current-diff-Ancestor @@ -1017,13 +1009,13 @@ this variable represents.") DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-current-diff-Ancestor' this variable represents.") -(ediff-hide-face 'ediff-current-diff-Ancestor) +(ediff-hide-face ediff-current-diff-face-Ancestor) ;; Until custom.el for XEmacs starts supporting :inverse-video we do this. ;; This means that some user customization may be trashed. (if (and ediff-xemacs-p (ediff-has-face-support-p) (not (ediff-color-display-p))) - (copy-face 'modeline 'ediff-current-diff-Ancestor)) + (copy-face 'modeline ediff-current-diff-face-Ancestor)) (defface ediff-fine-diff-A @@ -1038,8 +1030,6 @@ this variable represents.") (t (:underline t :stipple "gray3")))) "Face for highlighting the refinement of the selected diff in buffer A." :group 'ediff-highlighting) -;; backward-compatibility alias -(put 'ediff-fine-diff-face-A 'face-alias 'ediff-fine-diff-A) ;; An internal variable. Ediff takes the face from here. When unhighlighting, ;; this variable is set to nil, then again to the appropriate face. (defvar ediff-fine-diff-face-A 'ediff-fine-diff-A @@ -1047,7 +1037,7 @@ this variable represents.") DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-fine-diff-A' this variable represents.") -(ediff-hide-face 'ediff-fine-diff-A) +(ediff-hide-face ediff-fine-diff-face-A) (defface ediff-fine-diff-B (if ediff-emacs-p @@ -1061,8 +1051,6 @@ this variable represents.") (t (:underline t :stipple "gray3")))) "Face for highlighting the refinement of the selected diff in buffer B." :group 'ediff-highlighting) -;; backward-compatibility alias -(put 'ediff-fine-diff-face-B 'face-alias 'ediff-fine-diff-B) ;; An internal variable. Ediff takes the face from here. When unhighlighting, ;; this variable is set to nil, then again to the appropriate face. (defvar ediff-fine-diff-face-B 'ediff-fine-diff-B @@ -1070,7 +1058,7 @@ this variable represents.") DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-fine-diff-B' this variable represents.") -(ediff-hide-face 'ediff-fine-diff-B) +(ediff-hide-face ediff-fine-diff-face-B) (defface ediff-fine-diff-C (if ediff-emacs-p @@ -1089,8 +1077,6 @@ this variable represents.") (t (:underline t :stipple "gray3")))) "Face for highlighting the refinement of the selected diff in buffer C." :group 'ediff-highlighting) -;; backward-compatibility alias -(put 'ediff-fine-diff-face-C 'face-alias 'ediff-fine-diff-C) ;; An internal variable. Ediff takes the face from here. When unhighlighting, ;; this variable is set to nil, then again to the appropriate face. (defvar ediff-fine-diff-face-C 'ediff-fine-diff-C @@ -1098,7 +1084,7 @@ this variable represents.") DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-fine-diff-C' this variable represents.") -(ediff-hide-face 'ediff-fine-diff-C) +(ediff-hide-face ediff-fine-diff-face-C) (defface ediff-fine-diff-Ancestor (if ediff-emacs-p @@ -1114,8 +1100,6 @@ this variable represents.") At present, this face is not used and no fine differences are computed for the ancestor buffer." :group 'ediff-highlighting) -;; backward-compatibility alias -(put 'ediff-fine-diff-face-Ancestor 'face-alias 'ediff-fine-diff-Ancestor) ;; An internal variable. Ediff takes the face from here. When unhighlighting, ;; this variable is set to nil, then again to the appropriate face. (defvar ediff-fine-diff-face-Ancestor 'ediff-fine-diff-Ancestor @@ -1123,7 +1107,7 @@ ancestor buffer." DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-fine-diff-Ancestor' this variable represents.") -(ediff-hide-face 'ediff-fine-diff-Ancestor) +(ediff-hide-face ediff-fine-diff-face-Ancestor) ;; Some installs don't have stipple or Stipple. So, try them in turn. (defvar stipple-pixmap @@ -1151,8 +1135,6 @@ this variable represents.") (t (:italic t :stipple ,stipple-pixmap)))) "Face for highlighting even-numbered non-current differences in buffer A." :group 'ediff-highlighting) -;; backward-compatibility alias -(put 'ediff-even-diff-face-A 'face-alias 'ediff-even-diff-A) ;; An internal variable. Ediff takes the face from here. When unhighlighting, ;; this variable is set to nil, then again to the appropriate face. (defvar ediff-even-diff-face-A 'ediff-even-diff-A @@ -1160,7 +1142,7 @@ this variable represents.") DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-even-diff-A' this variable represents.") -(ediff-hide-face 'ediff-even-diff-A) +(ediff-hide-face ediff-even-diff-face-A) (defface ediff-even-diff-B (if ediff-emacs-p @@ -1174,8 +1156,6 @@ this variable represents.") (t (:italic t :stipple ,stipple-pixmap)))) "Face for highlighting even-numbered non-current differences in buffer B." :group 'ediff-highlighting) -;; backward-compatibility alias -(put 'ediff-even-diff-face-B 'face-alias 'ediff-even-diff-B) ;; An internal variable. Ediff takes the face from here. When unhighlighting, ;; this variable is set to nil, then again to the appropriate face. (defvar ediff-even-diff-face-B 'ediff-even-diff-B @@ -1183,7 +1163,7 @@ this variable represents.") DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-even-diff-B' this variable represents.") -(ediff-hide-face 'ediff-even-diff-B) +(ediff-hide-face ediff-even-diff-face-B) (defface ediff-even-diff-C (if ediff-emacs-p @@ -1202,8 +1182,6 @@ this variable represents.") (t (:italic t :stipple ,stipple-pixmap)))) "Face for highlighting even-numbered non-current differences in buffer C." :group 'ediff-highlighting) -;; backward-compatibility alias -(put 'ediff-even-diff-face-C 'face-alias 'ediff-even-diff-C) ;; An internal variable. Ediff takes the face from here. When unhighlighting, ;; this variable is set to nil, then again to the appropriate face. (defvar ediff-even-diff-face-C 'ediff-even-diff-C @@ -1211,7 +1189,7 @@ this variable represents.") DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-even-diff-C' this variable represents.") -(ediff-hide-face 'ediff-even-diff-C) +(ediff-hide-face ediff-even-diff-face-C) (defface ediff-even-diff-Ancestor (if ediff-emacs-p @@ -1230,8 +1208,6 @@ this variable represents.") (t (:italic t :stipple ,stipple-pixmap)))) "Face for highlighting even-numbered non-current differences in the ancestor buffer." :group 'ediff-highlighting) -;; backward-compatibility alias -(put 'ediff-even-diff-face-Ancestor 'face-alias 'ediff-even-diff-Ancestor) ;; An internal variable. Ediff takes the face from here. When unhighlighting, ;; this variable is set to nil, then again to the appropriate face. (defvar ediff-even-diff-face-Ancestor 'ediff-even-diff-Ancestor @@ -1239,7 +1215,7 @@ this variable represents.") DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-even-diff-Ancestor' this variable represents.") -(ediff-hide-face 'ediff-even-diff-Ancestor) +(ediff-hide-face ediff-even-diff-face-Ancestor) ;; Association between buffer types and even-diff-face symbols (defconst ediff-even-diff-face-alist @@ -1263,8 +1239,6 @@ this variable represents.") (t (:italic t :stipple "gray1")))) "Face for highlighting odd-numbered non-current differences in buffer A." :group 'ediff-highlighting) -;; backward-compatibility alias -(put 'ediff-odd-diff-face-A 'face-alias 'ediff-odd-diff-A) ;; An internal variable. Ediff takes the face from here. When unhighlighting, ;; this variable is set to nil, then again to the appropriate face. (defvar ediff-odd-diff-face-A 'ediff-odd-diff-A @@ -1272,7 +1246,7 @@ this variable represents.") DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-odd-diff-A' this variable represents.") -(ediff-hide-face 'ediff-odd-diff-A) +(ediff-hide-face ediff-odd-diff-face-A) (defface ediff-odd-diff-B @@ -1290,8 +1264,6 @@ this variable represents.") (t (:italic t :stipple "gray1")))) "Face for highlighting odd-numbered non-current differences in buffer B." :group 'ediff-highlighting) -;; backward-compatibility alias -(put 'ediff-odd-diff-face-B 'face-alias 'ediff-odd-diff-B) ;; An internal variable. Ediff takes the face from here. When unhighlighting, ;; this variable is set to nil, then again to the appropriate face. (defvar ediff-odd-diff-face-B 'ediff-odd-diff-B @@ -1299,7 +1271,7 @@ this variable represents.") DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-odd-diff-B' this variable represents.") -(ediff-hide-face 'ediff-odd-diff-B) +(ediff-hide-face ediff-odd-diff-face-B) (defface ediff-odd-diff-C (if ediff-emacs-p @@ -1316,8 +1288,6 @@ this variable represents.") (t (:italic t :stipple "gray1")))) "Face for highlighting odd-numbered non-current differences in buffer C." :group 'ediff-highlighting) -;; backward-compatibility alias -(put 'ediff-odd-diff-face-C 'face-alias 'ediff-odd-diff-C) ;; An internal variable. Ediff takes the face from here. When unhighlighting, ;; this variable is set to nil, then again to the appropriate face. (defvar ediff-odd-diff-face-C 'ediff-odd-diff-C @@ -1325,7 +1295,7 @@ this variable represents.") DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-odd-diff-C' this variable represents.") -(ediff-hide-face 'ediff-odd-diff-C) +(ediff-hide-face ediff-odd-diff-face-C) (defface ediff-odd-diff-Ancestor (if ediff-emacs-p @@ -1339,8 +1309,6 @@ this variable represents.") (t (:italic t :stipple "gray1")))) "Face for highlighting odd-numbered non-current differences in the ancestor buffer." :group 'ediff-highlighting) -;; backward-compatibility alias -(put 'ediff-odd-diff-face-Ancestor 'face-alias 'ediff-odd-diff-Ancestor) ;; An internal variable. Ediff takes the face from here. When unhighlighting, ;; this variable is set to nil, then again to the appropriate face. (defvar ediff-odd-diff-face-Ancestor 'ediff-odd-diff-Ancestor @@ -1348,30 +1316,30 @@ this variable represents.") DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-odd-diff-Ancestor' this variable represents.") -(ediff-hide-face 'ediff-odd-diff-Ancestor) +(ediff-hide-face ediff-odd-diff-face-Ancestor) ;; Association between buffer types and odd-diff-face symbols (defconst ediff-odd-diff-face-alist - '((A . ediff-odd-diff-face-A) - (B . ediff-odd-diff-face-B) - (C . ediff-odd-diff-face-C) - (Ancestor . ediff-odd-diff-face-Ancestor))) + '((A . ediff-odd-diff-A) + (B . ediff-odd-diff-B) + (C . ediff-odd-diff-C) + (Ancestor . ediff-odd-diff-Ancestor))) ;; A-list of fine-diff face symbols associated with buffer types (defconst ediff-fine-diff-face-alist - '((A . ediff-fine-diff-face-A) - (B . ediff-fine-diff-face-B) - (C . ediff-fine-diff-face-C) - (Ancestor . ediff-fine-diff-face-Ancestor))) + '((A . ediff-fine-diff-A) + (B . ediff-fine-diff-B) + (C . ediff-fine-diff-C) + (Ancestor . ediff-fine-diff-Ancestor))) ;; Help echo -(put 'ediff-fine-diff-A 'ediff-help-echo +(put ediff-fine-diff-face-A 'ediff-help-echo "A `refinement' of the current difference region") -(put 'ediff-fine-diff-B 'ediff-help-echo +(put ediff-fine-diff-face-B 'ediff-help-echo "A `refinement' of the current difference region") -(put 'ediff-fine-diff-C 'ediff-help-echo +(put ediff-fine-diff-face-C 'ediff-help-echo "A `refinement' of the current difference region") -(put 'ediff-fine-diff-Ancestor 'ediff-help-echo +(put ediff-fine-diff-face-Ancestor 'ediff-help-echo "A `refinement' of the current difference region") (add-hook 'ediff-quit-hook 'ediff-cleanup-mess) @@ -1899,6 +1867,8 @@ Unless optional argument INPLACE is non-nil, return a new string." (set-buffer ,old-buffer) (set-syntax-table ,old-table))))))) +(provide 'ediff-init) + ;;; Local Variables: @@ -1907,7 +1877,5 @@ Unless optional argument INPLACE is non-nil, return a new string." ;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) ;;; End: -(provide 'ediff-init) - ;;; arch-tag: fa31d384-1e70-4d4b-82a7-3e96307c46f5 ;;; ediff-init.el ends here diff --git a/lisp/ediff-mult.el b/lisp/ediff-mult.el index c7ad411b4ac..1303d65cf2e 100644 --- a/lisp/ediff-mult.el +++ b/lisp/ediff-mult.el @@ -205,6 +205,12 @@ Should be a sexp. For instance (car ediff-filtering-regexp-history) or nil." This can be toggled with `ediff-toggle-filename-truncation'." :type 'boolean :group 'ediff-mult) + +(defcustom ediff-meta-mode-hook nil + "*Hooks run just after setting up meta mode." + :type 'hook + :group 'ediff-mult) + (defcustom ediff-registry-setup-hook nil "*Hooks run just after the registry control panel is set up." :type 'hook @@ -411,7 +417,8 @@ Commands: (kill-all-local-variables) (setq major-mode 'ediff-meta-mode) (setq mode-name "MetaEdiff") - (run-mode-hooks 'ediff-meta-mode-hook)) + ;; don't use run-mode-hooks here! + (run-hooks 'ediff-meta-mode-hook)) ;; the keymap for the buffer showing directory differences diff --git a/lisp/ediff-ptch.el b/lisp/ediff-ptch.el index 45b214c0cb3..9176a38c2c9 100644 --- a/lisp/ediff-ptch.el +++ b/lisp/ediff-ptch.el @@ -163,7 +163,7 @@ program." ;; returns /dev/null, if can't strip prefix (defsubst ediff-file-name-sans-prefix (filename prefix) (save-match-data - (if (string-match (concat "^" prefix) filename) + (if (string-match (concat "^" (regexp-quote prefix)) filename) (substring filename (match-end 0)) (concat "/null/" filename)))) diff --git a/lisp/ediff-util.el b/lisp/ediff-util.el index 9434601326c..70b3f304e03 100644 --- a/lisp/ediff-util.el +++ b/lisp/ediff-util.el @@ -117,7 +117,13 @@ Commands: (kill-all-local-variables) (setq major-mode 'ediff-mode) (setq mode-name "Ediff") - (run-mode-hooks 'ediff-mode-hook)) + ;; We use run-hooks instead of run-mode-hooks for two reasons. + ;; The ediff control buffer is read-only and it is not supposed to be + ;; modified by minor modes and such. So, run-mode-hooks doesn't do anything + ;; useful here on top of what run-hooks does. + ;; Second, changing run-hooks to run-mode-hooks would require an + ;; if-statement, since XEmacs doesn't have this. + (run-hooks 'ediff-mode-hook)) @@ -3788,9 +3794,8 @@ Ediff Control Panel to restore highlighting." type ediff-current-diff-overlay-alist)) (buffer (ediff-get-buffer type)) (face (face-name - (symbol-value - (ediff-get-symbol-from-alist - type ediff-current-diff-face-alist))))) + (ediff-get-symbol-from-alist + type ediff-current-diff-face-alist)))) (set overlay (ediff-make-bullet-proof-overlay (point-max) (point-max) buffer)) (ediff-set-overlay-face (symbol-value overlay) face) diff --git a/lisp/ediff-vers.el b/lisp/ediff-vers.el index 653f4017cad..70069cc2193 100644 --- a/lisp/ediff-vers.el +++ b/lisp/ediff-vers.el @@ -304,13 +304,14 @@ (if (stringp tmp-file) (delete-file tmp-file)) (if (stringp ancestor-file) (delete-file ancestor-file)))) + +(provide 'ediff-vers) + ;;; Local Variables: ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) ;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1) ;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) ;;; End: -(provide 'ediff-vers) - ;;; arch-tag: bbb34f0c-2a90-426a-a77a-c75f479ebbbf ;;; ediff-vers.el ends here diff --git a/lisp/ediff.el b/lisp/ediff.el index 46b060e29ae..f842e9dec6c 100644 --- a/lisp/ediff.el +++ b/lisp/ediff.el @@ -7,7 +7,7 @@ ;; Keywords: comparing, merging, patching, tools, unix (defconst ediff-version "2.80" "The current version of Ediff") -(defconst ediff-date "June 3, 2005" "Date of last update") +(defconst ediff-date "July 8, 2005" "Date of last update") ;; This file is part of GNU Emacs. @@ -1526,15 +1526,15 @@ With optional NODE, goes to that node." (add-to-list 'debug-ignored-errors mess)) +(require 'ediff-util) + +(run-hooks 'ediff-load-hook) + ;;; Local Variables: ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) ;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1) ;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) ;;; End: -(require 'ediff-util) - -(run-hooks 'ediff-load-hook) - ;;; arch-tag: 97c71396-db02-4f41-8b48-6a51c3348fcc ;;; ediff.el ends here diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index 4f247f2cd38..ecd5251891c 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el @@ -36,6 +36,8 @@ (defvar viper-always) (defvar viper-mode-string) (defvar viper-custom-file-name) +(defvar viper--key-maps) +(defvar viper--intercept-key-maps) (defvar iso-accents-mode) (defvar quail-mode) (defvar quail-current-str) @@ -92,7 +94,7 @@ ;; Variables for defining VI commands ;; Modifying commands that can be prefixes to movement commands -(defconst viper-prefix-commands '(?c ?d ?y ?! ?= ?# ?< ?> ?\")) +(defvar viper-prefix-commands '(?c ?d ?y ?! ?= ?# ?< ?> ?\")) ;; define viper-prefix-command-p (viper-test-com-defun viper-prefix-command) @@ -440,23 +442,24 @@ ;; This ensures that Viper bindings are in effect, regardless of which minor ;; modes were turned on by the user or by other packages. (defun viper-normalize-minor-mode-map-alist () - (setq minor-mode-map-alist - (viper-append-filter-alist - (list (cons 'viper-vi-intercept-minor-mode viper-vi-intercept-map) - (cons 'viper-vi-minibuffer-minor-mode viper-minibuffer-map) - (cons 'viper-vi-local-user-minor-mode viper-vi-local-user-map) - (cons 'viper-vi-kbd-minor-mode viper-vi-kbd-map) - (cons 'viper-vi-global-user-minor-mode viper-vi-global-user-map) - (cons 'viper-vi-state-modifier-minor-mode - (if (keymapp - (cdr (assoc major-mode - viper-vi-state-modifier-alist))) - (cdr (assoc major-mode viper-vi-state-modifier-alist)) - viper-empty-keymap)) - (cons 'viper-vi-diehard-minor-mode viper-vi-diehard-map) - (cons 'viper-vi-basic-minor-mode viper-vi-basic-map) - (cons 'viper-insert-intercept-minor-mode - viper-insert-intercept-map) + (setq viper--intercept-key-maps + (list + (cons 'viper-vi-intercept-minor-mode viper-vi-intercept-map) + (cons 'viper-insert-intercept-minor-mode viper-insert-intercept-map) + (cons 'viper-emacs-intercept-minor-mode viper-emacs-intercept-map) + )) + (setq viper--key-maps + (list (cons 'viper-vi-minibuffer-minor-mode viper-minibuffer-map) + (cons 'viper-vi-local-user-minor-mode viper-vi-local-user-map) + (cons 'viper-vi-kbd-minor-mode viper-vi-kbd-map) + (cons 'viper-vi-global-user-minor-mode viper-vi-global-user-map) + (cons 'viper-vi-state-modifier-minor-mode + (if (keymapp + (cdr (assoc major-mode viper-vi-state-modifier-alist))) + (cdr (assoc major-mode viper-vi-state-modifier-alist)) + viper-empty-keymap)) + (cons 'viper-vi-diehard-minor-mode viper-vi-diehard-map) + (cons 'viper-vi-basic-minor-mode viper-vi-basic-map) (cons 'viper-replace-minor-mode viper-replace-map) ;; viper-insert-minibuffer-minor-mode must come after ;; viper-replace-minor-mode @@ -476,8 +479,6 @@ viper-empty-keymap)) (cons 'viper-insert-diehard-minor-mode viper-insert-diehard-map) (cons 'viper-insert-basic-minor-mode viper-insert-basic-map) - (cons 'viper-emacs-intercept-minor-mode - viper-emacs-intercept-map) (cons 'viper-emacs-local-user-minor-mode viper-emacs-local-user-map) (cons 'viper-emacs-kbd-minor-mode viper-emacs-kbd-map) @@ -490,8 +491,16 @@ (cdr (assoc major-mode viper-emacs-state-modifier-alist)) viper-empty-keymap)) - ) - minor-mode-map-alist))) + )) + + ;; in emacs with emulation-mode-map-alists, nothing needs to be done + (unless + (and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists)) + (setq minor-mode-map-alist + (viper-append-filter-alist + (append viper--intercept-key-maps viper--key-maps) + minor-mode-map-alist))) + ) @@ -1021,7 +1030,7 @@ as a Meta key and any number of multiple escapes is allowed." (not viper-translate-all-ESC-keysequences)) ;; put keys following ESC on the unread list ;; and return ESC as the key-sequence - (viper-set-unread-command-events (subseq keyseq 1)) + (viper-set-unread-command-events (viper-subseq keyseq 1)) (setq last-input-event event keyseq (if viper-emacs-p "\e" @@ -1032,7 +1041,7 @@ as a Meta key and any number of multiple escapes is allowed." (viper-set-unread-command-events (vconcat (vector (character-to-event (event-key first-key))) - (subseq keyseq 1))) + (viper-subseq keyseq 1))) (setq last-input-event event keyseq (vector (character-to-event ?\e)))) ((eventp first-key) @@ -3732,7 +3741,8 @@ Null string will repeat previous search." (interactive "P") (let ((val (viper-P-val arg)) (com (viper-getcom arg)) - (old-str viper-s-string)) + (old-str viper-s-string) + debug-on-error) (setq viper-s-forward t) (viper-if-string "/") ;; this is not used at present, but may be used later @@ -3744,7 +3754,8 @@ Null string will repeat previous search." (if com (progn (viper-move-marker-locally 'viper-com-point (mark t)) - (viper-execute-com 'viper-search-next val com))))) + (viper-execute-com 'viper-search-next val com))) + )) (defun viper-search-backward (arg) "Search a string backward. @@ -3753,7 +3764,8 @@ Null string will repeat previous search." (interactive "P") (let ((val (viper-P-val arg)) (com (viper-getcom arg)) - (old-str viper-s-string)) + (old-str viper-s-string) + debug-on-error) (setq viper-s-forward nil) (viper-if-string "?") ;; this is not used at present, but may be used later @@ -3858,7 +3870,8 @@ Null string will repeat previous search." "Repeat previous search." (interactive "P") (let ((val (viper-p-val arg)) - (com (viper-getcom arg))) + (com (viper-getcom arg)) + debug-on-error) (if (null viper-s-string) (error viper-NoPrevSearch)) (viper-search viper-s-string viper-s-forward arg) (if com @@ -3870,7 +3883,8 @@ Null string will repeat previous search." "Repeat previous search in the reverse direction." (interactive "P") (let ((val (viper-p-val arg)) - (com (viper-getcom arg))) + (com (viper-getcom arg)) + debug-on-error) (if (null viper-s-string) (error viper-NoPrevSearch)) (viper-search viper-s-string (not viper-s-forward) arg) (if com diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el index 6e188f21a9d..8d9aed94770 100644 --- a/lisp/emulation/viper-init.el +++ b/lisp/emulation/viper-init.el @@ -855,15 +855,13 @@ Related buffers can be cycled through via :R and :P commands." (t (:underline t :stipple "gray3"))) "*Face used to flash out the search pattern." :group 'viper-highlighting) -;; backward-compatibility alias -(put 'viper-search-face 'face-alias 'viper-search) ;; An internal variable. Viper takes the face from here. (defvar viper-search-face 'viper-search "Face used to flash out the search pattern. DO NOT CHANGE this variable. Instead, use the customization widget -to customize the actual face object `viper-search-face' +to customize the actual face object `viper-search' this variable represents.") -(viper-hide-face 'viper-search) +(viper-hide-face viper-search-face) (defface viper-replace-overlay @@ -871,15 +869,13 @@ this variable represents.") (t (:underline t :stipple "gray3"))) "*Face for highlighting replace regions on a window display." :group 'viper-highlighting) -;; backward-compatibility alias -(put 'viper-replace-overlay-face 'face-alias 'viper-replace-overlay) ;; An internal variable. Viper takes the face from here. (defvar viper-replace-overlay-face 'viper-replace-overlay "Face for highlighting replace regions on a window display. DO NOT CHANGE this variable. Instead, use the customization widget -to customize the actual face object `viper-replace-overlay-face' +to customize the actual face object `viper-replace-overlay' this variable represents.") -(viper-hide-face 'viper-replace-overlay) +(viper-hide-face viper-replace-overlay-face) (defface viper-minibuffer-emacs @@ -887,15 +883,13 @@ this variable represents.") (t (:weight bold))) "Face used in the Minibuffer when it is in Emacs state." :group 'viper-highlighting) -;; backward-compatibility alias -(put 'viper-minibuffer-emacs-face 'face-alias 'viper-minibuffer-emacs) ;; An internal variable. Viper takes the face from here. (defvar viper-minibuffer-emacs-face 'viper-minibuffer-emacs "Face used in the Minibuffer when it is in Emacs state. DO NOT CHANGE this variable. Instead, use the customization widget -to customize the actual face object `viper-minibuffer-emacs-face' +to customize the actual face object `viper-minibuffer-emacs' this variable represents.") -(viper-hide-face 'viper-minibuffer-emacs) +(viper-hide-face viper-minibuffer-emacs-face) (defface viper-minibuffer-insert @@ -903,15 +897,13 @@ this variable represents.") (t (:slant italic))) "Face used in the Minibuffer when it is in Insert state." :group 'viper-highlighting) -;; backward-compatibility alias -(put 'viper-minibuffer-insert-face 'face-alias 'viper-minibuffer-insert) ;; An internal variable. Viper takes the face from here. (defvar viper-minibuffer-insert-face 'viper-minibuffer-insert "Face used in the Minibuffer when it is in Insert state. DO NOT CHANGE this variable. Instead, use the customization widget -to customize the actual face object `viper-minibuffer-insert-face' +to customize the actual face object `viper-minibuffer-insert' this variable represents.") -(viper-hide-face 'viper-minibuffer-insert) +(viper-hide-face viper-minibuffer-insert-face) (defface viper-minibuffer-vi @@ -919,15 +911,13 @@ this variable represents.") (t (:inverse-video t))) "Face used in the Minibuffer when it is in Vi state." :group 'viper-highlighting) -;; backward-compatibility alias -(put 'viper-minibuffer-vi-face 'face-alias 'viper-minibuffer-vi) ;; An internal variable. Viper takes the face from here. (defvar viper-minibuffer-vi-face 'viper-minibuffer-vi "Face used in the Minibuffer when it is in Vi state. DO NOT CHANGE this variable. Instead, use the customization widget -to customize the actual face object `viper-minibuffer-vi-face' +to customize the actual face object `viper-minibuffer-vi' this variable represents.") -(viper-hide-face 'viper-minibuffer-vi) +(viper-hide-face viper-minibuffer-vi-face) ;; the current face to be used in the minibuffer (viper-deflocalvar diff --git a/lisp/emulation/viper-keym.el b/lisp/emulation/viper-keym.el index e83cf14776f..1bbf3dce2c2 100644 --- a/lisp/emulation/viper-keym.el +++ b/lisp/emulation/viper-keym.el @@ -50,25 +50,6 @@ ;;; Variables -(defcustom viper-toggle-key "\C-z" - "The key used to change states from emacs to Vi and back. -In insert mode, this key also functions as Meta. -Must be set in .viper file or prior to loading Viper. -This setting cannot be changed interactively." - :type 'string - :group 'viper) - -(defcustom viper-quoted-insert-key "\C-v" - "The key used to quote special characters when inserting them in Insert state." - :type 'string - :group 'viper) - -(defcustom viper-ESC-key "\e" - "Key used to ESC. -Must be set in .viper file or prior to loading Viper. -This setting cannot be changed interactively." - :type 'string - :group 'viper) ;;; Emacs keys in other states. @@ -176,6 +157,78 @@ viper-insert-basic-map. Not recommended, except for novice users.") ;; and, after .viper is loaded, we add this keymap to viper-vi-basic-map. (defvar viper-mode-map (make-sparse-keymap)) +;; Some important keys used in viper +(defcustom viper-toggle-key [(control ?z)] ; "\C-z" + "The key used to change states from emacs to Vi and back. +In insert mode, this key also functions as Meta. + +Enter as a sexp. Examples: \"\\C-z\", [(control ?z)]." + :type 'sexp + :group 'viper + :set (lambda (symbol value) + (let ((old-value (if (boundp 'viper-toggle-key) + viper-toggle-key + [(control ?z)]))) + (mapcar + (lambda (buf) + (save-excursion + (set-buffer buf) + (when (and (boundp 'viper-insert-basic-map) + (keymapp viper-insert-basic-map)) + (when old-value + (define-key viper-insert-basic-map old-value nil)) + (define-key viper-insert-basic-map value 'viper-escape-to-vi)) + (when (and (boundp 'viper-vi-intercept-map) + (keymapp viper-vi-intercept-map)) + (when old-value + (define-key viper-vi-intercept-map old-value nil)) + (define-key + viper-vi-intercept-map value 'viper-toggle-key-action)) + (when (and (boundp 'viper-emacs-intercept-map) + (keymapp viper-emacs-intercept-map)) + (define-key viper-emacs-intercept-map old-value nil) + (define-key + viper-emacs-intercept-map value 'viper-change-state-to-vi)) + )) + (buffer-list)) + (set-default symbol value) + ))) + +(defcustom viper-quoted-insert-key "\C-v" + "The key used to quote special characters when inserting them in Insert state." + :type 'string + :group 'viper) + +(defcustom viper-ESC-key [(escape)] ; "\e" + "Key used to ESC. +Enter as a sexp. Examples: \"\\e\", [(escape)]." + :type 'sexp + :group 'viper + :set (lambda (symbol value) + (let ((old-value (if (boundp 'viper-ESC-key) + viper-ESC-key + [(escape)]))) + (mapcar + (lambda (buf) + (save-excursion + (set-buffer buf) + (when (and (boundp 'viper-insert-intercept-map) + (keymapp viper-insert-intercept-map)) + (when old-value + (define-key viper-insert-intercept-map old-value nil)) + (define-key + viper-insert-intercept-map value 'viper-intercept-ESC-key)) + (when (and (boundp 'viper-vi-intercept-map) + (keymapp viper-vi-intercept-map)) + (when old-value + (define-key viper-vi-intercept-map old-value nil)) + (define-key + viper-vi-intercept-map value 'viper-intercept-ESC-key)) + )) + (buffer-list)) + (set-default symbol value) + ))) + ;;; Variables used by minor modes @@ -197,6 +250,10 @@ viper-insert-basic-map. Not recommended, except for novice users.") ;; to its Emacs state in various major modes. (defvar viper-emacs-state-modifier-alist nil) +;; The list of viper keymaps. Set by viper-normalize-minor-mode-map-alist +(viper-deflocalvar viper--key-maps nil) +(viper-deflocalvar viper--intercept-key-maps nil) + ;; Tells viper-add-local-keys to create a new viper-vi-local-user-map for new ;; buffers. Not a user option. (viper-deflocalvar viper-need-new-vi-local-map t "") @@ -509,7 +566,7 @@ Usage: (defun viper-zap-local-keys () "Unconditionally reset Viper viper-*-local-user-map's. -Rarely useful, but if u made a mistake by switching to a mode that adds +Rarely useful, but if you made a mistake by switching to a mode that adds undesirable local keys, e.g., comint-mode, then this function can restore sanity." (interactive) diff --git a/lisp/emulation/viper-macs.el b/lisp/emulation/viper-macs.el index 8a3ce5db9eb..6d79ddec043 100644 --- a/lisp/emulation/viper-macs.el +++ b/lisp/emulation/viper-macs.el @@ -178,7 +178,7 @@ a key is a symbol, e.g., `a', `\\1', `f2', etc., or a list, e.g., (if (member key '(?\b ?\d '^? '^H (control h) (control \?) backspace delete)) - (setq key-seq (subseq key-seq 0 (- (length key-seq) 2)))) + (setq key-seq (viper-subseq key-seq 0 (- (length key-seq) 2)))) (setq message (format ":map%s %s" @@ -242,9 +242,9 @@ a key is a symbol, e.g., `a', `\\1', `f2', etc., or a list, e.g., (cond ((member key '(?\b ?\d '^? '^H (control h) (control \?) backspace delete)) - (setq key-seq (subseq key-seq 0 (- (length key-seq) 2)))) + (setq key-seq (viper-subseq key-seq 0 (- (length key-seq) 2)))) ((member key '(tab (control i) ?\t)) - (setq key-seq (subseq key-seq 0 (1- (length key-seq)))) + (setq key-seq (viper-subseq key-seq 0 (1- (length key-seq)))) (setq message (format ":unmap%s %s" @@ -618,7 +618,7 @@ name from there." (if (null macro-alist-elt) (setq macro-alist-elt (car next-best-match) - unmatched-suffix (subseq event-seq (cdr next-best-match)))) + unmatched-suffix (viper-subseq event-seq (cdr next-best-match)))) (cond ((null macro-alist-elt)) ((setq macro-body (viper-kbd-buf-definition macro-alist-elt))) @@ -701,7 +701,7 @@ name from there." (let ((len1 (length seq1)) (len2 (length seq2))) (if (<= len1 len2) - (equal seq1 (subseq seq2 0 len1))))) + (equal seq1 (viper-subseq seq2 0 len1))))) ;; find the longest common prefix (defun viper-common-seq-prefix (&rest seqs) @@ -766,7 +766,7 @@ name from there." (setq macro-def (car lis) def-len (length (car macro-def))) (if (and (>= str-len def-len) - (equal (car macro-def) (subseq str 0 def-len))) + (equal (car macro-def) (viper-subseq str 0 def-len))) (if (or (viper-kbd-buf-definition macro-def) (viper-kbd-mode-definition macro-def) (viper-kbd-global-definition macro-def)) diff --git a/lisp/emulation/viper-mous.el b/lisp/emulation/viper-mous.el index 503cd145796..77c5f844567 100644 --- a/lisp/emulation/viper-mous.el +++ b/lisp/emulation/viper-mous.el @@ -65,7 +65,7 @@ (defvar viper-frame-of-focus nil) ;; Frame that was selected before the switch-frame event. -(defconst viper-current-frame-saved (selected-frame)) +(defvar viper-current-frame-saved (selected-frame)) (defcustom viper-surrounding-word-function 'viper-surrounding-word "*Function that determines what constitutes a word for clicking events. diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el index 2d713df6ef6..d6fe9b43a64 100644 --- a/lisp/emulation/viper-util.el +++ b/lisp/emulation/viper-util.el @@ -41,7 +41,6 @@ (defvar viper-syntax-preference) (defvar viper-saved-mark) -(require 'cl) (require 'ring) (if noninteractive @@ -1068,7 +1067,7 @@ (t key))) ((listp key) - (setq modifiers (subseq key 0 (1- (length key))) + (setq modifiers (viper-subseq key 0 (1- (length key))) base-key (viper-seq-last-elt key) base-key-name (symbol-name base-key) char-p (= (length base-key-name) 1)) @@ -1503,6 +1502,33 @@ This option is appropriate if you like Emacs-style words." )) +;; this is copied from cl-extra.el +;; Return the subsequence of SEQ from START to END. +;; If END is omitted, it defaults to the length of the sequence. +;; If START or END is negative, it counts from the end. +(defun viper-subseq (seq start &optional end) + (if (stringp seq) (substring seq start end) + (let (len) + (and end (< end 0) (setq end (+ end (setq len (length seq))))) + (if (< start 0) (setq start (+ start (or len (setq len (length seq)))))) + (cond ((listp seq) + (if (> start 0) (setq seq (nthcdr start seq))) + (if end + (let ((res nil)) + (while (>= (setq end (1- end)) start) + (push (pop seq) res)) + (nreverse res)) + (copy-sequence seq))) + (t + (or end (setq end (or len (length seq)))) + (let ((res (make-vector (max (- end start) 0) nil)) + (i 0)) + (while (< start end) + (aset res i (aref seq start)) + (setq i (1+ i) start (1+ start))) + res)))))) + + (provide 'viper-util) diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el index fe65cb69cbb..3a95fa26835 100644 --- a/lisp/emulation/viper.el +++ b/lisp/emulation/viper.el @@ -8,7 +8,7 @@ ;; Author: Michael Kifer ;; Keywords: emulations -(defconst viper-version "3.11.4 of February 19, 2005" +(defconst viper-version "3.11.5 of July 8, 2005" "The current version of Viper") ;; This file is part of GNU Emacs. @@ -320,6 +320,7 @@ ;; end pacifier (require 'viper-init) +(require 'viper-keym) ;; better be defined before Viper custom group. (defvar viper-custom-file-name (convert-standard-filename "~/.viper") @@ -691,6 +692,12 @@ remains buffer-local." (setq viper-mode nil) + (when (and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists)) + (setq emulation-mode-map-alists + (delq 'viper--intercept-key-maps + (delq 'viper--key-maps emulation-mode-map-alists)) + )) + (viper-delocalize-var 'viper-vi-minibuffer-minor-mode) (viper-delocalize-var 'viper-insert-minibuffer-minor-mode) (viper-delocalize-var 'viper-vi-intercept-minor-mode) @@ -874,9 +881,27 @@ remains buffer-local." "Switch to emacs state while reading password." (viper-change-state-to-emacs))) + (defadvice self-insert-command (around viper-self-insert-ad activate) + "Ignore all self-inserting keys in the vi-state." + (if (and (eq viper-current-state 'vi-state) (interactive-p)) + (beep 1) + ad-do-it + )) + + (when (and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists)) + ;; needs to be as early as possible + (add-to-ordered-list + 'emulation-mode-map-alists 'viper--intercept-key-maps 100) + ;; needs to be after cua-mode + (add-to-ordered-list 'emulation-mode-map-alists 'viper--key-maps 500) + ) + ;; Emacs shell, ange-ftp, and comint-based modes (add-hook 'comint-mode-hook 'viper-comint-mode-hook) ; comint + (add-hook 'eshell-mode-hook + (lambda () (setq viper-auto-indent nil))) + (viper-set-emacs-state-searchstyle-macros nil 'dired-mode) ; dired (viper-set-emacs-state-searchstyle-macros nil 'tar-mode) ; tar (viper-set-emacs-state-searchstyle-macros nil 'mh-folder-mode) ; mhe @@ -1058,6 +1083,14 @@ remains buffer-local." (define-key viper-insert-intercept-map "\C-x)" nil) (define-key viper-emacs-intercept-map "\C-x)" nil)) + (defadvice add-minor-mode (after + viper-advice-add-minor-mode + (toggle name &optional keymap after toggle-fun) + activate) + "Run viper-normalize-minor-mode-map-alist after adding a minor mode." + (viper-normalize-minor-mode-map-alist) + (setq-default minor-mode-map-alist minor-mode-map-alist)) + ;; catch frame switching event (if (viper-window-display-p) (if viper-xemacs-p diff --git a/man/viper.texi b/man/viper.texi index 7b3a888c8ca..0156c4c6387 100644 --- a/man/viper.texi +++ b/man/viper.texi @@ -4502,6 +4502,7 @@ kin@@isi.com (Kin Cho), kwzh@@gnu.org (Karl Heuer), lindstro@@biostat.wisc.edu (Mary Lindstrom), lektu@@terra.es (Juanma Barranquero), +lennart.borgman.073@@student.lu.se (Lennart Borgman), minakaji@@osaka.email.ne.jp (Mikio Nakajima), Mark.Bordas@@East.Sun.COM (Mark Bordas), meyering@@comco.com (Jim Meyering), @@ -4519,6 +4520,7 @@ sawdey@@lcse.umn.edu (Aaron Sawdey), simonb@@prl.philips.co.uk (Simon Blanchard), spadgett1@@nc.rr.com (Samuel Padgett), stephen@@farrell.org (Stephen Farrell), +storm@@cua.dk (Kim F. Storm), sudish@@MindSpring.COM (Sudish Joseph), schwab@@issan.informatik.uni-dortmund.de (Andreas Schwab) terra@@diku.dk (Morten Welinder), -- 2.11.4.GIT