Skip to content
Al Haji-Ali edited this page Nov 2, 2025 · 2 revisions

Here you will find various ways to configure calfw

Standard Configurations

Customizations

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

Holidays

The calfw collects holidays from the customize variable calendar-holidays which belongs to holidays.el in the Emacs. See the document and source of holidays.el for details.

Format of month and week days

The calfw uses some customization variables in the calendar.el.

Here is a customization code:

;; Month
(setq calendar-month-name-array
  ["January" "February" "March"     "April"   "May"      "June"
   "July"    "August"   "September" "October" "November" "December"])

;; Week days
(setq calendar-day-name-array
      ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday"])

;; First day of the week
(setq calendar-week-start-day 0) ; 0:Sunday, 1:Monday

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)))

Right-to-left text

Right-to-left text in events can disorder the cells in the calfw table. If this happens you can fix it by adding the right-to-left enforcement character to the table lines:

(let ((ltr (char-to-string ?\u202A))
      (vars '(calfw-fchar-vertical-line
              calfw-fchar-top-left-corner
              calfw-fchar-top-junction
              calfw-fchar-left-junction
              calfw-fchar-junction)))
  (dolist (var vars)
    (let ((val (symbol-value var)))
      (set var (concat (if (characterp val)
                           (char-to-string val)
                         val)
                       ltr)))))

(The fix adds a "Left-to-right Embedding" unicode character to column breaks)