Skip to content
Abdul-Lateef Haji-Ali edited this page Oct 22, 2025 · 8 revisions

Welcome to the emacs-calfw wiki!

Configurations

Customizations

Below is a list of answers to common questions/cutomizations in calfw:

Add week number to calendar title:

As suggested in #137

(advice-add
 #'calfw-render-title-period
 :around
 (lambda (oldfn begin-date end-date)
   (format "%s / Week %2d"
           (funcall oldfn begin-date end-date)
           (car
            (calendar-iso-from-absolute
             (calendar-absolute-from-gregorian
              begin-date))))))

Ellipsis mis-align grid

The default ellipses in Emacs is a single unicode character , when it can be displayed. In true monospaced fonts, this would occupy a single character width and the calfw grid should still be aligned. However, in some fonts the width of this character might be different. In such cases, you may want to change the ellipses to ASCII characters. Using for example:

(setq truncate-string-ellipsis "...")

which would change string truncation in all of Emacs. You may also change it locally in the calendar buffer (using setq-local inside calfw-calendar-mode-hook).

Automatically refresh buffer on text scaling

When text-scale-mode is enabled and the text scale changes, you have to refresh the calfw to re-render the grid. This can be done automatically with some advicing

;; The following creates a custom hook to be called when the text scale changes
(defvar my/text-scale-change-hook nil
  "Hook to be called when a text scale changes.
Requires advising `text-scale-increase'. ")

(defun my/text-scale-increase@after@call-hook (&rest _)
  "Advise after `text-scale-increase' to run `my/text-scale-change-hook'."
  (run-hooks 'my/text-scale-change-hook))
(advice-add #'text-scale-increase :after #'my/text-scale-increase@after@call-hook)

;; This config uses the previous hook to update the calfw view.
(add-hook 'calfw-calendar-mode-hook
          (lambda ()
            (add-hook 'my/text-scale-change-hook 'calfw-refresh-calendar-buffer nil t)))