changeset 49556:e8de2a4807e5

(custom-unlispify-menu-entry): Use with-current-buffer. (custom-save-variables): Use dolist, simplify. Output a message if a `requests' entry looks suspicious. (custom-save-faces): Use dolist, simplify.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 01 Feb 2003 00:39:58 +0000
parents 4d20af97e0f8
children 8fbfb61ab3f4
files lisp/cus-edit.el
diffstat 1 files changed, 63 insertions(+), 79 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/cus-edit.el	Fri Jan 31 20:43:22 2003 +0000
+++ b/lisp/cus-edit.el	Sat Feb 01 00:39:58 2003 +0000
@@ -440,8 +440,7 @@
 	     (get symbol 'custom-tag)
 	   (concat (get symbol 'custom-tag) "...")))
 	(t
-	 (save-excursion
-	   (set-buffer (get-buffer-create " *Custom-Work*"))
+	 (with-current-buffer (get-buffer-create " *Custom-Work*")
 	   (erase-buffer)
 	   (princ symbol (current-buffer))
 	   (goto-char (point-min))
@@ -3695,49 +3694,42 @@
   ;; If you edit it by hand, you could mess it up, so be careful.
   ;; Your init file should contain only one such instance.
   ;; If there is more than one, they won't work right.\n")
-      (mapcar
-       (lambda (symbol)
-	 (let ((spec (car-safe (get symbol 'theme-value)))
-	       (value (get symbol 'saved-value))
-	       (requests (get symbol 'custom-requests))
-	       (now (not (or (custom-variable-p symbol)
-			     (and (not (boundp symbol))
-				  (not (eq (get symbol 'force-value)
-					   'rogue))))))
-	       (comment (get symbol 'saved-variable-comment))
-	       sep)
-	   (when (or (and spec
-			  (eq (nth 0 spec) 'user)
-			  (eq (nth 1 spec) 'set))
-		     comment
-		     (and (null spec) (get symbol 'saved-value)))
-	     (unless (bolp)
-	       (princ "\n"))
-	     (princ " '(")
-	     (prin1 symbol)
-	     (princ " ")
-	     (prin1 (car value))
-	     (cond ((or now requests comment)
-		    (princ " ")
-		    (if now
-			(princ "t")
-		      (princ "nil"))
-		    (cond ((or requests comment)
-			   (princ " ")
-			   (if requests
-			       (prin1 requests)
-			     (princ "nil"))
-			   (cond (comment
-				  (princ " ")
-				  (prin1 comment)
-				  (princ ")"))
-				 (t
-				  (princ ")"))))
-			  (t
-			   (princ ")"))))
-		   (t
-		    (princ ")"))))))
-       saved-list)
+      (dolist (symbol saved-list)
+	(let ((spec (car-safe (get symbol 'theme-value)))
+	      (value (get symbol 'saved-value))
+	      (requests (get symbol 'custom-requests))
+	      (now (not (or (custom-variable-p symbol)
+			    (and (not (boundp symbol))
+				 (not (eq (get symbol 'force-value)
+					  'rogue))))))
+	      (comment (get symbol 'saved-variable-comment))
+	      sep)
+	  ;; Check `requests'.
+	  (dolist (request requests)
+	    (when (and (symbolp request) (not (featurep request)))
+	      (message "Unknown requested feature: %s" request)
+	      (setq requests (delq request requests))))
+	  (when (or (and spec
+			 (eq (nth 0 spec) 'user)
+			 (eq (nth 1 spec) 'set))
+		    comment
+		    (and (null spec) (get symbol 'saved-value)))
+	    (unless (bolp)
+	      (princ "\n"))
+	    (princ " '(")
+	    (prin1 symbol)
+	    (princ " ")
+	    (prin1 (car value))
+	    (when (or now requests comment)
+	      (princ " ")
+	      (prin1 now)
+	      (when (or requests comment)
+		(princ " ")
+		(prin1 requests)
+		(when comment
+		  (princ " ")
+		  (prin1 comment))))
+	    (princ ")"))))
       (if (bolp)
 	  (princ " "))
       (princ ")")
@@ -3769,40 +3761,32 @@
   ;; If you edit it by hand, you could mess it up, so be careful.
   ;; Your init file should contain only one such instance.
   ;; If there is more than one, they won't work right.\n")
-      (mapcar
-       (lambda (symbol)
-	 (let ((theme-spec (car-safe (get symbol 'theme-face)))
-	       (value (get symbol 'saved-face))
-	       (now (not (or (get symbol 'face-defface-spec)
-			     (and (not (custom-facep symbol))
-				  (not (get symbol 'force-face))))))
-	       (comment (get symbol 'saved-face-comment)))
-	   (when (or (and theme-spec
-			  (eq (nth 0 theme-spec) 'user)
-			  (eq (nth 1 theme-spec) 'set))
-		     comment
-		     (and (null theme-spec) (get symbol 'saved-face)))
-	     ;; Don't print default face here.
-	     (unless (bolp)
-	       (princ "\n"))
-	     (princ " '(")
-	     (prin1 symbol)
-	     (princ " ")
-	     (prin1 value)
-	     (cond ((or now comment)
-		    (princ " ")
-		    (if now
-			(princ "t")
-		      (princ "nil"))
-		    (cond (comment
-			   (princ " ")
-			   (prin1 comment)
-			   (princ ")"))
-			  (t
-			   (princ ")"))))
-		   (t
-		    (princ ")"))))))
-       saved-list)
+      (dolist (symbol saved-list)
+	(let ((spec (car-safe (get symbol 'theme-face)))
+	      (value (get symbol 'saved-face))
+	      (now (not (or (get symbol 'face-defface-spec)
+			    (and (not (custom-facep symbol))
+				 (not (get symbol 'force-face))))))
+	      (comment (get symbol 'saved-face-comment)))
+	  (when (or (and spec
+			 (eq (nth 0 spec) 'user)
+			 (eq (nth 1 spec) 'set))
+		    comment
+		    (and (null spec) (get symbol 'saved-face)))
+	    ;; Don't print default face here.
+	    (unless (bolp)
+	      (princ "\n"))
+	    (princ " '(")
+	    (prin1 symbol)
+	    (princ " ")
+	    (prin1 value)
+	    (when (or now comment)
+	      (princ " ")
+	      (prin1 now)
+	      (when comment
+		(princ " ")
+		(prin1 comment)))
+	    (princ ")"))))
       (if (bolp)
 	  (princ " "))
       (princ ")")