unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: Calendar: Highlight certain holidays
Date: Fri, 05 May 2017 03:39:33 +0200	[thread overview]
Message-ID: <87lgqcgjzc.fsf@debian.uxu> (raw)
In-Reply-To: 87shkk9m0j.fsf@pointsman.de

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 -                   




      reply	other threads:[~2017-05-05  1:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-05  0:37 Calendar: Highlight certain holidays Rolf Ade
2017-05-05  1:39 ` Emanuel Berg [this message]

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=87lgqcgjzc.fsf@debian.uxu \
    --to=embe8573@student.uu.se \
    --cc=help-gnu-emacs@gnu.org \
    /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).