From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Semantics of autoload cookies on defcustoms Date: Sun, 09 Jul 2006 01:32:22 -0400 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1152423145 20367 80.91.229.2 (9 Jul 2006 05:32:25 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 9 Jul 2006 05:32:25 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 09 07:32:23 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FzRu2-0001qg-5P for ged-emacs-devel@m.gmane.org; Sun, 09 Jul 2006 07:32:22 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FzRu1-0001pT-IK for ged-emacs-devel@m.gmane.org; Sun, 09 Jul 2006 01:32:21 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FzRtq-0001nG-1y for emacs-devel@gnu.org; Sun, 09 Jul 2006 01:32:10 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FzRto-0001my-8k for emacs-devel@gnu.org; Sun, 09 Jul 2006 01:32:09 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FzRto-0001mv-4D for emacs-devel@gnu.org; Sun, 09 Jul 2006 01:32:08 -0400 Original-Received: from [209.226.175.54] (helo=tomts10-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FzRuY-0002AS-Lv; Sun, 09 Jul 2006 01:32:54 -0400 Original-Received: from localhost ([70.55.141.234]) by tomts10-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20060709053204.VYOI13241.tomts10-srv.bellnexxia.net@localhost>; Sun, 9 Jul 2006 01:32:04 -0400 Original-Received: by localhost (Postfix, from userid 20848) id 87E158CDE; Sun, 9 Jul 2006 01:32:22 -0400 (EDT) Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Sat, 08 Jul 2006 16:57:14 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) 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 Xref: news.gmane.org gmane.emacs.devel:56837 Archived-At: > Perhaps a good way to implement that is to write another argument into > the custom-autoload call. That optional argument, if non-nil, would > specify this new combination of behaviors that I called #3. > The decision could be based on the presence of :set. Well, there's no need for an extra arg: we just then skip the custom-autoload and that should be all there is to it. How 'bout the patch below? What it does is the following: 1 - remove the minor-mode stuff which is unnecessary anyway (since the custom-autoload line added just above already ensures that the package gets loaded (which adds the setter) before the variable is custom-set). 2 - only add the custom-autoload line for those defcustom that have a setter since it seems to be the only ones that need it. I guess this isn't quite right tho: the var should still cause autoloading if we want customize it (since it needs to go fetch the :type at the very least). Is that what you meant by an additional arg to custom-autoload? Stefan --- autoload.el 28 mai 2006 22:48:22 -0400 1.115 +++ autoload.el 09 jui 2006 01:27:08 -0400 @@ -124,17 +124,11 @@ ) `(progn (defvar ,varname ,init ,doc) - (custom-autoload ',varname ,file) - ;; The use of :require in a defcustom can be annoying, especially - ;; when defcustoms are moved from one file to another between - ;; releases because the :require arg gets placed in the user's - ;; .emacs. In order for autoloaded minor modes not to need the - ;; use of :require, we arrange to store their :setter. ,(let ((setter (condition-case nil (cadr (memq :set form)) (error nil)))) - (if (equal setter ''custom-set-minor-mode) - `(put ',varname 'custom-set 'custom-set-minor-mode)))))) + (when setter + `(custom-autoload ',varname ,file)))))) ((eq car 'defgroup) ;; In Emacs this is normally handled separately by cus-dep.el, but for