unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Renato Pontefice <renato.pontefice@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Syntax for  <%%(diary-float )>
Date: Wed, 12 Oct 2022 22:37:19 +0300	[thread overview]
Message-ID: <Y0cXb7z3y0UtLdJV@protected.localdomain> (raw)
In-Reply-To: <81D47CAB-50F5-4EF5-88E0-D6A898AF1FFD@gmail.com>

* Renato Pontefice <renato.pontefice@gmail.com> [2022-10-12 21:21]:
> It’s a while that I’m searching information about this statement. I
> need it on org mode but I ‘m unable to write in in the way I need
> it.  I need that (in org mode) an Agenda TODO happen: the first
> Friday of each mont of all the year.  Can someone tell me the exact
> syntax if this statement?

(diary-float 1 1 1) this gives me void variable date, there is
problem.

Use C-h f on function to examine it:

{C-h f diary-float RET}

diary-float is a Lisp closure in ‘diary-lib.el’.

(diary-float MONTH DAYNAME N &optional DAY MARK)

Diary entry for the Nth DAYNAME after/before MONTH DAY.
DAYNAME=0 means Sunday, DAYNAME=1 means Monday, and so on.
If N>0, use the Nth DAYNAME after MONTH DAY.
If N<0, use the Nth DAYNAME before MONTH DAY.
DAY defaults to 1 if N>0, and MONTH’s last day otherwise.
MONTH can be a list of months, an integer, or t (meaning all months).
Optional MARK specifies a face or single-character string to use when
highlighting the day in the calendar.

-------------

I guess there is nothing bad using external tools to get the
information you want.

The sqlite3 database, will give this result:

sqlite> SELECT DATE('2022-11-01', 'start of month', 'weekday 5');
2022-11-04

It means now we can easily calculate which date is first day of month,
by doing the list:

(defun my-fridays ()
  (interactive)
  (insert "\n\n")
  (let ((years '(2022 2023 2024)))
    (while years
      (let ((year (pop years))
	    (months '("01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12")))
	(while months
	  (let* ((month (pop months))
		 (date (format "%s-%s-01" year month))
		 (sql (format "SELECT DATE('%s', 'start of month', 'weekday 5')" date)))
	    (insert (caar (sqlite-select rcd-people-sqlite-db sql)) "\n")))))))

(my-fridays)

2022-01-07
2022-02-04
2022-03-04
2022-04-01
2022-05-06
2022-06-03
2022-07-01
2022-08-05
2022-09-02
2022-10-07
2022-11-04
2022-12-02
2023-01-06
2023-02-03
2023-03-03
2023-04-07
2023-05-05
2023-06-02
2023-07-07
2023-08-04
2023-09-01
2023-10-06
2023-11-03
2023-12-01
2024-01-05
2024-02-02
2024-03-01
2024-04-05
2024-05-03
2024-06-07
2024-07-05
2024-08-02
2024-09-06
2024-10-04
2024-11-01
2024-12-06

Now you could use this function to set up events. I do not know how do you set it up.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



  parent reply	other threads:[~2022-10-12 19:37 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 [this message]
2022-10-21  6:03 ` Michael Heerdegen

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=Y0cXb7z3y0UtLdJV@protected.localdomain \
    --to=bugs@gnu.support \
    --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).