From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: find-file-hook as illustration of Custom problems Date: Thu, 10 Feb 2005 13:40:52 -0500 Message-ID: References: <200502040036.j140atb03430@raven.dms.auburn.edu> <200502060150.j161oqh15336@raven.dms.auburn.edu> <200502080150.j181oMf07339@raven.dms.auburn.edu> <200502100512.j1A5CLJ29641@raven.dms.auburn.edu> Reply-To: rms@gnu.org NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1108061302 5904 80.91.229.2 (10 Feb 2005 18:48:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 10 Feb 2005 18:48:22 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 10 19:48:21 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1CzJMH-0001JY-N4 for ged-emacs-devel@m.gmane.org; Thu, 10 Feb 2005 19:48:10 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CzJb4-0000QZ-5Z for ged-emacs-devel@m.gmane.org; Thu, 10 Feb 2005 14:03:26 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1CzJYH-0007Xs-MD for emacs-devel@gnu.org; Thu, 10 Feb 2005 14:00:33 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1CzJYG-0007Wt-2I for emacs-devel@gnu.org; Thu, 10 Feb 2005 14:00:32 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CzJYF-0007VX-4z for emacs-devel@gnu.org; Thu, 10 Feb 2005 14:00:31 -0500 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CzJIp-00065q-Ol for emacs-devel@gnu.org; Thu, 10 Feb 2005 13:44:35 -0500 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.34) id 1CzJFE-0005nG-T3; Thu, 10 Feb 2005 13:40:52 -0500 Original-To: Luc Teirlinck In-reply-to: <200502100512.j1A5CLJ29641@raven.dms.auburn.edu> (message from Luc Teirlinck on Wed, 9 Feb 2005 23:12:21 -0600 (CST)) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org X-MailScanner-To: ged-emacs-devel@m.gmane.org Xref: main.gmane.org gmane.emacs.devel:33205 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:33205 It is rather unclean to have a defcustom inside a function. Let's try to solve this1 some other way. The conventional way to handle custom definitions for variables that are defined too early to use defcustom is thru cus-start.el. Could you make it work that way? I see that, for variables set up in cus-start.el, the standard value is merely whatever value happens to be in effect when cus-edit is loaded. This is a lot like a suggestion that someone made for how to handle settings in the init file. However, it's not right for this case. So I added a feature to make it possible to specify a standard value expression for each variable. Does this patch work right? *** cus-start.el 10 Feb 2005 01:13:19 -0500 1.64 --- cus-start.el 10 Feb 2005 12:12:56 -0500 *************** *** 287,294 **** ;; xterm.c (mouse-autoselect-window display boolean "21.3") (x-use-underline-position-properties display boolean "21.3") ! (x-stretch-cursor display boolean "21.1"))) ! this symbol group type native-p version ;; This function turns a value ;; into an expression which produces that value. (quoter (lambda (sexp) --- 287,302 ---- ;; xterm.c (mouse-autoselect-window display boolean "21.3") (x-use-underline-position-properties display boolean "21.3") ! (x-stretch-cursor display boolean "21.1") ! ;; frame.el ! (blink-cursor-mode cursor boolean ! '(not (or noninteractive ! emacs-quick-startup ! (eq system-type 'ms-dos) ! (not (memq window-system '(x w32)))))) ! ! )) ! this symbol group type standard version native-p ;; This function turns a value ;; into an expression which produces that value. (quoter (lambda (sexp) *************** *** 297,304 **** (and (listp sexp) (memq (car sexp) '(lambda))) (stringp sexp) - ;; (and (fboundp 'characterp) - ;; (characterp sexp)) (numberp sexp)) sexp (list 'quote sexp))))) --- 305,310 ---- *************** *** 309,314 **** --- 315,325 ---- group (nth 1 this) type (nth 2 this) version (nth 3 this) + ;; If we did not specify any standard value expression above, + ;; use the current value as the standard value. + standard (if (nthcdr 4 this) + (nth 4 this) + (funcall quoter (default-value symbol))) ;; Don't complain about missing variables which are ;; irrelevant to this platform. native-p (save-match-data *************** *** 326,333 **** (message "Note, built-in variable `%S' not bound" symbol)) ;; Save the standard value, unless we already did. (or (get symbol 'standard-value) ! (put symbol 'standard-value ! (list (funcall quoter (default-value symbol))))) ;; If this is NOT while dumping Emacs, ;; set up the rest of the customization info. (unless purify-flag --- 337,343 ---- (message "Note, built-in variable `%S' not bound" symbol)) ;; Save the standard value, unless we already did. (or (get symbol 'standard-value) ! (put symbol 'standard-value (list standard))) ;; If this is NOT while dumping Emacs, ;; set up the rest of the customization info. (unless purify-flag