summaryrefslogtreecommitdiff
path: root/lisp/emulation
diff options
context:
space:
mode:
authorMichael Kifer <kifer@cs.stonybrook.edu>2005-09-20 17:47:28 +0000
committerMichael Kifer <kifer@cs.stonybrook.edu>2005-09-20 17:47:28 +0000
commit15c77b9ecd23bfcb6c831bbc25d35ec8d0723fad (patch)
tree65a1226ad4376299b55254a51ccf406c445ac5e7 /lisp/emulation
parent41ea4df8c30cb9c1c7254188c5aa812d9875f383 (diff)
downloademacs-15c77b9ecd23bfcb6c831bbc25d35ec8d0723fad.tar.gz
2005-09-20 Michael Kifer <kifer@cs.stonybrook.edu>
* ediff-ptch.el (ediff-file-name-sans-prefix): treat nil as an empty string. (ediff-fixup-patch-map): better heuristic for intuiting the file names to patch. (ediff-prompt-for-patch-file): more intuitive prompt. * ediff-util.el: use insert-buffer-substring. * ediff-vers.el (cvs-run-ediff-on-file-descriptor): bug fix. * viper-cmd.el (viper-change-state): don't move over the field boundaries in the minibuffer. (viper-set-minibuffer-style): add viper-minibuffer-post-command-hook. (viper-minibuffer-post-command-hook): new hook. (viper-line): don't move cursor at bolp. * viper-ex.el (ex-pwd, viper-info-on-file): fixed message * viper-init.el: add alias to make-variable-buffer-local to avoid compiler warnings. * viper-macs.el (ex-map): better messages. * viper-utils.el (viper-beginning-of-field): new function. * viper.el: replace make-variable-buffer-local with viper-make-variable-buffer-local everywhere, to avoid warnings.
Diffstat (limited to 'lisp/emulation')
-rw-r--r--lisp/emulation/viper-cmd.el12
-rw-r--r--lisp/emulation/viper-init.el5
-rw-r--r--lisp/emulation/viper-macs.el8
-rw-r--r--lisp/emulation/viper-util.el8
-rw-r--r--lisp/emulation/viper.el9
5 files changed, 29 insertions, 13 deletions
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el
index 99a130e7f1d..7d2e10a8f31 100644
--- a/lisp/emulation/viper-cmd.el
+++ b/lisp/emulation/viper-cmd.el
@@ -358,7 +358,7 @@
'viper-insertion-ring))
(if viper-ESC-moves-cursor-back
- (or (bolp) (backward-char 1))))
+ (or (bolp) (viper-beginning-of-field) (backward-char 1))))
))
;; insert or replace
@@ -1996,7 +1996,8 @@ Undo previous insertion and inserts new."
;;; Minibuffer business
(defsubst viper-set-minibuffer-style ()
- (add-hook 'minibuffer-setup-hook 'viper-minibuffer-setup-sentinel))
+ (add-hook 'minibuffer-setup-hook 'viper-minibuffer-setup-sentinel)
+ (add-hook 'post-command-hook 'viper-minibuffer-post-command-hook))
(defun viper-minibuffer-setup-sentinel ()
@@ -2039,6 +2040,11 @@ Undo previous insertion and inserts new."
(minibuffer-prompt-end)
(point-min)))
+(defun viper-minibuffer-post-command-hook()
+ (when (active-minibuffer-window)
+ (when (< (point) (viper-minibuffer-real-start))
+ (goto-char (viper-minibuffer-real-start)))))
+
;; Interpret last event in the local map first; if fails, use exit-minibuffer.
;; Run viper-minibuffer-exit-hook before exiting.
@@ -2570,7 +2576,7 @@ These keys are ESC, RET, and LineFeed"
;; last line of buffer when this line has no \n.
(viper-add-newline-at-eob-if-necessary)
(viper-execute-com 'viper-line val com))
- (if (and (eobp) (not (bobp))) (forward-line -1))
+ (if (and (eobp) (bolp) (not (bobp))) (forward-line -1))
)
(defun viper-yank-line (arg)
diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el
index 9c1df1b0ad5..8aa7e4649d4 100644
--- a/lisp/emulation/viper-init.el
+++ b/lisp/emulation/viper-init.el
@@ -115,6 +115,11 @@ In all likelihood, you don't need to bother with this setting."
;;; Macros
+;; Fool the compiler to avoid warnings.
+;; Viper calls make-variable-buffer-local from within other functions, which
+;; triggers compiler warnings.
+(defalias 'viper-make-variable-buffer-local 'make-variable-buffer-local)
+
(defmacro viper-deflocalvar (var default-value &optional documentation)
`(progn
(defvar ,var ,default-value
diff --git a/lisp/emulation/viper-macs.el b/lisp/emulation/viper-macs.el
index 9349a950e97..d401c148ad6 100644
--- a/lisp/emulation/viper-macs.el
+++ b/lisp/emulation/viper-macs.el
@@ -118,7 +118,7 @@ a key is a symbol, e.g., `a', `\\1', `f2', etc., or a list, e.g.,
(define-key viper-vi-intercept-map "\C-x)" 'viper-end-mapping-kbd-macro)
(define-key viper-insert-intercept-map "\C-x)" 'viper-end-mapping-kbd-macro)
(define-key viper-emacs-intercept-map "\C-x)" 'viper-end-mapping-kbd-macro)
- (message "Mapping %S in %s state. Hit `C-x )' to complete the mapping"
+ (message "Mapping %S in %s state. Type macro definition followed by `C-x )'"
(viper-display-macro macro-name)
(if ins "Insert" "Vi")))
))
@@ -170,7 +170,7 @@ a key is a symbol, e.g., `a', `\\1', `f2', etc., or a list, e.g.,
((stringp macro-name)
(setq macro-name (vconcat macro-name)))
(t (setq macro-name (vconcat (prin1-to-string macro-name)))))
- (message ":map%s <Name>" variant)(sit-for 2)
+ (message ":map%s <Macro Name>" variant)(sit-for 2)
(while
(not (member key
'(?\C-m ?\n (control m) (control j) return linefeed)))
@@ -442,10 +442,6 @@ If SCOPE is nil, the user is asked to specify the scope."
scope)
viper-custom-file-name))
- ;; 2005-09-18 T06:41:22-0400 (Sunday) D. Goel
- ;; From careful parsing of the above code, it looks like msg
- ;; couldn't be nil when we reach here. Since it is a string,
- ;; and a complicated one too, we might as well provide it a "%s"
(message "%s" msg)
))
diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el
index cc9f42b9800..d0b9b34e4d6 100644
--- a/lisp/emulation/viper-util.el
+++ b/lisp/emulation/viper-util.el
@@ -1405,6 +1405,7 @@ This option is appropriate if you like Emacs-style words."
viper-SEP-char-class
(or within-line "\n")
(if within-line (viper-line-pos 'end)))))
+
(defsubst viper-skip-all-separators-backward (&optional within-line)
(if (eq viper-syntax-preference 'strict-vi)
(if within-line
@@ -1433,6 +1434,7 @@ This option is appropriate if you like Emacs-style words."
;; Emacs may consider some of these as words, but we don't want them
viper-non-word-characters
(viper-line-pos 'end))))
+
(defun viper-skip-nonalphasep-backward ()
(if (eq viper-syntax-preference 'strict-vi)
(skip-chars-backward
@@ -1502,6 +1504,12 @@ This option is appropriate if you like Emacs-style words."
total
))
+;; tells when point is at the beginning of field
+(defun viper-beginning-of-field ()
+ (or (bobp)
+ (not (eq (get-char-property (point) 'field)
+ (get-char-property (1- (point)) 'field)))))
+
;; this is copied from cl-extra.el
;; Return the subsequence of SEQ from START to END.
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el
index bfa730cc434..b3fd6d139c0 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.11.5 of August 6, 2005"
+(defconst viper-version "3.11.5 of September 19, 2005"
"The current version of Viper")
;; This file is part of GNU Emacs.
@@ -606,7 +606,7 @@ This startup message appears whenever you load Viper, unless you type `y' now."
(viper-set-expert-level 'dont-change-unless)))
(if viper-xemacs-p
- (make-variable-buffer-local 'bar-cursor))
+ (viper-make-variable-buffer-local 'bar-cursor))
(if (eq major-mode 'viper-mode)
(setq major-mode 'fundamental-mode))
@@ -769,6 +769,7 @@ It also can't undo some Viper settings."
(remove-hook 'comint-mode-hook 'viper-comint-mode-hook)
(remove-hook 'minibuffer-setup-hook 'viper-minibuffer-setup-sentinel)
(remove-hook 'change-major-mode-hook 'viper-major-mode-change-sentinel)
+ (remove-hook 'post-command-hook 'viper-minibuffer-post-command-hook)
;; unbind Viper mouse bindings
(viper-unbind-mouse-search-key)
@@ -1008,7 +1009,7 @@ It also can't undo some Viper settings."
;; ***This is needed only in case emulation-mode-map-alists is not defined
(unless
(and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists))
- (make-variable-buffer-local 'minor-mode-map-alist))
+ (viper-make-variable-buffer-local 'minor-mode-map-alist))
;; Viper changes the default mode-line-buffer-identification
(setq-default mode-line-buffer-identification '(" %b"))
@@ -1017,7 +1018,7 @@ It also can't undo some Viper settings."
(setq next-line-add-newlines nil
require-final-newline t)
- (make-variable-buffer-local 'require-final-newline)
+ (viper-make-variable-buffer-local 'require-final-newline)
;; don't bark when mark is inactive
(if viper-emacs-p