emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/cus-edit.el


From: Per Abrahamsen
Subject: [Emacs-diffs] Changes to emacs/lisp/cus-edit.el
Date: Thu, 07 Feb 2002 12:32:19 -0500

Index: emacs/lisp/cus-edit.el
diff -c emacs/lisp/cus-edit.el:1.142 emacs/lisp/cus-edit.el:1.143
*** emacs/lisp/cus-edit.el:1.142        Sat Feb  2 10:52:36 2002
--- emacs/lisp/cus-edit.el      Thu Feb  7 12:32:18 2002
***************
*** 1,6 ****
  ;;; cus-edit.el --- tools for customizing Emacs and Lisp packages
  ;;
! ;; Copyright (C) 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
  ;;
  ;; Author: Per Abrahamsen <address@hidden>
  ;; Keywords: help, faces
--- 1,6 ----
  ;;; cus-edit.el --- tools for customizing Emacs and Lisp packages
  ;;
! ;; Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002 Free Software Foundation, 
Inc.
  ;;
  ;; Author: Per Abrahamsen <address@hidden>
  ;; Keywords: help, faces
***************
*** 3744,3749 ****
--- 3744,3779 ----
        (set-buffer (find-file-noselect (custom-file))))
        (let ((file-precious-flag t))
        (save-buffer)))))
+ 
+ ;;;###autoload
+ (defun customize-mark-to-save (symbol)
+   "Mark SYMBOL for later saving.
+ 
+ If the default value of SYMBOL is different from the standard value, 
+ set the 'saved-value' property to a list whose car evaluates to the
+ default value. Otherwise, set it til nil.
+ 
+ To actually save the value, call 'custom-save-all'.
+ 
+ Return non-nil iff the 'saved-value' property actually changed."
+   (let* ((get (or (get symbol 'custom-get) 'default-value))
+        (value (funcall get symbol))
+        (saved (get symbol 'saved-value))
+        (standard (get symbol 'standard-value))
+        (comment (get symbol 'customized-variable-comment)))
+     ;; Save default value iff different from standard value.
+     (if (and standard 
+            (not (condition-case nil
+                     (equal value (eval (car standard)))
+                   (error nil))))
+       (put symbol 'saved-value (list (custom-quote value)))
+       (put symbol 'saved-value nil))
+     ;; Clear customized information (set, but not saved).
+     (put symbol 'customized-value nil)
+     ;; Save any comment that might have been set.
+     (when comment
+       (put symbol 'saved-variable-comment comment))
+     (not (equal saved (get symbol 'saved-value)))))
  
  ;;; The Customize Menu.
  



reply via email to

[Prev in Thread] Current Thread [Next in Thread]