10

This may have an obvious solution, which would explain why I cannot find it anywhere online, but I would like to customize the holidays that show up in my org-agenda--as easily as possible. Instead of manually entering each holiday in a diary or org mode file, I'd ideally like to draw on the "holidays.el" package. To do this I currently have the line %%(org-calendar-holiday) in an org mode file. The only problem is that I get every single holiday showing up in my agenda now, most of which are only useful in clogging up my agenda.

Is there a way to "turn off" some of these calendar lists so they don't get displayed in my agenda? I tried going the route of setting variables like holiday-solar-holidays to "nil," but that doesn't seem to affect their display in the agenda. This increases my suspicion that the holiday-xx-holidays variables are only applicable to the calendar, and not the agenda. If that's the case I'll assuredly have to go another route, and other suggestions would be welcome.

My end goal is to have major U.S. holidays and solar holidays displayed in my agenda. With so few holidays you may ask why I don't manually enter them and forget the org-calendar-holiday function and "holidays.el" library all together. Well, coding the dates of all future solstices and equinoxes doesn't sound very appealing. Plus, I like drawing on what's already been done when I can--in this case the "holidays" package. Although I could be using it in an entirely different manner than it was intended.

As a side note, I read the post entitled "Programmatically add birthdays/holidays to agenda view in org-mode", but there didn't seem to be enough detail to tell if it's the same issue I'm encountering. And interesting as the current answer in that post is, it's not the solution I'm hoping for.

Thanks for your help.

8
  • The link you cited is the code that I wrote up a few days ago -- it does exactly what you want. You can just paste the code into your *scratch* buffer and type M-x eval-buffer RET and then type M-x org-agenda RET and then select Y. It is a fully functional working draft, but needs a little customization to make it prettier and add ability to sort alphabetically, etc. I invented it because it didn't exist. I'm sorry that I haven't wrote up any documentation yet. If you don't like it after you try it, just restart Emacs and you'll be back to where you were before you tried it.
    – lawlist
    Apr 27, 2015 at 18:37
  • That's terrific. Thank you so much, @lawlist. It's interesting that nobody addressed this issue before, or at least published their patch. Thank you for your work on that code. Just to clarify, and as an example, how would I integrate your script with the holidays.el package (as it sounds like it can) to display holiday-solar-holidays holidays too? I read through the calendar-holidays documentation, but it's still not evident to me. This could just be my inexperience showing through!
    – kgo
    Apr 27, 2015 at 21:52
  • Earlier today, I extracted the relevant code from the variable holiday-solar-holidays and inserted it into org-agenda--holiday-list. The code I extracted and added to my own example looks like this: (solar-equinoxes-solstices) (holiday-sexp calendar-daylight-savings-starts . . . In other words, your feature request has already been incorporated into my example.
    – lawlist
    Apr 27, 2015 at 22:27
  • Ah, right. I thought it was in there somewhere. What threw, and continues to throw, me off is the absence of those solar holidays in my agenda. All of your other holidays appear (e.g., birthdays, U.S. holidays) but no sign of DST or the astronomical events. Do these holidays show up for you? Any ideas what I might be doing wrong? Everything else looks terrific. I see the (solar-equinoxes-solstices) ... code, so I didn't simply omit it by accident.
    – kgo
    Apr 27, 2015 at 23:30
  • With a basic Emacs installation and only the code in the example, I get four (4) entries for the function (solar-equinoxes-solstices): (6 21 2015) -- holiday -- Summer Solstice 9:37am (PDT); (9 23 2015) -- holiday -- Autumnal Equinox 1:20am (PDT); (12 21 2015) -- holiday -- Winter Solstice 8:47pm (PST); and, (3 19 2016) -- holiday -- Vernal Equinox 9:29pm (PDT). The function uses certain values depending upon whether or not the user has defined the following variables: calendar-time-zone and calendar-standard-time-zone-name -- e.g., UTC will be used if no time zone.
    – lawlist
    Apr 28, 2015 at 4:53

2 Answers 2

9

I have holidays displayed in my org-agenda; here's how I do it. Via Customize, (changing custom-set-variables) :

Turn off holidays I don't want displayed :

'(holiday-bahai-holidays nil)
'(holiday-hebrew-holidays nil)
'(holiday-islamic-holidays nil)

Tell agenda to display events from calendar diary:

'(org-agenda-include-diary t)

Result : holidays will show up in agenda. You can also create your own holidays by changing the variable holiday-other-holidays.

1
  • Some of the holidays seem to need further effort to turn off, e.g., (defalias 'holiday-bahai-ridvan #'ignore). Apr 30, 2021 at 7:56
2

If you use calfw to show your calendar.

You should use

(setq cfw:display-calendar-holidays nil)

to switch for displaying holidays

as described here

1
  • If cfw:display-calendar-holidays has a non-nil value, calfw displays holidays using the function calendar-holiday-list, which consults the variable calendar-holidays. A nil value for cfw:display-calendar-holidays will suppress the display of holidays. github.com/kiwanami/emacs-calfw/blob/master/calfw.el#L1852 As of 11/28/2017, the default value for the variable cfw:display-calendar-holidays is t.
    – lawlist
    Nov 28, 2017 at 22:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.