# Increasing the text size of the side panel

**URL:** <https://org-roam.discourse.group/t/increasing-the-text-size-of-the-side-panel/2053>\
**Category:** Requests\
**Created:** [September 23, 2021, 5:20pm UTC](https://org-roam.discourse.group/t/increasing-the-text-size-of-the-side-panel/2053 "2021-09-23T17:20:12Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![wilya](https://avatars.discourse-cdn.com/v4/letter/w/94ad74/32.png) [@wilya](https://org-roam.discourse.group/u/wilya)\
**Post date:** [September 23, 2021, 5:20pm UTC](https://org-roam.discourse.group/t/increasing-the-text-size-of-the-side-panel/2053/1 "2021-09-23T17:20:12Z")

</div>

Hello,

I would like to increase the text size of the side panel. I wrote a function to do that, but I have no idea how to call it when org-roam-buffer-toggle is activated. Is there a way to do it without hacking the org-roam code? Thank you in advance for any suggestion.

```auto
     (defun org-roam-buffer-increase ()
       "stub to increase the side buffer"
       (interactive)
       (save-excursion
         (set-buffer org-roam-buffer)
         (text-scale-adjust +1)))

```

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [September 23, 2021, 5:36pm UTC](https://org-roam.discourse.group/t/increasing-the-text-size-of-the-side-panel/2053/2 "2021-09-23T17:36:57Z")

</div>

Org-roam-mode-hook?

---

<div class="post-metadata">

**Author:** ![wilya](https://avatars.discourse-cdn.com/v4/letter/w/94ad74/32.png) [@wilya](https://org-roam.discourse.group/u/wilya)\
**Post date:** [September 24, 2021, 9:49am UTC](https://org-roam.discourse.group/t/increasing-the-text-size-of-the-side-panel/2053/3 "2021-09-24T09:49:23Z")

</div>

I tried but it is way, way above my beginner’s ability. This is the code I put in:

```auto
(defun org-roam-buffer-increase ()
      "stub to increase the side buffer"
      (interactive)
      (when (get-buffer org-roam-buffer)
        (save-excursion
          (set-buffer org-roam-buffer)
          (text-scale-adjust +1))))
    (add-hook 'org-roam-mode-hook (org-roam-buffer-increase))

```

but every time I open the side buffer I get “Symbol’s function definition is void: nil”.

I found a solution though. It works well enough for me. Instead of calling org-roam-buffer-toggle when I call my function, I include org-roam-buffer-toggle in the function and bind “C-c n l” to my function.

```auto
(use-package org-roam
    :quelpa (:upgrade t)
    :after org
    :ensure t
    :init
    (setq org-roam-v2-ack t)
    ;; for org-roam-buffer-toggle
    (add-to-list 'display-buffer-alist
                 '("\\*org-roam\\*"
                   (display-buffer-in-direction)
                   (direction . right)
                   (window-width . 0.33)
                   (window-height . fit-window-to-buffer)))
    :custom
...    
    :config
    (org-roam-bibtex-mode +1) ;; starts org-roam-bibtex-mode to make Helm-bibtex use Org-roam
...
    (defun my/org-roam-buffer-increase ()
      "stub to increase the side buffer text size"
      (interactive)
      (org-roam-buffer-toggle)
      (save-excursion
        (set-buffer org-roam-buffer)
        (text-scale-adjust +1)))
    :bind 
    (("C-c n l" . my/org-roam-buffer-increase)
...
  )

```

@nobiot

Thank you again for helping me out and for all the work you are doing.

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [September 24, 2021, 10:07am UTC](https://org-roam.discourse.group/t/increasing-the-text-size-of-the-side-panel/2053/4 "2021-09-24T10:07:58Z")

</div>

Oh, I see. No it should be the other around

I don’t use `use-package` which has its [own syntax to use `:hook`](https://github.com/jwiegley/use-package#hooks). But for plain Elisp, you can simply put something like this outside the function definition:

```auto
(add-hook 'org-roam-mode-hook 'org-roam-buffer-increase)

```

This should call `org-roam-buffer-increase` function when `org-roam-mode` is enabled (this should be when you open the backlinks buffer). I believe it should be every time you open a new one but cannot be sure.

For some convention, some people add “#” to symbols to indicate functions as in `(add-hook 'org-roam-mode-hook #'org-roam-buffer-increase)` I don’t see any benefit with doing it – with/without “#” just works fine.

e.g. I have this in my config:

```auto
(add-hook 'org-roam-mode-hook #'olivetti-mode)

```

If you use hooks this way, I believe you don’t have to find and set `org-roam-buffer` explicitly – the function would just work on the “current-buffer”, which should be the org-roam-buffer in question – you can easily find out if this is true or not…

---

<div class="post-metadata">

**Author:** ![wilya](https://avatars.discourse-cdn.com/v4/letter/w/94ad74/32.png) [@wilya](https://org-roam.discourse.group/u/wilya)\
**Post date:** [September 24, 2021, 2:16pm UTC](https://org-roam.discourse.group/t/increasing-the-text-size-of-the-side-panel/2053/5 "2021-09-24T14:16:16Z")

</div>

@nobiot  
Ah, I confused the syntax between use-package and (add-hook)! Thank you for clarifying how the hook system works! So, I experimented a bit and learned a lot.

I tried add-hook first, and it works:

```auto
 (defun org-roam-buffer-increase ()
      "stub to increase the side buffer"
      (interactive)
      (when (get-buffer org-roam-buffer)
        (save-excursion
          (set-buffer org-roam-buffer)
          (text-scale-adjust +1))))
    (add-hook 'org-roam-mode-hook #'org-roam-buffer-increase)

```

You said:

> [@nobiot](#):
>
> If you use hooks this way, I believe you don’t have to find and set `org-roam-buffer` explicitly – the function would just work on the “current-buffer”, which should be the org-roam-buffer in question – you can easily find out if this is true or not…

… and indeed, you are right. If I do this, it works as well:

```auto
   (defun org-roam-buffer-increase ()
      "stub to increase the text in the side buffer"
      (interactive)
      (text-scale-adjust +1))
    (add-hook 'org-roam-mode-hook #'org-roam-buffer-increase)

```

Then, I thought that I could avoid writing the function all together and use an anonymous function, and also this works:

```auto
(add-hook 'org-roam-mode-hook (lambda () (text-scale-adjust +1)))

```

Finally, I tried to use use-package syntax, in this way. This is unsuccessful. No error message, but the text size does not change:

```auto
:hook
      (org-roam-mode-hook . (lambda () (text-scale-adjust +1)))

```

Overall, I am quite happy. I can solve my problem in several possible ways and I learned something new. Thank you.

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [September 24, 2021, 4:00pm UTC](https://org-roam.discourse.group/t/increasing-the-text-size-of-the-side-panel/2053/6 "2021-09-24T16:00:05Z")

</div>

This is impressive! I don’t believe you never coded in any language before. I took me very long to get my head around `lambda`

---

<div class="post-metadata">

**Author:** ![QingshuiZheng](https://avatars.discourse-cdn.com/v4/letter/q/87869e/32.png) [@QingshuiZheng](https://org-roam.discourse.group/u/QingshuiZheng)\
**Post date:** [September 25, 2021, 5:00am UTC](https://org-roam.discourse.group/t/increasing-the-text-size-of-the-side-panel/2053/7 "2021-09-25T05:00:36Z")

</div>

> [@wilya](#):
>
> Finally, I tried to use use-package syntax, in this way. This is unsuccessful. No error message, but the text size does not change:
> 
> ```auto
> :hook
> (org-roam-mode-hook . (lambda () (text-scale-adjust +1)))
> 
> ```

You might want to remove the `-hook` suffix when using use-package `:hook` function

So it should be:

```auto
:hook (org-roam-mode . (lambda () (text-scale-adjust +1)))

```

In case you might want to read about the use-package Hooks:

> **[GitHub - jwiegley/use-package: A use-package declaration for simplifying your...](https://github.com/jwiegley/use-package#hooks)**
>
> A use-package declaration for simplifying your .emacs - GitHub - jwiegley/use-package: A use-package declaration for simplifying your .emacs

---

<div class="post-metadata">

**Author:** ![wilya](https://avatars.discourse-cdn.com/v4/letter/w/94ad74/32.png) [@wilya](https://org-roam.discourse.group/u/wilya)\
**Post date:** [September 25, 2021, 9:34am UTC](https://org-roam.discourse.group/t/increasing-the-text-size-of-the-side-panel/2053/8 "2021-09-25T09:34:43Z")

</div>

@nobiot  
The only code I wrote is a bit of shell code and I also used a scripting language from a scientific imaging software. Nothing more than few lines of code. I don’t know why, but elisp clicks with my weird brain, I tried so many times to learn coding from reading books and always failed miserably. With elisp, I look at code written by people like you, and I almost get it, and more I read it and more I get it. It is bizarre and I can’t understand why it is like this for me.

I saw the anonymous function used in init.el of some org-mode guru and it stuck with me, That’s all.

---

<div class="post-metadata">

**Author:** ![wilya](https://avatars.discourse-cdn.com/v4/letter/w/94ad74/32.png) [@wilya](https://org-roam.discourse.group/u/wilya)\
**Post date:** [September 25, 2021, 9:42am UTC](https://org-roam.discourse.group/t/increasing-the-text-size-of-the-side-panel/2053/9 "2021-09-25T09:42:32Z")

</div>

@QingshuiZheng I am a bit embarrassed to admit that I looked at the documentation several times, and I never noticed that in :hook you are supposed to remove “-hook” from the variable name. I am really grateful that you took the time to read my post and respond with the correct suggestion. I learned something, thanks to you. Of course, the code now works perfectly.

To summarize, if a org-roam user would like to change the size of the text in the side buffer, the most concise way to do it in the use-package framework, is the code shown in @QingshuiZheng above message. This is what I have included in my init file. Thank you again both to @nobiot and @QingshuiZheng . This community is amazing.
