[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to customize an option to a dynamic value (computed by lisp form

From: Jorge
Subject: Re: How to customize an option to a dynamic value (computed by lisp form)
Date: Tue, 30 Aug 2016 17:42:10 -0300

On 26 August 2016 at 17:59, Drew Adams <address@hidden> wrote:
> 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.

• 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:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]