[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Calendar: Highlight certain holidays
From: |
Emanuel Berg |
Subject: |
Re: Calendar: Highlight certain holidays |
Date: |
Fri, 05 May 2017 03:39:33 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Rolf Ade <rolf@pointsman.de> writes:
> I use calendar and then its function holidays often
> enough, that I set the variable calendar-holidays in
> my init.el.
>
> It occurs with me, that I would be helpful, if the
> holiday list would be colourful. The one added by me
> to calendar-holidays in another face than the holidays
> coming out of the default. And then also different
> faces for the holidays, I added (e.g. for distinction
> between public holidays and memorial days (say Mothers
> Day)).
>
> I looked into it, but there is nothing obvious.
> The user is able to control, what holidays appear in
> the buffer, that lists it, but every entry in this
> buffer is equal to each other in how it is displayed.
Put point at a holiday and use this function to
determine if there is a special face for holidays:
(defun what-face (pos)
(interactive "d")
(let((face (or (get-char-property pos 'face)
(get-char-property pos 'read-cf-name) )))
(message " Face: %s" (or face "(no face!)")) ))
If there isn't, you can add them manually for
whichever mode the calendar goes by, just as I did
here - see how it looks in the screenshot, last. [1]
(font-lock-add-keywords 'emacs-lisp-mode
'(
("(?interactive?)" . font-lock-builtin-face)
("font-lock-builtin-face" . font-lock-builtin-face)
("font-lock-comment-delimiter-face" .
font-lock-comment-delimiter-face)
("font-lock-comment-face" . font-lock-comment-face)
("font-lock-constant-face" . font-lock-constant-face)
("font-lock-doc-face" . font-lock-doc-face)
("font-lock-function-name-face" . font-lock-function-name-face)
("font-lock-keyword-face" . font-lock-keyword-face)
("font-lock-negation-char-face" . font-lock-negation-char-face)
("font-lock-preprocessor-face" . font-lock-preprocessor-face)
("font-lock-reference-face" . font-lock-reference-face)
("font-lock-string-face" . font-lock-string-face)
("font-lock-syntactic-face-function" .
font-lock-syntactic-face-function)
("font-lock-type-face" . font-lock-type-face)
("font-lock-variable-name-face" . font-lock-variable-name-face)
("font-lock-warning-face" . font-lock-warning-face)
("font-lock-regexp-grouping-construct" .
'font-lock-regexp-grouping-construct)
("font-lock-regexp-grouping-backslash" .
'font-lock-regexp-grouping-backslash)
)
t) ; HOW (append)
[1] http://user.it.uu.se/~embe8573/figures/emacs/emacs-lisp-faces.png
--
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
- so far: 26 Blogomatic articles -