From: Michael Kifer Date: Sat, 13 Oct 2001 21:38:19 +0000 (+0000) Subject: 2001-10-13 Michael Kifer X-Git-Tag: ttn-vms-21-2-B4~19461 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2d341681c8d30b58e3235cb7fe2042218426479d;p=emacs.git 2001-10-13 Michael Kifer * viper-ex.el (ex-edit): make checks for modified buffer/file. (viper-get-ex-address-subr): more precise addr for the $ marker * viper-cmd.el: Fixed indentation. * viper.texi: Clarified that viper won't expand special symbols in search patterns. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f5b2c02e301..2a8ff46e21d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2001-10-13 Michael Kifer + + * viper-ex.el (ex-edit): make checks for modified buffer/file. + (viper-get-ex-address-subr): more precise addr for the $ marker + 2001-10-13 Eli Zaretskii * version.el (emacs-version): Bump to 21.1.50. diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index f7f2e3f853d..0df2022ae04 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el @@ -2554,22 +2554,23 @@ These keys are ESC, RET, and LineFeed" (or (eq viper-intermediate-command 'viper-repeat) (viper-special-read-and-insert-char)) - (if (eq char ?\C-m) (setq char ?\n)) - - (delete-char 1 t) - - (setq char (if com viper-d-char (viper-char-at-pos 'backward))) - (if com (insert char)) - - (setq viper-d-char char) - - (viper-loop (1- (if (> arg 0) arg (- arg))) - (delete-char 1 t) - (insert char)) - - (viper-adjust-undo) - (backward-char arg) - )) + ;; Is this needed? + (if (eq char ?\C-m) (setq char ?\n)) + + (delete-char 1 t) + + (setq char (if com viper-d-char (viper-char-at-pos 'backward))) + (if com (insert char)) + + (setq viper-d-char char) + + (viper-loop (1- (if (> arg 0) arg (- arg))) + (delete-char 1 t) + (insert char)) + + (viper-adjust-undo) + (backward-char arg) + )) ;; basic cursor movement. j, k, l, h commands. diff --git a/lisp/emulation/viper-ex.el b/lisp/emulation/viper-ex.el index 1ae136a067e..1ee912eb18c 100644 --- a/lisp/emulation/viper-ex.el +++ b/lisp/emulation/viper-ex.el @@ -716,6 +716,8 @@ reversed." ;; Get a regular expression and set `ex-variant', if found +;; Viper doesn't parse the substitution or search patterns. +;; In particular, it doesn't expand ~ into the last substitution. (defun viper-get-ex-pat () (save-window-excursion (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name)) @@ -848,7 +850,9 @@ reversed." (forward-line (1- ex-token)) (setq address (point-marker))))) ((eq ex-token-type 'end) - (setq address (point-max-marker))) + (save-excursion + (goto-char (1- (point-max))) + (setq address (point-marker)))) ((eq ex-token-type 'plus) t) ; do nothing ((eq ex-token-type 'minus) t) ; do nothing ((eq ex-token-type 'search-forward) @@ -871,6 +875,7 @@ reversed." ;; Search pattern and set address +;; Doesn't wrap around. Should it? (defun ex-search-address (forward) (if (string= ex-token "") (if (null viper-s-string) @@ -1251,27 +1256,27 @@ reversed." ((string= ex-file "") (error viper-NoFileSpecified))) -;;; (let (msg do-edit) -;;; (if buffer-file-name -;;; (cond ((buffer-modified-p) -;;; (setq msg -;;; (format "Buffer %s is modified. Discard changes? " -;;; (buffer-name)) -;;; do-edit t)) -;;; ((not (verify-visited-file-modtime (current-buffer))) -;;; (setq msg -;;; (format "File %s changed on disk. Reread from disk? " -;;; buffer-file-name) -;;; do-edit t)) -;;; (t (setq do-edit nil)))) -;;; -;;; (if do-edit -;;; (if (yes-or-no-p msg) -;;; (progn -;;; (set-buffer-modified-p nil) -;;; (kill-buffer (current-buffer))) -;;; (message "Buffer %s was left intact" (buffer-name)))) -;;; ) ; let + (let (msg do-edit) + (if buffer-file-name + (cond ((buffer-modified-p) + (setq msg + (format "Buffer %s is modified. Discard changes? " + (buffer-name)) + do-edit t)) + ((not (verify-visited-file-modtime (current-buffer))) + (setq msg + (format "File %s changed on disk. Reread from disk? " + buffer-file-name) + do-edit t)) + (t (setq do-edit nil)))) + + (if do-edit + (if (yes-or-no-p msg) + (progn + (set-buffer-modified-p nil) + (kill-buffer (current-buffer))) + (message "Buffer %s was left intact" (buffer-name)))) + ) ; let (if (null (setq file (get-file-buffer ex-file))) (progn diff --git a/man/ChangeLog b/man/ChangeLog index 46b758981ed..4549c8d62eb 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,8 @@ +2001-10-13 Michael Kifer + + * viper.texi: Clarified that viper won't expand special symbols in + search patterns. + 2001-10-05 Gerd Moellmann * Branch for 21.1. diff --git a/man/viper.texi b/man/viper.texi index 2504bb2b539..a390b585077 100644 --- a/man/viper.texi +++ b/man/viper.texi @@ -3210,8 +3210,9 @@ syntax tables in order to not thwart the various major modes that set these tables. The usual Emacs convention is used to indicate Control Characters, i.e -C-h for Control-h. @emph{Do not confuse this to mean the separate -characters C - h!!!} The @kbd{^} is itself, never used to indicate a +C-h for Control-h. @emph{Do not confuse this with a sequence of separate +characters +C, -, h!!!} The @kbd{^} is itself, never used to indicate a Control character. Finally, we note that Viper's Ex-style commands can be made to work on the @@ -3680,6 +3681,10 @@ In Emacs, @samp{\&} stands for the last matched expression, so @kbd{s/[ab]+/\&\&/} will double the string matched by @kbd{[ab]}. Viper doesn't treat @samp{&} specially, unlike Vi: use @samp{\&} instead. +Viper does not parse search patterns and does not expand special symbols +found there (e.g., @samp{~} is not expanded to the result of the previous +substitution). + Note: @emph{The newline character (inserted as @kbd{C-qC-j}) can be used in }. @item :[x,y]copy [z] @@ -3745,6 +3750,11 @@ wrapping around. @table @kbd @item / To the th occurrence of . + +Viper does not parse search patterns and does not expand special symbols +found there (e.g., @samp{~} is not expanded to the result of the previous +substitution). + @item ? To the th previous occurrence of . @item g