diff lisp/custom.el @ 1333:1b0339b048ce

[xemacs-hg @ 2003-03-02 09:38:37 by ben] To: xemacs-patches@xemacs.org PROBLEMS: Include nt/PROBLEMS and update. Add note about incremental linking badness. cmdloop.el, custom.el, dumped-lisp.el, files.el, keydefs.el, keymap.el, lisp-mode.el, make-docfile.el, replace.el, simple.el, subr.el, view-less.el, wid-edit.el: Lots of syncing with FSF 21.2. Use if-fboundp in wid-edit.el. New file newcomment.el from FSF. internals/internals.texi: Fix typo. (Build-Time Dependencies): New node. PROBLEMS: Delete. config.inc.samp, xemacs.mak: Eliminate HAVE_VC6, use SUPPORT_EDIT_AND_CONTINUE in its place. No incremental linking unless SUPPORT_EDIT_AND_CONTINUE, since it can cause nasty crashes in pdump. Put warnings about this in config.inc.samp. Report the full compile flags used for src and lib-src in the Installation output. alloc.c, lisp.h, ralloc.c, regex.c: Use ALLOCA() in regex.c to avoid excessive stack allocation. Also fix subtle problem with REL_ALLOC() -- any call to malloc() (direct or indirect) may relocate rel-alloced data, causing buffer text to shift. After any such call, regex must update all its pointers to such data. Add a system, when ERROR_CHECK_MALLOC, whereby regex.c indicates all the places it is prepared to handle malloc()/realloc()/free(), and any calls anywhere in XEmacs outside of this will trigger an abort. alloc.c, dialog-msw.c, eval.c, event-stream.c, general-slots.h, insdel.c, lisp.h, menubar-msw.c, menubar-x.c: Change *run_hook*_trapping_problems to take a warning class, not a string. Factor out code to issue warnings, add flag to call_trapping_problems() to postpone warning issue, and make *run_hook*_trapping_problems issue their own warnings tailored to the hook, postponed in the case of safe_run_hook_trapping_problems() so that the appropriate message can be issued about resetting to nil only when not `quit'. Make record_unwind_protect_restoring_int() non-static. dumper.c: Issue notes about incremental linking problems under Windows. fileio.c: Mule-ize encrypt/decrypt-string code. text.h: Spacing changes.
author ben
date Sun, 02 Mar 2003 09:38:54 +0000
parents 5df795348f45
children c9b6a2fec10d
line wrap: on
line diff
--- a/lisp/custom.el	Sun Mar 02 02:18:12 2003 +0000
+++ b/lisp/custom.el	Sun Mar 02 09:38:54 2003 +0000
@@ -25,6 +25,8 @@
 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
+;;; Synched with: ???  Partially synched to 21.2 by Ben Wing.
+
 ;;; Commentary:
 
 ;; This file is dumped with XEmacs.
@@ -42,6 +44,8 @@
 ;; prevent require/provide loop with custom and cus-face.
 (provide 'custom)
 
+;; BEGIN SYNC WITH FSF 21.2
+
 (eval-when-compile
   (load "cl-macs" nil t)
   ;; To elude warnings.
@@ -73,7 +77,12 @@
 
 (defun custom-initialize-set (symbol value)
   "Initialize SYMBOL with VALUE.
-Like `custom-initialize-default', but use the function specified by
+If the symbol doesn't have a default binding already,
+then set it using its `:set' function (or `set-default' if it has none).
+The value is either the value in the symbol's `saved-value' property,
+if any, or VALUE.
+
+This is like `custom-initialize-default', but uses the function specified by
 `:set' to initialize SYMBOL."
   (unless (default-boundp symbol)
     (funcall (or (get symbol 'custom-set) 'set-default)
@@ -84,6 +93,12 @@
 
 (defun custom-initialize-reset (symbol value)
   "Initialize SYMBOL with VALUE.
+Set the symbol, using its `:set' function (or `set-default' if it has none).
+The value is either the symbol's current value
+ \(as obtained using the `:get' function), if any,
+or the value in the symbol's `saved-value' property if any,
+or (last of all) VALUE.
+
 Like `custom-initialize-set', but use the function specified by
 `:get' to reinitialize SYMBOL if it is already bound."
     (funcall (or (get symbol 'custom-set) 'set-default)
@@ -99,7 +114,8 @@
 (defun custom-initialize-changed (symbol value)
   "Initialize SYMBOL with VALUE.
 Like `custom-initialize-reset', but only use the `:set' function if the
-not using the standard setting.  Otherwise, use the `set-default'."
+not using the standard setting.
+For the standard setting, use `set-default'."
   (cond ((default-boundp symbol)
          (funcall (or (get symbol 'custom-set) 'set-default)
                   symbol
@@ -112,10 +128,12 @@
         (t
          (set-default symbol (eval value)))))
 
-(defun custom-declare-variable (symbol value doc &rest args)
-  "Like `defcustom', but SYMBOL and VALUE are evaluated as normal arguments."
+(defun custom-declare-variable (symbol default doc &rest args)
+  "Like `defcustom', but SYMBOL and DEFAULT are evaluated as normal arguments.
+DEFAULT should be an expression to evaluate to compute the default value,
+not the default value itself."
   ;; Remember the standard setting.
-  (put symbol 'standard-value (list value))
+  (put symbol 'standard-value (list default))
   ;; Maybe this option was rogue in an earlier version.  It no longer is.
   (when (eq (get symbol 'force-value) 'rogue)
     ;; It no longer is.
@@ -156,7 +174,7 @@
                                         'custom-variable))))))
     (put symbol 'custom-requests requests)
     ;; Do the actual initialization.
-    (funcall initialize symbol value))
+    (funcall initialize symbol default))
   ;; #### This is a rough equivalent of LOADHIST_ATTACH.  However,
   ;; LOADHIST_ATTACH also checks for `initialized'.
   (push symbol current-load-list)
@@ -173,37 +191,44 @@
 
    [KEYWORD VALUE]...
 
-The following KEYWORD's are defined:
+The following keywords are meaningful:
 
 :type   VALUE should be a widget type for editing the symbols value.
         The default is `sexp'.
 :options VALUE should be a list of valid members of the widget type.
 :group  VALUE should be a customization group.
         Add SYMBOL to that group.
-:initialize VALUE should be a function used to initialize the
+:initialize
+        VALUE should be a function used to initialize the
         variable.  It takes two arguments, the symbol and value
         given in the `defcustom' call.  The default is
-        `custom-initialize-set'
-:set    VALUE should be a function to set the value of the symbol.
-        It takes two arguments, the symbol to set and the value to
-        give it.  The default is `custom-set-default'.
+        `custom-initialize-reset'
+:set	VALUE should be a function to set the value of the symbol.
+	It takes two arguments, the symbol to set and the value to
+	give it.  The default choice of function is `custom-set-default'.
 :get    VALUE should be a function to extract the value of symbol.
-        The function takes one argument, a symbol, and should return
-        the current value for that symbol.  The default is
-        `default-value'.
-:require VALUE should be a feature symbol.  Each feature will be
-        required after initialization, of the user have saved this
-        option.
-:version VALUE should be a string specifying that the variable was
+	The function takes one argument, a symbol, and should return
+	the current value for that symbol.  The default choice of function
+	is `custom-default-value'. #### XEmacs used to say `default-value';
+        is that right?
+:require
+	VALUE should be a feature symbol.  If you save a value
+	for this option, then when your custom init file loads the value,
+	it does (require VALUE) first.
+:version
+        VALUE should be a string specifying that the variable was
         first introduced, or its default value was changed, in Emacs
         version VERSION.
-:set-after VARIABLE specifies that SYMBOL should be set after VARIABLE when
+:set-after VARIABLE
+	Specifies that SYMBOL should be set after VARIABLE when
 	both have been customized.
 
 Read the section about customization in the Emacs Lisp manual for more
 information."
   `(custom-declare-variable (quote ,symbol) (quote ,value) ,doc ,@args))
 
+;; END SYNC WITH FSF 21.2
+
 ;;; The `defface' Macro.
 
 (defmacro defface (face spec doc &rest args)
@@ -713,4 +738,13 @@
 
 ;;; The End.
 
+;; BEGIN SYNC WITH FSF 21.2
+
+;; Process the defcustoms for variables loaded before this file.
+(while custom-declare-variable-list
+  (apply 'custom-declare-variable (car custom-declare-variable-list))
+  (setq custom-declare-variable-list (cdr custom-declare-variable-list)))
+
+;; END SYNC WITH FSF 21.2
+
 ;; custom.el ends here