Org-mode mailing list
 help / color / mirror / Atom feed
* Using org-agenda-time-grid with lists
@ 2020-12-11 14:59 steve-humphreys
  2020-12-11 15:28 ` Marco Wahl
  0 siblings, 1 reply; 10+ messages in thread
From: steve-humphreys @ 2020-12-11 14:59 UTC (permalink / raw)
  To: Org-Mode mailing list

I am trying to insert finer timings in org-agenda with the following code.
Haw can one pass a list in a list?

(setq tm '(number-sequence 800 2000 30))
(setq org-agenda-time-grid '((daily today require-timed)
   tm "......" "----------------"))


But this works well

(setq org-agenda-time-grid '((daily today require-timed)
   (800 900 1000 1100 1200 1300 1400 1500 1600 1700  1800 2000)
   "......" "----------------"))



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Using org-agenda-time-grid with lists
  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
  0 siblings, 1 reply; 10+ messages in thread
From: Marco Wahl @ 2020-12-11 15:28 UTC (permalink / raw)
  To: steve-humphreys; +Cc: Org-Mode mailing list

steve-humphreys@gmx.com writes:

> I am trying to insert finer timings in org-agenda with the following code.
> Haw can one pass a list in a list?
>
> (setq tm '(number-sequence 800 2000 30))
> (setq org-agenda-time-grid '((daily today require-timed)
>    tm "......" "----------------"))
>
>
> But this works well
>
> (setq org-agenda-time-grid '((daily today require-timed)
>    (800 900 1000 1100 1200 1300 1400 1500 1600 1700  1800 2000)
>    "......" "----------------"))

What about

    (setq tm '(number-sequence 800 2000 30))

vs.

    (setq tm (number-sequence 800 2000 30))

?


HTH,
-- 
Marco


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Using org-agenda-time-grid with lists
  2020-12-11 15:28 ` Marco Wahl
@ 2020-12-11 15:45   ` steve-humphreys
  2020-12-11 16:39     ` TRS-80
  2020-12-11 22:22     ` Marco Wahl
  0 siblings, 2 replies; 10+ messages in thread
From: steve-humphreys @ 2020-12-11 15:45 UTC (permalink / raw)
  To: Marco Wahl; +Cc: Org-Mode mailing list



> Sent: Friday, December 11, 2020 at 4:28 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
>
> steve-humphreys@gmx.com writes:
>
> > I am trying to insert finer timings in org-agenda with the following code.
> > Haw can one pass a list in a list?
> >
> > (setq tm '(number-sequence 800 2000 30))
> > (setq org-agenda-time-grid '((daily today require-timed)
> >    tm "......" "----------------"))
> >
> >
> > But this works well
> >
> > (setq org-agenda-time-grid '((daily today require-timed)
> >    (800 900 1000 1100 1200 1300 1400 1500 1600 1700  1800 2000)
> >    "......" "----------------"))
>
> What about
>
>     (setq tm '(number-sequence 800 2000 30))
>
> vs.
>
>     (setq tm (number-sequence 800 2000 30))
>
> ?

Thank you Marco.

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)
   "......" "----------------"))

Incidentally, how can one print a list in messages buffer?


> HTH,
> --
> Marco
>
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Using org-agenda-time-grid with lists
  2020-12-11 15:45   ` steve-humphreys
@ 2020-12-11 16:39     ` TRS-80
  2020-12-11 16:48       ` steve-humphreys
  2020-12-11 22:22     ` Marco Wahl
  1 sibling, 1 reply; 10+ messages in thread
From: TRS-80 @ 2020-12-11 16:39 UTC (permalink / raw)
  To: steve-humphreys; +Cc: Emacs-orgmode, Marco Wahl, Org-Mode mailing list

On 2020-12-11 10:45, steve-humphreys@gmx.com wrote:
> 
> Incidentally, how can one print a list in messages buffer?

Do you mean something other than standard:

```
(message "%s" my-list)
```

I wrote some quite involved function to take a list of variables and
print them to Messages buffer, formatting them nicely.  I use it when
debugging and writing code.  However I am not sure that is what you are
looking for or not?

Cheers,
TRS-80


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Using org-agenda-time-grid with lists
  2020-12-11 16:39     ` TRS-80
@ 2020-12-11 16:48       ` steve-humphreys
  2020-12-11 17:23         ` TRS-80
  0 siblings, 1 reply; 10+ messages in thread
From: steve-humphreys @ 2020-12-11 16:48 UTC (permalink / raw)
  To: TRS-80; +Cc: Emacs-orgmode, Marco Wahl, Org-Mode mailing list



> Sent: Friday, December 11, 2020 at 5:39 PM
> From: "TRS-80" <lists.trs-80@isnotmyreal.name>
> To: steve-humphreys@gmx.com
> Cc: "Emacs-orgmode" <emacs-orgmode-bounces+lists.trs-80=isnotmyreal.name@gnu.org>, "Marco Wahl" <marcowahlsoft@gmail.com>, "Org-Mode mailing list" <emacs-orgmode@gnu.org>
> Subject: Re: Using org-agenda-time-grid with lists
>
> On 2020-12-11 10:45, steve-humphreys@gmx.com wrote:
> >
> > Incidentally, how can one print a list in messages buffer?
>
> Do you mean something other than standard:

Correct, something other than "%s".

>
> ```
> (message "%s" my-list)
> ```
> I wrote some quite involved function to take a list of variables and
> print them to Messages buffer, formatting them nicely.  I use it when
> debugging and writing code.  However I am not sure that is what you are
> looking for or not?

What is the biggest problem with printing lists that you have encountered?

> Cheers,
> TRS-80

