-
Notifications
You must be signed in to change notification settings - Fork 109
Home
Welcome to the emacs-calfw wiki!
Below is a list of answers to common questions/cutomizations in calfw:
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))))))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).
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)))