GNU bug report logs - #14509
Centerd calendar buffer

Previous Next

Package: emacs;

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

From: E Sabof <esabof <at> gmail.com>
To: 14509 <at> debbugs.gnu.org
Subject: bug#14509: Fwd: bug#14509: Centerd calendar buffer
Date: Fri, 31 May 2013 19:27:37 +0100
[Message part 1 (text/plain, inline)]
A better version:

(defun es-calendar-recenter (&optional all-frames)
  (let (( calendar-width
          (+ (* 7 3 3)
             (* 2 calendar-intermonth-spacing)
             -1)))
    (save-excursion
      (goto-char (point-min))
      (while (search-forward-regexp "^ +" nil t)
        (put-text-property
         (match-beginning 0)
         (match-end 0)
         'display
         `(space :align-to (+ center (,(/ calendar-width -2)
                                      . width))))))))
(defadvice calendar-generate (after center-calendar activate)
  (es-calendar-recenter t))

(eval-after-load 'calendar
  '(defun calendar-update-mode-line ()
     "Update the calendar mode line with the current date and date style."
     (if (bufferp (get-buffer calendar-buffer))
         (with-current-buffer calendar-buffer
           (let* ((start (- calendar-left-margin 2))
                  (date (condition-case nil
                            (calendar-cursor-to-nearest-date)
                          (error (calendar-current-date))))
                  (content-string (calendar-string-spread
                                   (mapcar 'eval calendar-mode-line-format)
                                   ?\s (- calendar-right-margin (1-
start)))))
             (setq mode-line-format
                   (concat (propertize
                            " "
                            'display
                            `(space :align-to (+ center (,(/ (length
content-string) -2) . width))))
                           content-string)))
           (force-mode-line-update)))))
[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.