From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Jorge Newsgroups: gmane.emacs.help Subject: Re: How to customize an option to a dynamic value (computed by lisp form) Date: Thu, 25 Aug 2016 14:55:36 -0300 Message-ID: References: <87k2f69hvb.fsf@kuiper.lan.informatimago.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1472147843 26104 195.159.176.226 (25 Aug 2016 17:57:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 25 Aug 2016 17:57:23 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: "Pascal J. Bourguignon" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Aug 25 19:57:18 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bcytx-0006Ij-9x for geh-help-gnu-emacs@m.gmane.org; Thu, 25 Aug 2016 19:57:17 +0200 Original-Received: from localhost ([::1]:57415 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcytu-0000c7-SJ for geh-help-gnu-emacs@m.gmane.org; Thu, 25 Aug 2016 13:57:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52678) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcytP-0000aP-3n for help-gnu-emacs@gnu.org; Thu, 25 Aug 2016 13:56:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bcytK-0003BO-Qk for help-gnu-emacs@gnu.org; Thu, 25 Aug 2016 13:56:42 -0400 Original-Received: from mail-qk0-f172.google.com ([209.85.220.172]:35986) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcytK-0003BJ-LY for help-gnu-emacs@gnu.org; Thu, 25 Aug 2016 13:56:38 -0400 Original-Received: by mail-qk0-f172.google.com with SMTP id l2so53404841qkf.3 for ; Thu, 25 Aug 2016 10:56:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=r5JXfKWAZrmJxY1XjrC9ch5ykhQMzqzRJydaiWsYgJY=; b=x/lVy6qDDqHE8uedcNxKT8aELp8THo6wFW7SUMXDHf/Wp2oSKjGsVSNPbLghqA8hbI QUqtwEdy4y3wQ8XpWycxfNSkfEAUv8xA2QxI8dGrvC2w7lwUrP1WygLYwUGIB/WlCuo8 QtoClJtEsy2TlkoF6iarlyJduR+KvueW+NPj5I6z2Qzv+rhBSk2SeIsZtJcVLYJSeif1 idS8q2edFfydWUtmZGO/sBtvyRJjMa5VSuAfpNGnqMuEm5vgklwTKHyrLUQuYHg5QCvZ u2cNyo8u+N0PBrmQeZGYd6QzcFxIOra50wPTEqykwtq7D1IfgUCCjD9IltxwIl3SU0mA mvYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=r5JXfKWAZrmJxY1XjrC9ch5ykhQMzqzRJydaiWsYgJY=; b=hTdoBoARittVmcmUGth1ZVj7HWm5Mm+VbXegCkMXe9O4ZBgRqiLEc0QfkqFwq0gn2x klJS8jNl06YSWxkcXFGVlCpRzbUIhMYe3QFG5jrpBi2wP1pyHUmRCQBZeF2JJEgNbaep z6Ip2JMmiITv2pdPuKusC7rUTifaDpgA0U+CFaWXw1my2I/lDjpWlqQXkRastDDqkYMg Nh886EFqTnzLC5t7WJQ4T9AwwmYEx8A5GWW94rtb2psdIVEN9B+zcUrGY2yofVLzqD04 /Ju9xK0Ut41IvX6TR3SPfa/wW+/tZCXObx9CX+N9TP8o8sb05TDdtuk120qyXCRVOysT TTcQ== X-Gm-Message-State: AE9vXwO8K7BsrTufITspcbXH1ivV9+UK3CNDbMO+9lK9uTiojicVRbLt2brdM2XQZywBs5on2mxcGqq5drXZHw== X-Received: by 10.55.217.9 with SMTP id u9mr9020234qki.244.1472147736845; Thu, 25 Aug 2016 10:55:36 -0700 (PDT) Original-Received: by 10.55.26.89 with HTTP; Thu, 25 Aug 2016 10:55:36 -0700 (PDT) In-Reply-To: <87k2f69hvb.fsf@kuiper.lan.informatimago.com> X-Google-Sender-Auth: tLshlRYZsJ1IkOi77d7LZKDXMnc X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.220.172 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:111194 Archived-At: On 24 August 2016 at 14:50, Pascal J. Bourguignon wrote: > Since the customization system updates the source form > customize-variables in your init file (actually, in the file indicated by > the custom-file customization variable), and when it saves this source > form, it saves the values of the variables, not the dynamic expressions > you would use to compute them, you won't have much choice if you want to > keep it simple. > > Just set the customization variables to your expressions after the > customize-variables form. OK. I have moved the customization of these three options to my org-init.el. Instead of the simple setq, I used customize-set-variable, because it respects the respective custom-set property (if it exists). There remain two problems: 1. customize-set-variable does not do type checking. I have just tested it by setting org-agenda-files to 42 (an integer). set-variable does type checking, but does not respect any custom-set property. How can I elegantly combine both? And shouldn't elisp provide a convenient command for this? 2. If I forget that these options are changed manually (Emacs does not warn), and configure them via customize, then the new value will be added to the custom-set-variables form with static values. This has two problems: 1. It will have static values. 2. Since org-init.el is called after the custom-set-variables form, the values set in the form will be overwritten.