Cheers always sounds better on a friday. :)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Using org-agenda-time-grid with lists
  2020-12-11 16:48       ` steve-humphreys
@ 2020-12-11 17:23         ` TRS-80
  2020-12-11 18:18           ` Christopher Dimech
  0 siblings, 1 reply; 10+ messages in thread
From: TRS-80 @ 2020-12-11 17:23 UTC (permalink / raw)
  To: emacs-orgmode

On 2020-12-11 11:48, steve-humphreys@gmx.com wrote:
> TRS-80 wrote:
>> On 2020-12-11 10:45, steve-humphreys@gmx.com wrote:
>> >
>> > Incidentally, how can one print a list in messages buffer?
>> 
>> Do you mean something other than standard:
> 
> Correct, something other than "%s".
> 
>> 
>> ```
>> (message "%s" my-list)
>> ```
>> I wrote some quite involved function to take a list of variables and
>> print them to Messages buffer, formatting them nicely.  I use it when
>> debugging and writing code.  However I am not sure that is what you 
>> are
>> looking for or not?
> 
> What is the biggest problem with printing lists that you have 
> encountered?

I don't have any problem printing simple list.  Well, maybe one case.
If the list is too long (because you only get some part of it in
Messages buffer).  In that case, I do my function in fundamental-mode
with C-j (I think?)  which put the results in the same buffer.  Then you
can do <TAB> (or maybe it's <RET>?) and that will expand to the full
result, if you need to look at that.

But the reason I wrote my function was because I wanted to provide short
list of (separate) variables and have them print out to nicely formatted
message as intermediate structure code and/or for debugging purposes.
Which is nothing to do with lists, per say.

> Cheers always sounds better on a friday. :)

You make me thirsty all of a sudden!  :)

Cheers,
TRS-80


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Using org-agenda-time-grid with lists
  2020-12-11 17:23         ` TRS-80
@ 2020-12-11 18:18           ` Christopher Dimech
  2020-12-11 18:38             ` TRS-80
  0 siblings, 1 reply; 10+ messages in thread
From: Christopher Dimech @ 2020-12-11 18:18 UTC (permalink / raw)
  To: TRS-80; +Cc: emacs-orgmode

> Sent: Friday, December 11, 2020 at 6:23 PM
> From: "TRS-80" <lists.trs-80@isnotmyreal.name>
> To: emacs-orgmode@gnu.org
> Subject: Re: Using org-agenda-time-grid with lists
>
> On 2020-12-11 11:48, steve-humphreys@gmx.com wrote:
> > TRS-80 wrote:
> >> On 2020-12-11 10:45, steve-humphreys@gmx.com wrote:
> >> >
> >> > Incidentally, how can one print a list in messages buffer?
> >>
> >> Do you mean something other than standard:
> >
> > Correct, something other than "%s".
> >
> >>
> >> ```
> >> (message "%s" my-list)
> >> ```
> >> I wrote some quite involved function to take a list of variables and
> >> print them to Messages buffer, formatting them nicely.  I use it when
> >> debugging and writing code.  However I am not sure that is what you
> >> are
> >> looking for or not?
> >
> > What is the biggest problem with printing lists that you have
> > encountered?
>
> I don't have any problem printing simple list.  Well, maybe one case.
> If the list is too long (because you only get some part of it in
> Messages buffer).  In that case, I do my function in fundamental-mode
> with C-j (I think?)  which put the results in the same buffer.  Then you
> can do <TAB> (or maybe it's <RET>?) and that will expand to the full
> result, if you need to look at that.
>
> But the reason I wrote my function was because I wanted to provide short
> list of (separate) variables and have them print out to nicely formatted
> message as intermediate structure code and/or for debugging purposes.
> Which is nothing to do with lists, per say.

Perhaps you might get some ideas from
https://github.com/oantolin/icomplete-vertical

> > Cheers always sounds better on a friday. :)
>
> You make me thirsty all of a sudden!  :)

:)

> Cheers,
> TRS-80
>
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Using org-agenda-time-grid with lists
  2020-12-11 18:18           ` Christopher Dimech
@ 2020-12-11 18:38             ` TRS-80
  0 siblings, 0 replies; 10+ messages in thread
From: TRS-80 @ 2020-12-11 18:38 UTC (permalink / raw)
  To: emacs-orgmode

On 2020-12-11 13:18, Christopher Dimech wrote:
> 
> Perhaps you might get some ideas from
> https://github.com/oantolin/icomplete-vertical

Oooooohh, Chris reply make me think different about this.

My original reply was about simply printing an Elisp list (data type) to
the *Messages* buffer.

If it's about (vertical or other) narrowing completion based on lists in
the /minibuffer/ (which could also be referred to as "message" area)
then that's something else altogether...

In that department, I have been using Ivy very happily for a few years
now.

I think maybe we need some clarification from OP which he was referring
to?  Or what exactly trying to accomplish?

Cheers,
TRS-80


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Using org-agenda-time-grid with lists
  2020-12-11 15:45   ` steve-humphreys
  2020-12-11 16:39     ` TRS-80
@ 2020-12-11 22:22     ` Marco Wahl
  2020-12-11 23:04       ` steve-humphreys
  1 sibling, 1 reply; 10+ messages in thread
From: Marco Wahl @ 2020-12-11 22:22 UTC (permalink / raw)
  To: steve-humphreys; +Cc: Org-Mode mailing list

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.

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.

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.


HTH,
-- 
Marco


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Using org-agenda-time-grid with lists
  2020-12-11 22:22     ` Marco Wahl
@ 2020-12-11 23:04       ` steve-humphreys
  0 siblings, 0 replies; 10+ messages in thread
From: steve-humphreys @ 2020-12-11 23:04 UTC (permalink / raw)
  To: Marco Wahl; +Cc: Org-Mode mailing list



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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-12-11 23:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git