alphapapa / org-sidebar

A helpful sidebar for Org mode
GNU General Public License v3.0
527 stars 16 forks source link

automatically open sidebar when opening org file not working #15

Closed Moanrisy closed 4 years ago

Moanrisy commented 4 years ago

I use org-mode-hook to launch org-sidebar-toggle (add-hook 'org-mode-hook 'org-sidebar-toggle) but it's not working

alphapapa commented 4 years ago

That won't do what you think it will, because it will call the function every time an Org buffer is opened, which would turn the sidebar on and off.

Since this is not a bug, please post a message asking for help in a more appropriate place, e.g. https://old.reddit.com/r/orgmode. You may tag me there if you like, /u/github-alphapapa.

Moanrisy commented 4 years ago

I found a way, I will leave this config, here maybe someone interested in future. (defun my-sidebar-hook () (when (string= (file-name-extension buffer-file-name) "org") (org-sidebar) (org-sidebar-toggle) )) (add-hook 'deft-open-file-hook 'my-sidebar-hook)