changeset 39901:50f67a72ea1b

2001-10-13 Michael Kifer <kifer@cs.sunysb.edu> * 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.
author Michael Kifer <kifer@cs.stonybrook.edu>
date Sat, 13 Oct 2001 21:38:19 +0000
parents a0315327e2ed
children 3d58b287893c
files lisp/ChangeLog lisp/emulation/viper-cmd.el lisp/emulation/viper-ex.el man/ChangeLog man/viper.texi
diffstat 5 files changed, 66 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Oct 13 20:45:55 2001 +0000
+++ b/lisp/ChangeLog	Sat Oct 13 21:38:19 2001 +0000
@@ -1,3 +1,8 @@
+2001-10-13  Michael Kifer  <kifer@cs.sunysb.edu>
+	
+	* 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  <eliz@is.elta.co.il>
 
 	* version.el (emacs-version): Bump to 21.1.50.
--- a/lisp/emulation/viper-cmd.el	Sat Oct 13 20:45:55 2001 +0000
+++ b/lisp/emulation/viper-cmd.el	Sat Oct 13 21:38:19 2001 +0000
@@ -2554,22 +2554,23 @@
     (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.
--- a/lisp/emulation/viper-ex.el	Sat Oct 13 20:45:55 2001 +0000
+++ b/lisp/emulation/viper-ex.el	Sat Oct 13 21:38:19 2001 +0000
@@ -716,6 +716,8 @@
       
 
 ;; 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 @@
 	       (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 @@
 
 
 ;; 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 @@
 	((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 
--- a/man/ChangeLog	Sat Oct 13 20:45:55 2001 +0000
+++ b/man/ChangeLog	Sat Oct 13 21:38:19 2001 +0000
@@ -1,3 +1,8 @@
+2001-10-13  Michael Kifer  <kifer@cs.sunysb.edu>
+	
+	* viper.texi: Clarified that viper won't expand special symbols in
+	search patterns.
+	
 2001-10-05  Gerd Moellmann  <gerd@gnu.org>
 
 	* Branch for 21.1.
--- a/man/viper.texi	Sat Oct 13 20:45:55 2001 +0000
+++ b/man/viper.texi	Sat Oct 13 21:38:19 2001 +0000
@@ -3210,8 +3210,9 @@
 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 @@
 @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 <repl>}.
 @item  :[x,y]copy [z]
@@ -3745,6 +3750,11 @@
 @table @kbd
 @item <count>  /<string>
 To the <count>th occurrence of <string>.
+
+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 <count>  ?<string>
 To the <count>th previous occurrence of <string>.
 @item <count>  g<move>