diff lisp/viper/viper-ex.el @ 26:441bb1e64a06 r19-15b96

Import from CVS: tag r19-15b96
author cvs
date Mon, 13 Aug 2007 08:51:32 +0200
parents 0293115a14e9
children 131b0175ea99
line wrap: on
line diff
--- a/lisp/viper/viper-ex.el	Mon Aug 13 08:51:05 2007 +0200
+++ b/lisp/viper/viper-ex.el	Mon Aug 13 08:51:32 2007 +0200
@@ -1878,6 +1878,7 @@
 	(beg (car (cdr ex-addresses))) 
 	(orig-buf (current-buffer))
 	(orig-buf-file-name (buffer-file-name))
+	(orig-buf-name (buffer-name))
 	(buff-changed-p (buffer-modified-p))
 	temp-buf writing-same-file region
 	file-exists writing-whole-file)
@@ -1929,7 +1930,13 @@
 		     (save-buffer))
 		 ;; restore the buffer file name
 		 (set-visited-file-name orig-buf-file-name)
-		 (set-buffer-modified-p buff-changed-p))
+		 (set-buffer-modified-p buff-changed-p)
+		 ;; If the buffer wasn't visiting a file, restore buffer name.
+		 ;; Name could've been changed by packages such as uniquify.
+		 (or orig-buf-file-name
+		     (progn
+		       (unlock-buffer)
+		       (rename-buffer orig-buf-name))))
 	       (save-restriction
 		 (widen)
 		 (ex-write-info