GNU bug report logs -
#14509
Centerd calendar buffer
Previous Next
Reported by: E Sabof <esabof <at> gmail.com>
Date: Wed, 29 May 2013 23:14:02 UTC
Severity: wishlist
Tags: wontfix
Done: Stefan Kangas <stefan <at> marxist.se>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
The following snippet will center the content of the calendar window. If
there is interest in integrating this into emacs, I can reformat it as a
patch. A possible interface to enable it could be
(setq calendar-left-margin 'auto)
Evgeni
(require 'cl-lib)
(defun calendar-mode-options ()
(setq calendar-left-margin 1)
(add-hook 'window-configuration-change-hook
'es-calendar-win-config-hook nil t))
(add-hook 'calendar-mode-hook 'calendar-mode-options)
(defun es-calendar-win-config-hook ()
(catch 'exit
(with-current-buffer
(or (get-buffer calendar-buffer)
(throw 'exit nil))
(dolist (win (get-buffer-window-list nil nil t))
(with-selected-window win
(let* (( max (+ (* 7 3 3)
(* 2 calendar-intermonth-spacing)
-1))
( left (max 0 (/ (- (window-body-width) max) 2))))
(dolist (ov (overlays-in (point-min) (point-max)))
(when (and (overlay-get ov 'left-center-margin)
(eq (selected-window)
(overlay-get ov 'window)))
(delete-overlay ov)))
(save-excursion
(goto-char (point-min))
(cl-loop for ov
= (make-overlay
(line-beginning-position)
(1+ (line-beginning-position)))
do (progn
(overlay-put ov 'window (selected-window))
(overlay-put ov 'display (make-string left ?\s
))
(overlay-put ov 'left-center-margin t)
)
while (zerop (forward-line))
))))))))
(defadvice calendar-generate (after center-calendar activate)
(es-calendar-win-config-hook))
[Message part 2 (text/html, inline)]
This bug report was last modified 4 years and 363 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.