Coeus Wang
Coeus Wang

Reputation: 268

How to highlight weekend days in Emacs calendar?

I am using Emacs and open calendar, now i would like to highlight weekend days with a light background color, i tried to google but have no solid solutions. anyone can help on this? thanks a lot!

Sorry I can't post pictures yet, hope i have put the question clearly.

Upvotes: 1

Views: 442

Answers (1)

juanleon
juanleon

Reputation: 9410

Here you have some code that does that. You would need to change font-lock-doc-string-face to the face you want to use (or make a new one and configure it) if you don't like the one I used.

(defadvice calendar-generate-month
  (after highlight-weekend-days (month year indent) activate)
  "Highlight weekend days"
  (dotimes (i 31)
    (let ((date (list month (1+ i) year)))
      (if (or (= (calendar-day-of-week date) 0)
              (= (calendar-day-of-week date) 6))
          (calendar-mark-visible-date date 'font-lock-doc-string-face)))))

Upvotes: 5

Related Questions