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: Tue, 30 Aug 2016 17:42:10 -0300 Message-ID: References: <87k2f69hvb.fsf@kuiper.lan.informatimago.com> <83832586-765e-4df4-917a-98458247d829@default> <86785f1e-022c-4946-8a28-39c72eb26d5d@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1472589768 11820 195.159.176.226 (30 Aug 2016 20:42:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 30 Aug 2016 20:42:48 +0000 (UTC) Cc: "Pascal J. Bourguignon" , help-gnu-emacs@gnu.org To: Drew Adams Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Aug 30 22:42:44 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 1beprm-0002QS-Sr for geh-help-gnu-emacs@m.gmane.org; Tue, 30 Aug 2016 22:42:43 +0200 Original-Received: from localhost ([::1]:51184 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1beprk-0006qt-Ih for geh-help-gnu-emacs@m.gmane.org; Tue, 30 Aug 2016 16:42:40 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44694) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1beprK-0006pb-GA for help-gnu-emacs@gnu.org; Tue, 30 Aug 2016 16:42:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1beprI-0000VC-2O for help-gnu-emacs@gnu.org; Tue, 30 Aug 2016 16:42:13 -0400 Original-Received: from mail-qk0-x236.google.com ([2607:f8b0:400d:c09::236]:35447) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1beprH-0000V7-UV for help-gnu-emacs@gnu.org; Tue, 30 Aug 2016 16:42:12 -0400 Original-Received: by mail-qk0-x236.google.com with SMTP id v123so31525850qkh.2 for ; Tue, 30 Aug 2016 13:42:11 -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:content-transfer-encoding; bh=xjpfWCxZgpvMxK1jMjMcoZy7xKk9GRWhn6V+lZerh20=; b=i40gW+UqG50pW7E7BdcyzSMaxA/4KOkEKsB7ryS4QV9FkSX4z2w+pSvN/Rmv15RxjZ 6UGqMSJR0fjD+ETaPK4EJuVl4U/Vpl3yl9lUEfGenJOnV9ThYSmadpmdRyPS5M+JNxfB DtUWQSjY0iZPCqT8jl6D6gQAWj7FL0s7B6QEb2+ZZPAlcqhUUQweyBOq93NB73Oj/UrG l0J6vEkb3kofGIs6fProTx+I6f2/u2tXI/1CRDQio5oPi0fTBYLXOCFafuNqFlWSNBKt 6urFIJwtMsX1xZe9AZ7CXRUausXrlS8oieFpqnelRmwUAsnWg042Nw177L+yx4ZSiokl b3iw== 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:content-transfer-encoding; bh=xjpfWCxZgpvMxK1jMjMcoZy7xKk9GRWhn6V+lZerh20=; b=I9aPraBJtwOrFa1PoIXt23kRynjcVEZV/gep1xuU8P+AIPOYzbTc5jszZ8+jVVMyVd M2zxJ0vE0onvlokmg2zQ2b+0W25nB+FBeHRRqm3lEAFsX2QL7LIYFjXCBuLxKy7N3wJH r2UCKZvgN8fW3vbh7bcyJxvqPoPd5UkqPk1oWSPeylztV318aEvrIbAdBXRJ/oI/4BLu izgxpVlUB8yFqxOT+gRM2gB4dZqG6D5211d0ObfxzaUg4sSljjNjImW68UQoPwUyAV2o VKURHqMrOQ0hoLpc7aRz2zHo2lH/aiznDriRFZjvV8WEA0PaJPo+iGJbRig2yb+v9kOw YwDQ== X-Gm-Message-State: AE9vXwPIhqBQ9LyBEntMvQwdf6Loo18PUs3Rxxxmlx8Pa5KenM1QI5u/mP2WTqRNwQPw/z1ONTIn+PMgd4x5iw== X-Received: by 10.55.154.22 with SMTP id c22mr6563655qke.36.1472589731236; Tue, 30 Aug 2016 13:42:11 -0700 (PDT) Original-Received: by 10.55.26.89 with HTTP; Tue, 30 Aug 2016 13:42:10 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: OnB1KMEwTwdnlRDtprwRuUsAL98 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c09::236 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:111225 Archived-At: On 26 August 2016 at 17:59, Drew Adams wrote: >> https://en.wikipedia.org/wiki/Literal_(computer_programming) > > Which says: > > "In computer science, a literal is a _notation_ for _representing_ > a fixed value in source code." > > Whereas here we are not talking about a notation. We are not > talking about a source-code representation of a value. We are > talking about a real, live, runtime value. > > We are talking about the value of a variable, and a value is not > something particularly "dynamic". A _variable_ could be considered > dynamic, in that it can change its value over time. > >> const int answer =3D 42; // the answer to life the universe and everyth= ing >> const int answer_sq =3D answer*answer; >> const int age =3D read_int(); >> >> All three variables defined above are constants. However, only the first >> two have values which can be known at compile time, and only the first >> one is initialized to a literal (42). > > The context of what you requested has nothing to do with compile time, > and it has nothing to do with whether the source code defining the > option value uses a literal (self-evaluating Lisp thingy) or is > computed. I mentioned compile time to distinguish compile-time-known constants (which could be constexpr in C++) from literals. I gave an example in C =E2=80=93= and now I mentioned C++ =E2=80=93 because I know C and C++ better than Lisp. I apolo= gize if it led to confusion. I think that the concept of literals in Lisp is equivale= nt to the concept of literals in C. AFAIK, in Lisp `"ab"' and `5' are literals, u= nlike `(concat "a" "b")' and `(+ 2 3)'. My point is that when using Custom, the generated custom-set-variables form represents the value of org-agenda-files as a list of string literals, whic= h mean that if I change org-directory, then I have to re-customize org-agenda-files. An analogous situation holds for org-icalendar-combined-agenda-file and org-mobile-inbox-for-pull. > It sounds like what you want to use as value is not a list of > strings but a _function_ that, when called, returns a list of > strings, and you want that function to construct the first > string of the list using `org-directory'. Here is a command > that does that. > > (defun foo (subdir file) > (interactive > (list (read-directory-name "Agenda subdir: " org-directory nil t) > (read-file-name "Org file: " nil nil t))) > (customize-set-variable 'org-agenda-files > (list (expand-file-name subdir org-directory) file))) Thank you for the suggestion, but I think it would be more fruitful to go a= long with my plan of asking the Org Mode developers to allow file paths in these options to refer to org-directory. Our conversation may have been obstructed by the fact that English is my se= cond language, and while I often read English, I rarely speak or write it. Regards --=20 =E2=80=A2 I am Brazilian. I hope my English is correct and I welcome corre= ctions. =E2=80=A2 Please adopt free formats like PDF, ODF, Org, LaTeX, Opus, WebM a= nd 7z. =E2=80=A2 Free (as in free speech) software for Android: https://f-droid.or= g/