From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stephen J. Turnbull" Newsgroups: gmane.emacs.devel Subject: RE: always put Customizations in `custom-file', never in `user-init-file' Date: Wed, 12 Dec 2007 19:00:40 +0900 Message-ID: <87ejdsxmev.fsf@uwakimon.sk.tsukuba.ac.jp> References: <87r6htd0ce.fsf@uwakimon.sk.tsukuba.ac.jp> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1197453466 10757 80.91.229.12 (12 Dec 2007 09:57:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 12 Dec 2007 09:57:46 +0000 (UTC) Cc: "Lennart Borgman \(gmail\)" , Emacs-Devel To: "Drew Adams" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 12 10:57:56 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1J2OLg-00029D-P2 for ged-emacs-devel@m.gmane.org; Wed, 12 Dec 2007 10:57:53 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J2OLO-0007a1-U6 for ged-emacs-devel@m.gmane.org; Wed, 12 Dec 2007 04:57:34 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J2OLI-0007V4-5D for emacs-devel@gnu.org; Wed, 12 Dec 2007 04:57:28 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J2OLF-0007PI-UP for emacs-devel@gnu.org; Wed, 12 Dec 2007 04:57:27 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J2OLF-0007Ox-JF for emacs-devel@gnu.org; Wed, 12 Dec 2007 04:57:25 -0500 Original-Received: from mtps02.sk.tsukuba.ac.jp ([130.158.97.224]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1J2OLB-0004tX-1p for emacs-devel@gnu.org; Wed, 12 Dec 2007 04:57:24 -0500 Original-Received: from uwakimon.sk.tsukuba.ac.jp (unknown [130.158.99.156]) by mtps02.sk.tsukuba.ac.jp (Postfix) with ESMTP id BA3767FFC; Wed, 12 Dec 2007 18:57:17 +0900 (JST) Original-Received: by uwakimon.sk.tsukuba.ac.jp (Postfix, from userid 1000) id 34C9811FA3F; Wed, 12 Dec 2007 19:00:41 +0900 (JST) In-Reply-To: X-Mailer: VM 7.17 under 21.5 (beta28) "fuki" (+CVS-20070621) XEmacs Lucid X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) 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:85087 Archived-At: Drew Adams writes: [XEmacs specific setup omitted] > OK, so to have a different custom file from `custom.el' (which is in > the same directory as the init file), the user can, in the init file, > set `custom-file' to something else - any file, anywhere. Correct? That is the intent. > > The strategy that has been implemented in XEmacs is > > > > 1) if there is an init file, load it. > > 2) if there is a customizations file, load it. > > That sounds good to me. > > > If you don't want XEmacs to do that for you (and that is quite > > reasonable), simply hide those files by giving them names that XEmacs > > doesn't know about. The only tricky part is getting `custom-file' set > > up so that Customize knows where to save its state. > > As long as a user who wants to can set `custom-file' to any file name > in the init file, I think #1 and #2 should be sufficient. Plus a mechanism so that the user can control timing if she wants to. Using `require' to load the custom-file gives that, since an explicit (provide 'custom-file) will inhibit Emacs, and the user can use load-file. > Right, it's not the same behavior as now. That was one of the first > things I said: nil would mean there is no custom file - nothing to > load and no place to save customizations. Well, I don't see a good reason for that. Some people consider "customizations in .emacs" a feature, and the traditional way to say that is nil. Since in the schemes we're discussing now the default will be non-nil anyway, there's no reason I can see, except to oppress those folks, to not use a different non-string value to mean "don't ask, don't tell [the custom-file]". > But the XEmacs approach for this sounds OK to me. What happens in > XEmacs for saving customizations when the `custom-file' value is a > symbol (so no custom file was loaded)? Are settings nevertheless saved > to the default custom file? I don't know; I imagine you get an invalid-state or invalid-argument error. The XEmacs design assumes you want to load and save customizations, and assumes that `custom-file' will be a string; AFAICS it does not deal gracefully with anything else. I'm not advocating the XEmacs design here; I'm just saying it works for us. > If so, I think (until I understand better ;-)) that it would be better > to prevent saving customizations until the user redefines > `custom-file' to a file name (possibly the default file). Well, an error wil do that. ;-) > if the user's custom file is in a different location and s?he decides > not to load it, and then forgets that, then settings get saved to a > different custom file (the default), so s?he now has two custom files. Seems like a YAGNI to me. > > This is in the context of the code which will try to load custom-file > > before the init file, and if not loaded by then, try to load it > > afterward. The idea is that the "before" customization file must have > > the default name, or Emacs can't find it. Then you tell Emacs what > > its name is by setq'ing custom-file, and it finds it at the after > > stage. > > Sorry, now I'm confused again. Are there two different custom files at > the same time in this scenario, both a before file and an after file? > I don't follow you at all here. No. There are use cases for loading before the init file and for loading after the init file. This scenario attempts to support both, without having "(load-file custom-file)" in the init file. This is a matter of style, and nobody in Emacs seems to care about it. So let's forget about it, and assume that customizations will be loaded after the init file, unless explicitly loaded or inhibited by the init file. > I was thinking this: > > To load the custom file before the (rest of the) init file, you would > put (load-file custom-file) at the beginning of the init file. You > could first set `custom-file' to any file name you wanted. > > To load the custom file after the init file, you would do nothing. You > could, if you wanted, set `custom-file' in the init file to any file > name. This will work; it's the current state of affairs in released XEmacsen. > There would still be the migration to discuss: how to help users move > from a .emacs that has Customize stuff to using a separate custom > file. It's not that hard: you find the init file, walk over the top-level sexps, moving custom-set forms to a new file. Probably you should warn but not move any such forms not at top-level. > The idea is to prevent someone who doesn't understand well from > mistakenly setting `custom-file' to the init file or vice > versa. It's about helping users not mistakenly shoot themselves in > the foot; it's not about preventing them from aiming at their foot > and pulling the trigger. Naive users are not going to do such things. It wouldn't occur to them that it is possible. Most "modern" applications hide all that stuff from the user. Have you ever tried to find your Firefox cache or bookmarks file?