changeset 51606:bee14d8ec0a6

(kill-new): Leave yank-handler property alone if no explicit yank-handler is specified. (vis-mode-saved-buffer-invisibility-spec): Rename from saved-buffer-invisibility-spec. (vis-mode): Correctly handle the case where the mode is turned on or off several times in a row.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 17 Jun 2003 18:40:06 +0000
parents 4b43c69f3ae3
children ead411a37669
files lisp/simple.el
diffstat 1 files changed, 9 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Tue Jun 17 18:30:34 2003 +0000
+++ b/lisp/simple.el	Tue Jun 17 18:40:06 2003 +0000
@@ -1811,8 +1811,7 @@
 argument should still be a \"useful\" string for such uses."
   (if (> (length string) 0)
       (if yank-handler
-	  (put-text-property 0 1 'yank-handler yank-handler string)
-	(remove-list-of-text-properties 0 1 '(yank-handler) string))
+	  (put-text-property 0 1 'yank-handler yank-handler string))
     (if yank-handler
 	(signal 'args-out-of-range
 		(list string "yank-handler specified for empty string"))))
@@ -4481,9 +4480,7 @@
   :group 'display
   :version "21.4")
 
-(make-variable-buffer-local 'saved-buffer-invisibility-spec)
-
-(defvar saved-buffer-invisibility-spec nil
+(defvar vis-mode-saved-buffer-invisibility-spec nil
   "Saved value of buffer-invisibility-spec when `vis-mode' is on.")
 
 (define-minor-mode vis-mode
@@ -4498,12 +4495,13 @@
 Disabling vis-mode restores the saved value of
 `buffer-invisibility-spec'."
   :lighter " Vis"
-  (if vis-mode
-      (progn
-	(setq saved-buffer-invisibility-spec buffer-invisibility-spec
-	      buffer-invisibility-spec nil))
-    (setq buffer-invisibility-spec saved-buffer-invisibility-spec
-	  saved-buffer-invisibility-spec nil)))
+  (when (local-variable-p 'vis-mode-saved-buffer-invisibility-spec)
+    (setq buffer-invisibility-spec vis-mode-saved-buffer-invisibility-spec)
+    (kill-local-variable 'vis-mode-saved-buffer-invisibility-spec))
+  (when vis-mode
+    (set (make-local-variable 'vis-mode-saved-buffer-invisibility-spec)
+	 buffer-invisibility-spec)
+    (setq buffer-invisibility-spec nil)))
 
 ;; Minibuffer prompt stuff.