alphapapa / navi

superfast navigation and remote control for Emacs source code buffers (based on Emacs occur-mode)
14 stars 8 forks source link

navi-search-and-switch requires outshine-mode to be activated (e.g. in Org buffers) #8

Open neophrema opened 4 years ago

neophrema commented 4 years ago

Hello,

I tested in Vanilla emacs (doom emacs aswell, different error message, same result/fix);

Reproduce:

Open: example.org Modeline shows org-mode is enabled - I can colapse headings.

  1. M-x navi-search-and-switchexits: Symbol's value as variable is void: outshine-promotion-headings

  2. Invoking Org mode: M-x org-mode

  3. M-x navi-search-and-switch works as expected.


Excuse me, I'm not a coder: Org-mode seems to me to be partially loaded; Navi seems to look for a variable that's not existent at this point. If i have invoked org-mode for one time this session of emacs works with different files even on new load-up; so I have to start it only once.

What is happening? Is this an issue of Navi-Mode? Is there a possibility to use another variable internally or invoke a hook?

Sincerely, v.

alphapapa commented 4 years ago

Please try this:

  1. Open example.org.
  2. M-x outshine-mode RET.
  3. M-x navi-search-and-switch RET.
alphapapa commented 4 years ago

This may have been caused by commit a00e2eb.

I suppose the obvious fix would be to ensure that outshine-mode is activated, however I'm not sure if that's necessarily right or good in all Org buffers.

@DamienCassou What do you think?

Thanks.

DamienCassou commented 4 years ago

alphapapa notifications@github.com writes:

@DamienCassou What do you think?

I'm not using navi anymore. Sorry.

-- Damien Cassou

"Success is the ability to go from one failure to another without losing enthusiasm." --Winston Churchill

neophrema commented 4 years ago

Hello, thanks for your investigation. Yes, enabling outshine-mode makes navi-mode work as expected. I think the clearer fix would be considering the "faulty" commit and changing something in that code since a lot of people will experience this and maybe stutter as well? What now?

Thanks! v.

alphapapa commented 4 years ago

@neophrema

That commit is not necessarily faulty; AFAIR it was made to preserve compatibility with changes to Outshine. That it doesn't work unless outshine-mode is active was, at worst, an oversight. It is not clear how outshine-mode works, or how it should work, when org-mode is also active in a buffer. AFAIK they are not intended to be used at the same time in the same buffer.

I would suggest that you should either activate outshine-mode before using this command, or simply don't use navi for this purpose in org-mode buffers. There are many ways of quickly navigating to headings in Org buffers that are faster, easier, and more up-to-date than navi-search-and-switch. navi is more intended to be used in non-Org buffers.

neophrema commented 4 years ago

@alphapapa Thank you for your explaination. I understand. I was just thinking about other users, your answer seems like navi-mode is deprecated in your opinion. Navi-mode served me quite well actually. May I ask, last question, what other navigation options you are thinking of? I need a ToC at the side of my buffer quite frequently, being able to sort headings is also appreciated. You have something you can point me at? Thanks a lot, this issue can be closed then, I guess. sincerely, v.

alphapapa commented 4 years ago

As you can see, the commit that may have caused this was made about 16 months ago, and you are the first to report a problem. So I don't think it has affected many users.

Your problem is specifically with regard to using Navi in Org buffers. I guess that was intended to work, and apparently it still does, if outshine-mode is activated. So as long as that remains the case, you could simply activate outshine-mode in your org-mode-hook, and the problem should be solved for you.

The issue is whether outshine-mode is intended to be supported in Org buffers. I'm not sure what's best, but I think we shouldn't make that promise. The interactions already seem very complicated and hard to untangle. And Outshine is intended to provide Org-like functionality in non-Org buffers, so it would make no sense to use Outshine on top of Org, AFAIK.

But that does not mean that we should revert that commit. The changes in Outshine that led to this issue were made for good reason.

So it seems that uses like yourself, who wish to use Navi-like functionality in Org buffers, have two choices at the moment:

  1. Activate outshine-mode before using Navi.
  2. Use other tools that provide similar functionality.

As long as option 1 works, the problem seems solved for you.

If that option ceases to work sometime in the future, there are numerous other tools that you could use, some of which are built-in to Org. Please explore the manual, Worg, MELPA, Reddit, and the thousands of blog articles written about these tools. I would specifically recommend helm-org, helm-org-rifle, org-ql, org-sidebar, etc.

As for this issue, I will leave it open for discussion, because I don't think we should activate outshine-mode in Org buffers automatically.

alphapapa commented 4 years ago

@thblt I'm not sure if you use Navi, but what do you think?

neophrema commented 4 years ago

Hello again, thank you very much for your patience and explanatory way. I used navi-mode for years and I usually get positive replies if people ask about 'that buffer there' in emacs meetups. I think it would be advisable to make a short note at the front page regarding this issue, so people have a workaround; Thank you very much for your service, v.