liushihao456 / symbols-outline.el

Display symbols (functions, variables, etc) in a side window.
GNU General Public License v3.0
58 stars 3 forks source link

run-hooks: No buffer named *Outline* #7

Closed artelse closed 9 months ago

artelse commented 10 months ago

Apparently the package hooks into a save file hook(?) and outputs run-hooks: No buffer named *Outline* in *messages* on saving an org file for example. I would love to see the package to just hook into prog-mode. I've looked into the code and cannot see where it hooks into save. (Am not an elisp wiz.)

liushihao456 commented 10 months ago

The *Outline* buffer is automatically updated when you save your buffer, if symbols-outline-follow-mode is on. You can turn if off if you like.

artelse commented 10 months ago

The question though is if this is the behavior we want. Why should it hook into irrelevant buffers while it can just hook into prog-mode ones?

liushihao456 commented 10 months ago

There's no hook into irrelevant buffers. The follow-mode adds a hook to after-save-hook that updates the *Outline* buffer.

artelse commented 10 months ago

Yes, I understand that, but after-save-hook is called after any buffer that is saved and that is my point, why not just prog-mode buffers? Edit: added a test for prog-mode: (if (derived-mode-p 'prog-mode) (add-hook 'after-save-hook #'symbols-outline-refresh) and this seems to work.

liushihao456 commented 10 months ago

I see what you mean. There seems no elegant way to achieve what you need. Not only prog-mode buffers have symbols, but also org mode, markdown mode, etc, too. Users may want it to work in those buffers.

Your original error occurs because you delete the *Outline* buffer, it seems. I have added a fix that avoids the error.

artelse commented 10 months ago

Your original error occurs because you delete the *Outline* buffer, it seems. I have added a fix that avoids the error.

Thanks for the fix. The error occurred because the *Outline* buffer was never created in the first place; i.e. only after calling symbols-outline-show.

I tried outlines with org, but it doesn't show anything. Is this related to ctags-universal not knowing about org?

liushihao456 commented 10 months ago

Mine works fine with org. Could you check if the variable symbols-outline-fetch-fn is set to symbols-outline-ctags-fetch in org mode? If yes, could you check if there's any content in the buffer *symbols-outline-ctags-output*?