1

In a nutshell: I'm looking for a way to selectively hide one instance of a repeated diary entry so it doesn't show up in my org-agenda.


I have many repeating diary entries for things like weekly meetings, etc. using basic sexp syntax.

I've set up my org-agenda to include these diary entries in my weekly/daily views.

Sometimes, a weekly event is cancelled. How can I hide/delete it from my org agenda just this once, without deleting the entire entry in the diary?

1 Answers1

1

How about modifying the last line of your custom diary sexp so that it becomes an and statement that checks to ensure that the DATE is not a member of your excluded dates?:

(and [YOUR-SEXP-RESULT-THAT-IS-NON-NIL]
     (not (member DATE '((2 28 2017)
                         (5 1 2017)
                         (5 31 2017)))))

Granted, of course, you will need to modify the diary sexp every time you decide to add a custom date to be excluded. You can assign the list of excluded dates to a variable that is accessible to the sexp, if that makes things easier to add additional dates as needed ...

Here is a link to an example of a custom diary sexp that looks for the last day of every month:

https://emacs.stackexchange.com/a/31708/2287

The last line in that linked example is (= day last-day-of-month), which would be replaced with the snippet above -- the incoming argument of date to the custom sexp named diary-last-day-of-month is written in lowercase; i.e.,

(and (= day last-day-of-month)
     (not (member date '((2 28 2017)
                         (5 1 2017)
                         (5 31 2017)))))
lawlist
  • 18,826
  • 5
  • 37
  • 118
  • Where is "date" defined? I'm experimenting with this but can't get it to work (nothing shows up in my agenda). – wanderingmathematician Jul 21 '21 at 22:00
  • @wanderingmathematician -- The custom function contains one argument, which is the date. As the agenda data gathering functions do their magic, the custom function is called multiple times as the various possible dates are being examined ... The link in the answer will take you to another example with a full custom function with the argument being the date. – lawlist Jul 21 '21 at 23:32