changeset 63866:8fe9596925cd

(set-variable): Warn about obsolete user variables.
author Juanma Barranquero <lekktu@gmail.com>
date Wed, 29 Jun 2005 23:48:58 +0000
parents a473419e315e
children f3e6b99200bc
files lisp/simple.el
diffstat 1 files changed, 20 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Wed Jun 29 23:29:01 2005 +0000
+++ b/lisp/simple.el	Wed Jun 29 23:48:58 2005 +0000
@@ -4538,22 +4538,29 @@
 		      (read-variable "Set variable: ")))
 	  (minibuffer-help-form '(describe-variable var))
 	  (prop (get var 'variable-interactive))
-	  (prompt (format "Set %s%s to value: " var
+          (obsolete (car (get var 'byte-obsolete-variable)))
+	  (prompt (format "Set %s %s to value: " var
 			  (cond ((local-variable-p var)
-				 " (buffer-local)")
+				 "(buffer-local)")
 				((or current-prefix-arg
 				     (local-variable-if-set-p var))
-				 " buffer-locally")
-				(t " globally"))))
-	  (val (if prop
-		   ;; Use VAR's `variable-interactive' property
-		   ;; as an interactive spec for prompting.
-		   (call-interactively `(lambda (arg)
-					  (interactive ,prop)
-					  arg))
-		 (read
-		  (read-string prompt nil
-			       'set-variable-value-history)))))
+				 "buffer-locally")
+				(t "globally"))))
+	  (val (progn
+                 (when obsolete
+                   (message (concat "`%S' is obsolete; "
+                                    (if (symbolp obsolete) "use `%S' instead" "%s"))
+                            var obsolete)
+                   (sit-for 3))
+                 (if prop
+                     ;; Use VAR's `variable-interactive' property
+                     ;; as an interactive spec for prompting.
+                     (call-interactively `(lambda (arg)
+                                            (interactive ,prop)
+                                            arg))
+                   (read
+                    (read-string prompt nil
+                                 'set-variable-value-history))))))
      (list var val current-prefix-arg)))
 
   (and (custom-variable-p variable)