Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

customize width of cells in monthly view? #45

Open
holtzermann17 opened this issue Nov 26, 2014 · 6 comments
Open

customize width of cells in monthly view? #45

holtzermann17 opened this issue Nov 26, 2014 · 6 comments

Comments

@holtzermann17
Copy link

If I adjust the font size to be very small in a Calfw buffer, the size of the cells stays the same.
Accordingly, if I have something scheduled using Org Mode, I just see something like this:

 27 (1) ...
HIGH [#A...

I need to switch to Day mode (D) to see what the item was.

@kiwanami
Copy link
Owner

Will you try M-x cfw:refresh-calendar-buffer after font size changing?
This function re-calculates the cell size according to window dimension and font size.

@holtzermann17
Copy link
Author

That doesn't seem to work for me. If I run C-x C-- this shrinks the size of the current window's font, and then M-x cfw:refresh-calendar-buffer has no effect.

If I set the default font in my ~/.emacs to be smaller, then the calendar window does adjust.

@holtzermann17
Copy link
Author

Perhaps this function would be useful for computing the (scaled) width:

(defun buffer-body-width (&optional buffer pixelwise)
  (let ((width (window-body-width (get-buffer-window (or buffer
                                                         (current-buffer)))
                  pixelwise)))
    (floor (cond 
        ((eq text-scale-mode-amount 0)
         width)
        ((> text-scale-mode-amount 0)
         (/ width (* text-scale-mode-step text-scale-mode-amount)))
        ((< text-scale-mode-amount 0)
         (* width (* -1 text-scale-mode-step text-scale-mode-amount)))))))

@kiwanami
Copy link
Owner

kiwanami commented Dec 2, 2014

Thank you for your report and workaround code!
I could reproduce the situation. I'll fix it.

Well, I found this discussion:
https://lists.gnu.org/archive/html/bug-gnu-emacs/2014-11/msg01277.html
I appreciate your elaborate comments for this improvement.

@Dabsen
Copy link

Dabsen commented Jul 26, 2015

What is the current situation on this issue? Is there a workaround, for the time being? I normally work with a big font size, but would like to use a small font size for calfw buffers (otherwise they are unusable). Thanks

@Dabsen
Copy link

Dabsen commented Sep 13, 2015

Here is the workaround I am currently using. As remarked above, the calendar will not adapt to buffer-level zoom-in/zoom-out through the text-scale-adjust command (bound to C-x C-+ / C-x C-- by default). On the other hand, the calendar DOES adjust to frame-wide zooming or de-zooming (for instance via the zoom-frm-out command, or via a font size change through set-face-attribute for the appropriate frame). So what I am doing is launching calfw in a separate dezoomed frame, like this:

  (defun my:open-cal ()
    (interactive)
    (select-frame (make-frame '((name . "calendar")))) ; makes a new frame and selects it
    (set-face-attribute 'default (selected-frame) :height 65) ; reduces the font size of the new frame
    (cfw:open-org-calendar) ; opens the calendar there
    )

Also, I bound q to the following function, which kills the "calendar" frame if that's where we are and otherwise buries the buffer as usual:

  (defun my:close-cal ()
    (interactive)
    (if (string= (frame-parameter (selected-frame) 'name) "calendar")
        (delete-frame)
      (bury-buffer)))

One could also stay in the same frame and rebind the calendar opening and closing commands so as to change the frame-wide font size, I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants