From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jude DaShiell Newsgroups: gmane.emacs.help Subject: RE: [External] : Configuration files vs customization Date: Sat, 21 Jan 2023 14:04:58 -0500 Message-ID: <4d936253-f39f-9464-ef59-272ccea999f9@panix.com> References: <25548.5130.933634.159947@woitok.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19195"; mail-complaints-to="usenet@ciao.gmane.io" To: Drew Adams , Dr Rainer Woitok , "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 21 20:43:44 2023 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pJJmB-0004od-Sk for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 21 Jan 2023 20:43:44 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJJAm-0001oO-Uj; Sat, 21 Jan 2023 14:05:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pJJAk-0001oB-Pr for help-gnu-emacs@gnu.org; Sat, 21 Jan 2023 14:05:02 -0500 Original-Received: from mailbackend.panix.com ([166.84.1.89]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pJJAi-0001so-Oh for help-gnu-emacs@gnu.org; Sat, 21 Jan 2023 14:05:02 -0500 Original-Received: from panix1.panix.com (panix1.panix.com [166.84.1.1]) by mailbackend.panix.com (Postfix) with ESMTP id 4Nzm5Q6tfGz3wMn; Sat, 21 Jan 2023 14:04:58 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=panix.com; s=panix; t=1674327899; bh=WseQQ7YMu4cGfZuqsRhOwB4BvYz4CsFxV3XwzGk00dI=; h=Date:From:To:Subject:In-Reply-To:References; b=b+mJanamWYdOMOTiDwd13RYNGZ5bKNsB2oUWaWfAnPiLJk1Giaa91TaajcQuzTDyW 5RWibKvPdeEQe1ugv2fmL2017j0/lBfCg9HkSr024VMJrcGTWAb0A/wsfIXk3dv0v9 btfDJWCImLPv2AuHqcwniaHaOyFMujzyCL1zzA5M= Original-Received: by panix1.panix.com (Postfix, from userid 20712) id 4Nzm5Q6fcCzcbc; Sat, 21 Jan 2023 14:04:58 -0500 (EST) Original-Received: from localhost (localhost [127.0.0.1]) by panix1.panix.com (Postfix) with ESMTP id 4Nzm5Q6bbzzcbP; Sat, 21 Jan 2023 14:04:58 -0500 (EST) In-Reply-To: Received-SPF: pass client-ip=166.84.1.89; envelope-from=jdashiel@panix.com; helo=mailbackend.panix.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:142488 Archived-At: doesn't the evaluation process of setq evaluate current configuration and dependencies? If it doesn't that with that third t option would be a useful service. Jude "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author, 1940) . On Sat, 21 Jan 2023, Drew Adams wrote: > > Personally, I hate this clicky-clicky customization interface because it > > doesn't evaluate the values, even though function "custom-set-variables" > > provides an option to do so. Thus you can't use things like '(getenv > > "HOME")', '(getenv "HOST")' or '(cond ...)'. > > > > The lack of this flexibility makes configuration rather tricky. > > And according to the comment > > ;; Your init file should contain only one such instance. > > ;; If there is more than one, they won't work right. > > More precisely, they _might not_ work right. And "work > right" is vague. What that really tries to say, IMO, > is that unless you know what you're doing, it's a good > idea not to use multiple `custom-set-variables' sexps > in the same file. > > Even better advice is to let Customize use `custom-file', > and use some other file(s) (could be your init file, but > need not be) for any customization code that you write > (provide). > > > function "custom-set-variables" writes into my "custom.el" file, > > No, it doesn't write anything anywhere. It only _sets_ > the variables you pass it to the values you provide. > They're set for the current Emacs session ... until you > set them again or reset them. > > `custom-save-variables' _saves_ variables. > > There are other `custom-*' and `customize-*' functions, > And most of the latter are also commands. E.g., try > `M-x customize-set-variable'. > > The point about using Customize (the UI), or the custom > and customize functions - _instead of setq_ - is that > setq doesn't know about any :init or :set additional > processing that's required/intended/expected when you > initialize or change the value of a user option. > > setq just changes the variable value, so if there's a > :set operation associated with the variable then that > doesn't take place with setq. > > setq is a default, basic, no bells & whistles setter > function. Sometimes you want additional processing > to take place when you set an option value, hence > :set. > > See https://emacs.stackexchange.com/a/106. > > > So being forced to put more or less all application > > specific configuration into one big "custom.el" file > > You're not. > > > which on top of all does only accept constants as values > > Untrue. The `custom*' functions evaluate their args, > so you can pass them any Elisp code you like, which > is evaluated. The `custom-set-variables' form that's > automatically written to your `custom-file' or init > file uses quoted lists (constants) as the args. But > that doesn't mean that `custom-set-variables' expects > constant values as args. > > > is quite a nuisance for me. Originally, having se- > > parate configuration files like ".vm" or ".gnus.el" had the purpose not > > to clutter one's "init.el" file and to save time when firing up Emacs > > without also starting Vm or Gnus. > > You can have any number of separate config files, > which you load from your init file. That's up to you. > > > How do others solve these configuration problems? > > Everyone does things differently, no doubt. A general > recommendation (from me at least) is to separate all > code that you write, including all that customizes > user options and faces, from code that Emacs generates > automatically and saves in your `custom-file'. So yes, > do you a separate `custom-file', and don't edit it. > > Beyond that, you can do whatever else you like to/with > user options and faces, with whatever code you like, > in whatever files you like. You generally don't need > to, but you can. > > Really (IMO), regardless of whether you find the UI > of Customize clunky (and many of us do), the Emacs > functionalities behind options (defcustoms) and faces > (deffaces) is pretty solid and reliable. It can take > some getting used to, but (1) it ensures that values > you provide are of the right type - so behavior > doesn't break, (2) it takes care of persisting your > preference settings across sessions, and (3) it takes > care of any additional actions that might be required > when an option value is initialized or set. > >