help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs Calendar - Removing holidays


From: Christopher Dimech
Subject: Re: Emacs Calendar - Removing holidays
Date: Thu, 19 Nov 2020 17:38:20 +0100

> Sent: Thursday, November 19, 2020 at 5:05 PM
> From: "Jean Louis" <bugs@gnu.support>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: Emacs Calendar - Removing holidays
>
> 
> I understand you wish to highlight those days by your choice but not
> holidays when you press `x', is it so?
> 
> Then maybe you do not need to erase holidays, you could maybe make a
> function to mark those days you wish to mark and you can bind it to
> any other key or even to `x'.

Sure as long as it works.  I just want markings for work related dates,
without any other dates when using Emacs for a particular project.
 
> Holidays are in the list:
> 
> (((10 3 2020) "Sukkot") ((10 10 2020) "Shemini Atzeret") ((10 11 2020) 
> "Simchat Torah") ((10 12 2020) "Columbus Day") ((10 20 2020) "Birth of the 
> Báb") ((10 31 2020) "Halloween") ((11 11 2020) "Veteran's Day") ((11 12 2020) 
> "Birth of Bahá’u’lláh") ((11 26 2020) "Thanksgiving") ((12 11 2020) 
> "Hanukkah") ((12 21 2020) "Summer Solstice 1:02pm (EAT)") ((12 25 2020) 
> "Christmas"))
> 
> One holiday is in this form:
> 
> ((10 3 2020) "Sukkot")
> 
> So you could construct your list of holidays this way:
> 
> '((10 3 2020) "Sukkot")
>   (11 29 2020) "Something else"))
> 
> And you put it in some function that returns such list or you can
> simply construct that list and call it `my-important-dates'
> 
> Then copy this function `calendar-mark-holidays' to your file from holidays.el
> 
> (defun calendar-mark-holidays (&optional event)
>   "Mark notable days in the calendar window.
> If EVENT is non-nil, it's an event indicating the buffer position to
> use instead of point."
>   (interactive (list last-nonmenu-event))
>   ;; If called from a menu, with the calendar window not selected.
>   (with-current-buffer
>       (if event (window-buffer (posn-window (event-start event)))
>         (current-buffer))
>     (setq calendar-mark-holidays-flag t)
>     (message "Marking holidays...")
>     (dolist (holiday (calendar-holiday-list))
>       (calendar-mark-visible-date (car holiday) calendar-holiday-marker))
>     (message "Marking holidays...done")))
> 
> Then change it little by:
> 
> (defun my-calendar-mark-my-days (&optional event)
>   "Mark notable days in the calendar window.
>   (interactive)
>   ;; If called from a menu, with the calendar window not selected.
>   (with-current-buffer
>     (setq calendar-mark-holidays-flag t)
>     (message "Marking my days...")
>     (dolist (holiday (this-function-returns-my-days))
>       (calendar-mark-visible-date (car holiday) calendar-holiday-marker))
>     (message "Marking my days...done")))
> 
> Then you may bind that function to a key in calendar mode map.
> 
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]