unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: Renato Pontefice <renato.pontefice@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Syntax for  <%%(diary-float )>
Date: Fri, 21 Oct 2022 08:03:47 +0200	[thread overview]
Message-ID: <87fsfhzpa4.fsf@web.de> (raw)
In-Reply-To: <81D47CAB-50F5-4EF5-88E0-D6A898AF1FFD@gmail.com> (Renato Pontefice's message of "Wed, 12 Oct 2022 20:19:57 +0200")

Renato Pontefice <renato.pontefice@gmail.com> writes:

> Can someone tell me the exact syntax if this statement?

So, if you have more specific questions about diary sexps, please ask.
I can't tell that much about the syntax for the usage in org-mode.  If
you have found out your typical way of use patterns, it is a good idea
to add appropriate entries in `org-capture-templates' for them (prevent
mistakes) and use org-capture to add such entries.  You can call your
own defuns in these templates if stuff (e.g. input reading) gets more
complicated.

When you want to use diary sexps as timestamps (e.g. following SCHEDULED
or DEADLINE keywords), AFAIR they are not allowed to be multiline.  That
will just break them.  If you need complex diary sexps there it's better
to define a named function and use that (in one line, then).

For org agenda generation as described in

  (info "(org) Weekly/daily agenda")

you don't need timestamps - you can write the diary sexp in %%(...) form
just after the property list (if there is one) of the entry, and that
%%(...) syntax _is_ allowed to be multiline.  Another important
difference is that in this case the string that appears in the agenda is
the return value of the diary sexp, not the headline of the current
item (as for time stamps).

And then let me add what I always say: many people have a wrong
impression how diary sexps work: these can be _any_ Elisp expression,
anything is allowed.  There is no limitation to use only built-in diary
sexps, you can freely combine them, define your own ones, etc.  The
(only) rule is: A diary sexp is evaluated with the special variable
`date` bound to the considered date, and it is considered to apply for
that day when and only when the return value is non-nil.  That's all.
The built-in diary sexps just implement that - it's a good idea to look
at the code to get a feeling for how that works internally.

Ok, that's all I could think of at the moment - any questions in
particular?

Michael.



      parent reply	other threads:[~2022-10-21  6:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-12 18:19 Syntax for <%%(diary-float )> Renato Pontefice
2022-10-12 19:23 ` Michael Heerdegen
2022-10-12 19:42   ` Jean Louis
2022-10-12 19:59     ` Michael Heerdegen
2022-10-12 19:37 ` Jean Louis
2022-10-21  6:03 ` Michael Heerdegen [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=87fsfhzpa4.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=help-gnu-emacs@gnu.org \
    --cc=renato.pontefice@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.
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).