From: Jorge <jorge13515@gmail.com>
To: Drew Adams <drew.adams@oracle.com>
Cc: "Pascal J. Bourguignon" <pjb@informatimago.com>, help-gnu-emacs@gnu.org
Subject: Re: How to customize an option to a dynamic value (computed by lisp form)
Date: Tue, 30 Aug 2016 17:42:10 -0300 [thread overview]
Message-ID: <CAJR3QncikfbrSYi0+xVYtX0E4q7M=0BGaFcNeH7kzoGA8X-qzg@mail.gmail.com> (raw)
In-Reply-To: <bd25d4be-3f7f-49d9-a973-179eb74ab375@default>
On 26 August 2016 at 17:59, Drew Adams <drew.adams@oracle.com> 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 = 42; // the answer to life the universe and everything
>> const int answer_sq = answer*answer;
>> const int age = 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 – and now I
mentioned C++ – because I know C and C++ better than Lisp. I apologize if it
led to confusion. I think that the concept of literals in Lisp is equivalent to
the concept of literals in C. AFAIK, in Lisp `"ab"' and `5' are literals, unlike
`(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, which
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 along
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 second
language, and while I often read English, I rarely speak or write it.
Regards
--
• I am Brazilian. I hope my English is correct and I welcome corrections.
• Please adopt free formats like PDF, ODF, Org, LaTeX, Opus, WebM and 7z.
• Free (as in free speech) software for Android: https://f-droid.org/
prev parent reply other threads:[~2016-08-30 20:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-23 20:26 How to customize an option to a dynamic value (computed by lisp form) Jorge
2016-08-24 17:50 ` Pascal J. Bourguignon
2016-08-25 17:55 ` Jorge
2016-08-25 20:54 ` Drew Adams
2016-08-26 12:54 ` Jorge
2016-08-26 13:26 ` Jorge
2016-08-26 14:28 ` Drew Adams
2016-08-26 19:02 ` Jorge
2016-08-26 20:18 ` Jorge
2016-08-26 20:59 ` Drew Adams
2016-08-27 11:50 ` tomas
2016-08-30 20:42 ` Jorge [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJR3QncikfbrSYi0+xVYtX0E4q7M=0BGaFcNeH7kzoGA8X-qzg@mail.gmail.com' \
--to=jorge13515@gmail.com \
--cc=drew.adams@oracle.com \
--cc=help-gnu-emacs@gnu.org \
--cc=pjb@informatimago.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).