From: steve-humphreys@gmx.com
To: Marco Wahl <marcowahlsoft@gmail.com>
Cc: Org-Mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: Using org-agenda-time-grid with lists
Date: Sat, 12 Dec 2020 00:04:55 +0100 [thread overview]
Message-ID: <trinity-09c297af-12d0-4ad5-9338-5f4cdda474bf-1607727895653@3c-app-mailcom-bs06> (raw)
In-Reply-To: <87zh2kvv7v.fsf@gmail.com>
> Sent: Friday, December 11, 2020 at 11:22 PM
> From: "Marco Wahl" <marcowahlsoft@gmail.com>
> To: steve-humphreys@gmx.com
> Cc: "Org-Mode mailing list" <emacs-orgmode@gnu.org>
> Subject: Re: Using org-agenda-time-grid with lists
>
> Hi Steve!
>
> > I have made two versions for calling org-agenda-time-grid, but the first does not
> > comply with what the last call does. Yet the parameters are identical.
> >
> > (setq grid-displ '(today daily require-timed))
> > (setq tm '(number-sequence 800 2000 100))
> > (message "tm: %s" tm)
> > (setq org-agenda-time-grid '('grid-displ 'tm
> > "......" "----------------"))
> >
> > (setq org-agenda-time-grid '((today daily require-timed)
> > (800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 2000)
> > "......" "----------------"))
>
> Possibly my last answer was not so clear.
>
> IIUC you want to use some variables (concretely grid-displ and tm)
> instead of the hardcoded values in the setting of org-agenda-time-grid.
Correct
> This is a Lisp question AFAICT.
>
> (setq org-agenda-time-grid '((today daily require-timed)
> (800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 2000)
> "......" "----------------"))
>
> evaluates (C-x C-e) to
>
> ((today daily require-timed) (800 900 1000 1100 1200 1300 1400 1500 1600
> 1700 1800 2000) "......" "----------------")
>
> and the agenda appears as expected, I guess.
>
> Let's check the details and use some variables.
>
> (number-sequence 800 2000 100)
>
> evaluates to
>
> (800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000)
>
> LGTM.
>
> Introduce variables grid-displ and tm
>
> (setq grid-displ '(today daily require-timed))
> (setq tm '(number-sequence 800 2000 100))
>
> Ok.
>
> Let's check some variants using those variables
>
> (setq org-agenda-time-grid '(grid-displ
> tm
> "......" "----------------"))
>
> evaluates to
>
> (grid-displ tm "......" "----------------")
>
> which is not the wanted value i.e. the hardcoded version above.
>
> Somehow the variables grid-displ and tm need to get evaluated before the
> setting of org-agenda-time-grid.
>
> Next try
>
> (setq org-agenda-time-grid (list grid-displ
> tm
> "......" "----------------"))
>
> This evaluates to ((today daily require-timed) (number-sequence 800 2000
> 100) "......" "----------------") which is closer to the hardcoded
> version above. But the number-sequence call did not happen.
>
> Function eval can do that.
>
> (setq org-agenda-time-grid (list grid-displ
> (eval tm)
> "......" "----------------"))
>
> This evaluates (almost) to the hardcoded version above.
>
> Note that function eval is considered rather bad style and should be
> avoided if possible.
If you say so.
> Possibly you can use the setting
>
> (setq tm (number-sequence 800 2000 100))
>
> instead of
>
> (setq tm '(number-sequence 800 2000 100))
>
> and then just use tm instead of (eval tm) to get the list of numbers.
>
> If you want to dig deeper you can study the backtick notation of lisp
> which provides an elegant notation for variable evaluation in lists.
Have used the backtick before. Will look how I can use it for this case.
> HTH,
> --
> Marco
>
prev parent reply other threads:[~2020-12-11 23:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-11 14:59 Using org-agenda-time-grid with lists steve-humphreys
2020-12-11 15:28 ` Marco Wahl
2020-12-11 15:45 ` steve-humphreys
2020-12-11 16:39 ` TRS-80
2020-12-11 16:48 ` steve-humphreys
2020-12-11 17:23 ` TRS-80
2020-12-11 18:18 ` Christopher Dimech
2020-12-11 18:38 ` TRS-80
2020-12-11 22:22 ` Marco Wahl
2020-12-11 23:04 ` steve-humphreys [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.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=trinity-09c297af-12d0-4ad5-9338-5f4cdda474bf-1607727895653@3c-app-mailcom-bs06 \
--to=steve-humphreys@gmx.com \
--cc=emacs-orgmode@gnu.org \
--cc=marcowahlsoft@gmail.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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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).