如何在 Emacs 日历中突出显示周末?

Coe*_*ang 1 emacs calendar elisp

我正在使用 Emacs 和开放日历,现在我想用浅色背景颜色突出显示周末,我尝试谷歌但没有可靠的解决方案。任何人都可以帮忙吗?多谢!

抱歉,我还不能发布图片,希望我已经把问题说清楚了。

jua*_*eon 5

这里有一些代码可以做到这一点。如果您不喜欢我使用的面孔,则需要更改font-lock-doc-string-face为您想要使用的面孔(或制作一张新面孔并进行配置)。

(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)))))
Run Code Online (Sandbox Code Playgroud)