unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#14509: Centerd calendar buffer
@ 2013-05-29 23:11 E Sabof
  2020-05-06 23:32 ` Stefan Kangas
  0 siblings, 1 reply; 3+ messages in thread
From: E Sabof @ 2013-05-29 23:11 UTC (permalink / raw)
  To: 14509

[-- Attachment #1: Type: text/plain, Size: 1876 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 2448 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#14509: Centerd calendar buffer
  2013-05-29 23:11 bug#14509: Centerd calendar buffer E Sabof
@ 2020-05-06 23:32 ` Stefan Kangas
  2020-07-22 17:01   ` Stefan Kangas
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Kangas @ 2020-05-06 23:32 UTC (permalink / raw)
  To: E Sabof; +Cc: 14509

E Sabof <esabof@gmail.com> writes:

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

(This was filed in 2013 but never got a reply.)

Thanks for your interest in Emacs, and sorry you didn't get a reply
sooner.

I don't know if you're still interested in working on this.  If you
are, here are some questions:

Could you please explain a bit about the motivation for this feature.
Any particular reason you feel that the calendar buffer is better
centered?  Most other buffers just display text to the left.

And wouldn't it be better to have a general mode to center *any*
buffer?  I know there have been attempts in that direction, and quite
possibly there already exists functioning packages to do it.  That
would mean users could pick and choose where to apply this effect,
rather than having to write code to achieve it "manually" for every
mode.

If I don't hear back from you, I'm inclined to close this bug as
wontfix.  So please let us know what you think.  Thanks in advance.

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#14509: Centerd calendar buffer
  2020-05-06 23:32 ` Stefan Kangas
@ 2020-07-22 17:01   ` Stefan Kangas
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Kangas @ 2020-07-22 17:01 UTC (permalink / raw)
  To: E Sabof; +Cc: 14509

tags 14509 + wontfix
close 14509
thanks

Stefan Kangas <stefan@marxist.se> writes:

> If I don't hear back from you, I'm inclined to close this bug as
> wontfix.  So please let us know what you think.  Thanks in advance.

No reply within 10 weeks, so I'm closing this as wontfix now.

If you are still interested in working on this feature, please reply
back and we can reopen the bug.

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-22 17:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-29 23:11 bug#14509: Centerd calendar buffer E Sabof
2020-05-06 23:32 ` Stefan Kangas
2020-07-22 17:01   ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).