0

Each time I load the agenda buffer, I have to do C-x C-+++ for the content to be a readable size.

How could I modify init so I don't have to do C-x C-+++ anymore?

1 Answer 1

2

You can add a call to text-scale-adjust with the appropriate increment to your org-agenda-finalize-hook:

(add-hook 'org-agenda-finalize-hook (lambda () (text-scale-adjust 3)))

But "solutions" like this are at best band-aids for bad configuration IMO. You should investigate why the agenda is appearing too small.

As a start, what does the agenda look like if you start with emacs -q? If that looks OK, then you'll have to go through your init file and figure out what is happening. C-u C-x = in various places in the agenda will give you information about fonts and faces, so you can narrow your investigation a bit. Find out what you are doing in your init file with these fonts and faces, understand what is going wrong and fix it.

If emacs -q gives you problems as well, then try with emacs -Q: if that shows no problems, chances are that your distro is shipping a config file that causes problems. IIRC, Debian was shipping such a distro-specific config file and was causing problems, although I don't think the problems they caused had anything to do with unreadably small agendas.


EDIT: org-agenda-finalize-hook is run after the initial agenda is created, but it also runs when the agenda is redone with g. In the latter case, we don't want to do the size adjustment, so modify the function that the hook runs to check whether the size is different from the default:

(defun my/org-agenda-adjust-text-size ()
  (if (= text-scale-mode-amount 0)
      (text-scale-adjust 3)))

(add-hook 'org-agenda-finalize-hook #'my/org-agenda-adjust-text-size)

I defined a named function to add to the hook, both because the function is a bit more complicated now, but also because it is "best practice": it makes it easier to delete it from the hook with

(remove-hook 'org-agenda-finalize-hook #'my/org-agenda-adjust-text-size)
7
  • Hi NickD, thanks for the solution and the explanations, Your solution works, it brings Agenda buffer fonts to the same size as my .org buffers. emacs -q and emacs -Q give the same result: font size is too small (same size as Agenda buffer before applying your solution) in every buffer (.org buffers, Agenda buffer, etc.). Before implementing your solution my init was only correcting the size of all .org buffers. Now I still have some buffers with small fonts (dried, message, etc.) but it's ok since I don't use them so often.
    – crocefisso
    Feb 4, 2023 at 18:09
  • FYI I think I fixed the size of the org buffers with this: ` (custom-theme-set-faces 'user '(variable-pitch ((t (:family "spectral" :height 180)))) '(fixed-pitch ((t ( :family "Fira Code Retina" :height 0.8)))) )`. Also I guess Spacemacs theme is playing a role.
    – crocefisso
    Feb 4, 2023 at 18:12
  • Is my config really bad?
    – crocefisso
    Feb 4, 2023 at 18:15
  • Perhaps not: it may be the theme's fault.
    – NickD
    Feb 4, 2023 at 18:41
  • 1
    See the edited answer for a modified function that checks whether the adjustment has been done already.
    – NickD
    Feb 5, 2023 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.