From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: Re: Documentation for custom-file - is not (load custom-file) needed? Date: Mon, 6 Dec 2004 20:56:49 -0600 (CST) Message-ID: <200412070256.iB72unE24612@raven.dms.auburn.edu> References: <075b01c4d9a4$52799460$0200a8c0@sedrcw11488> <00bb01c4daee$5eb81350$0200a8c0@sedrcw11488> <200412051733.iB5HXIX13206@raven.dms.auburn.edu> <000001c4db1a$8d3770f0$0200a8c0@sedrcw11488> <200412060046.iB60kZj15003@raven.dms.auburn.edu> <003e01c4db31$e45a2550$0200a8c0@sedrcw11488> <200412060402.iB6421q15173@raven.dms.auburn.edu> <200412061834.iB6IYBu20015@raven.dms.auburn.edu> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1102388375 25675 80.91.229.6 (7 Dec 2004 02:59:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 7 Dec 2004 02:59:35 +0000 (UTC) Cc: lennart.borgman.073@student.lu.se, jpw@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 07 03:59:27 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CbVZX-00039G-00 for ; Tue, 07 Dec 2004 03:59:27 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CbVjJ-0003Jt-Ln for ged-emacs-devel@m.gmane.org; Mon, 06 Dec 2004 22:09:33 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CbVif-00038V-Tg for emacs-devel@gnu.org; Mon, 06 Dec 2004 22:08:54 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CbVie-00037o-EX for emacs-devel@gnu.org; Mon, 06 Dec 2004 22:08:52 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CbVie-00037b-9P for emacs-devel@gnu.org; Mon, 06 Dec 2004 22:08:52 -0500 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CbVYe-0006Wa-Ta; Mon, 06 Dec 2004 21:58:33 -0500 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.12.10/8.12.10) with ESMTP id iB72wVFu001043; Mon, 6 Dec 2004 20:58:31 -0600 (CST) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.7p1+Sun/8.11.7) id iB72unE24612; Mon, 6 Dec 2004 20:56:49 -0600 (CST) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: monnier@iro.umontreal.ca In-reply-to: (message from Stefan Monnier on Mon, 06 Dec 2004 13:54:11 -0500) 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: main.gmane.org gmane.emacs.devel:30784 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:30784 Stefan Monnier wrote: This said, it's indeed probably better to tell people to `load' the custom file rather than to `setq' the `custom-file' variable (among other things because it involves much less magic, and works with Emacs-21.3). I forgot about the latter. This means that the way that `(emacs)Saving Customizations' explains how to have different customization files for different versions of Emacs is wrong. I propose the following changes to man/custom.texi, which I can install if desired. The `cond' form in the example might look intimidating to the non-Elisp user, but so does the present `if' form, certainly with the (necessary) `progn' in the "else" part added. People may want custom files for more than two versions. People essentially can copy the `cond' more or less verbatim with other version numbers. The example now shows how to deal with minor versions. ===File ~/custom.texi-diff================================== *** custom.texi 05 Dec 2004 09:07:23 -0600 1.70 --- custom.texi 06 Dec 2004 19:45:16 -0600 *************** *** 1,5 **** @c This is part of the Emacs manual. ! @c Copyright (C) 1985,86,87,93,94,95,97,2000,2001,2002 @c Free Software Foundation, Inc. @c See file emacs.texi for copying conditions. @node Customization, Quitting, Amusements, Top --- 1,5 ---- @c This is part of the Emacs manual. ! @c Copyright (C) 1985,86,87,93,94,95,97,2000,2001,2002,2004 @c Free Software Foundation, Inc. @c See file emacs.texi for copying conditions. @node Customization, Quitting, Amusements, Top *************** *** 487,509 **** The customization buffer normally saves customizations in @file{~/.emacs}. If you wish, you can save customizations in another file instead. To make this work, your @file{~/.emacs} should set ! @code{custom-file} to the name of that file. Emacs loads the file ! right after your @file{.emacs} if you did not load it already. For ! example: @example (setq custom-file "~/.emacs-custom") @end example The variable @code{custom-file} is useful if you want to have different customizations for different Emacs versions: @example ! (if (< emacs-major-version 21) ! ;; @r{Emacs 20 customization.} ! (setq custom-file "~/.custom-20.el") ! ;; @r{Emacs 21 customization.} ! (setq custom-file "~/.custom-21.el")) @end example If Emacs was invoked with the @option{-q} or @option{--no-init-file} --- 487,527 ---- The customization buffer normally saves customizations in @file{~/.emacs}. If you wish, you can save customizations in another file instead. To make this work, your @file{~/.emacs} should set ! @code{custom-file} to the name of that file. If you are using Emacs ! version 21.4 or later, Emacs loads the file right after your ! @file{.emacs} if you did not load it already. In earlier versions, ! you have to load the file in your @file{~/emacs}. If you customize ! @code{custom-file} through the @samp{Customize} interface, you still ! need to load it in your @file{.emacs}, but there is no need to set ! it. For example: @example + ;; @r{if not set through the @samp{Customize} interface:} (setq custom-file "~/.emacs-custom") + + ;; @r{in Emacs versions before 21.4 or if set through} + ;; @r{the @samp{Customize} interface.} + (load "~/.emacs-custom") @end example The variable @code{custom-file} is useful if you want to have different customizations for different Emacs versions: @example ! (cond ((< emacs-major-version 21) ! ;; @r{Emacs 20 customization.} ! (setq custom-file "~/.custom-20.el") ! (load "~/.custom-20.el")) ! ((< emacs-minor-version 4) ! ;; @r{Emacs 21 customization, before version 21.4.} ! (setq custom-file "~/.custom-21.el") ! (load "~/.custom-21.el")) ! (t ! ;; @r{Emacs version 21.4 or later.} ! (setq custom-file "~/.custom-21.4.el") ! ;; @r{not strictly necessary, but load all custom files} ! ;; @r{at the same place.} ! (load "~/.custom-21.4.el"))) @end example If Emacs was invoked with the @option{-q} or @option{--no-init-file} ============================================================