From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Pascal J. Bourguignon" Newsgroups: gmane.emacs.help Subject: Re: How to customize an option to a dynamic value (computed by lisp form) Date: Wed, 24 Aug 2016 19:50:00 +0200 Organization: Informatimago Message-ID: <87k2f69hvb.fsf@kuiper.lan.informatimago.com> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1472076422 6115 195.159.176.226 (24 Aug 2016 22:07:02 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 24 Aug 2016 22:07:02 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Aug 25 00:06:58 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 1bcgJz-000136-5X for geh-help-gnu-emacs@m.gmane.org; Thu, 25 Aug 2016 00:06:55 +0200 Original-Received: from localhost ([::1]:53532 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcgJz-0002H5-F3 for geh-help-gnu-emacs@m.gmane.org; Wed, 24 Aug 2016 18:06:55 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51003) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bccJi-0000eS-Vi for help-gnu-emacs@gnu.org; Wed, 24 Aug 2016 13:50:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bccJe-0000Kw-NC for help-gnu-emacs@gnu.org; Wed, 24 Aug 2016 13:50:21 -0400 Original-Received: from [195.159.176.226] (port=54855 helo=blaine.gmane.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bccJe-0000KR-GF for help-gnu-emacs@gnu.org; Wed, 24 Aug 2016 13:50:18 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1bccJY-0003Ol-9j for help-gnu-emacs@gnu.org; Wed, 24 Aug 2016 19:50:12 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 57 Original-X-Complaints-To: usenet@blaine.gmane.org Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en Cancel-Lock: sha1:YWFjNWMzZjUyYjE5NjI5NzAzMzIyNDM3MDZiZjk5ZmU1MzE3ZTRhOA== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-Mailman-Approved-At: Wed, 24 Aug 2016 18:05:34 -0400 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:111192 Archived-At: Jorge writes: > Hi. I set three options to a dynamic value, using the value of the option > `org-directory'. Now my custom-set-variables call in init.el includes the > following: > > '(org-agenda-files > (list > (concat org-directory "/agenda/") > "~/Dropbox/wanessa_e_jorge/administração_clínica/derma-prime.org")) > [...] > '(org-icalendar-combined-agenda-file (concat org-directory "/org.ics")) > [...] > '(org-mobile-inbox-for-pull (concat org-directory "/agenda/from-mobile.org")) > > The problem is that when I try to customize one of these three options, the > customize buffer does not know that the value was computed dynamically. For > example, the customize buffer for org-mobile-inbox-for-pull shows the value as > simply "~/org/agenda/from-mobile.org". This means that if I edit the value to > "~/org/agenda/from-mobile42.org" and save the customization, it will be written > to init.el as a string literal, no longer respecting org-directory. Then if I > later change org-directory I will have problems. > > Previously I worked around this problem by setting these options manually > (editing org-init.el, which is called by init.el), but I think the ideal would > be to use customize, so I decided to ask here. I have already searched Google > and the list archives. > > Thank you for your attention. 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. Of course, you can alway extend the customization system to take an optional expression (to be evaluated in what environment?) for each customization variable, and to generate the customize-variables form using those expressions instead of the customization variables values. Is it worth the trouble? Customization variables are designed for people who can't type a lisp expression. As a lisper it's easier to just set the variables yourself. -- __Pascal Bourguignon__ http://www.informatimago.com/ “The factory of the future will have only two employees, a man and a dog. The man will be there to feed the dog. The dog will be there to keep the man from touching the equipment.” -- Carl Bass CEO Autodesk