syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.61k stars 4.89k forks source link

org-roam-mode buffer broken due to (global-)page-break-lines-mode (Spacemacs continuously switches major-mode) #14969

Open dalanicolai opened 3 years ago

dalanicolai commented 3 years ago

Description :octocat:

org-roam-mode buffer is broken due to (global-)page-break-lines-mode

Reproduction guide :beetle:

There should be a backlink, otherwise there is a bug (which probably has not yet been reported). If there is no backlink then customize the org-roam-mode-section-functions. There settings are correct, but possibly have to get 'reapplied`. Please note down as a bug.

Finally if there is a backlink then notice that you can not follow it by placing the cursor on it and pressing enter. If you switch off global-page-break-lines-mode before creating the org-mode buffer (delete and toggle again), then the link does work (as already reported here.

Now the org-roam-mode is derived from special-mode (via magit-section-mode-hook) and, as none of these modes is included in page-break-lines-modes, should be excluded from global-page-break-lines-mode. However Spacemacs, somehow designates the org-roam-mode buffer as (over here) either an emacs-lisp-mode buffer or an org-mode buffer.

Now it took me a long time to find the culprit, and still help is appreciated. So to see what is causing the problem evaluate the following lines:

(defun derived-mode-p (&rest modes)
  "Non-nil if the current major mode is derived from one of MODES.
Uses the `derived-mode-parent' property of the symbol to trace backwards."
  (apply #'provided-mode-derived-p (print major-mode) modes))

now just observe what happens. Spacemacs is switching modes continuously.

The derived-mode-p function is used in page-break-lines-mode-maybe.

So maybe for now we can indeed first switch-off global-page-break-lines-mode for users of org-roam-mode (as suggested here).

Observed behaviour: :eyes: :broken_heart: backlinks don't work

Expected behaviour: :heart: :smile: backlinks work

System Info :computer:

Backtrace :paw_prints:

dalanicolai commented 3 years ago

While I wanted to report the backlink issue, I also noticed that this 'Spacemacs bug' was already reported: https://github.com/org-roam/org-roam/issues/1732

So also it seems that backlinks do not get created before "(re)applying" the org-roam-mode-section-functions or restarting Spacemacs. This seems to have been reported already also: https://github.com/org-roam/org-roam/issues/1708

dalanicolai commented 3 years ago

I am not sure what the bug-tracker label means; but I guess it means this is an upstream bug? Because I think this really is a Spacemacs bug.

lebensterben commented 3 years ago

bug tracker means this is a confirmed bug. if there's a future bug fix or workaround, this will be the tracking issue.

duianto commented 3 years ago

I guess it means this is an upstream bug?

There is a separate Upstream label.

dalanicolai commented 3 years ago

Thanks! Handy to know...

mattford63 commented 3 years ago

After disabling page-break-lines globally, locally, everywhere this issues still occurs.

However if after displaying the org-roam backlink buffer you manually do a org-roam-buffer-refresh it will work (but only if page-break-lines is disabled)

Sergey-Makarov commented 1 year ago

Here is a simple solution that works for me so far and does not require disabling any of the modes (including page-break-line-mode and display-line-number-mode): https://github.com/org-roam/org-roam/issues/1732#issuecomment-1465326574

lebensterben commented 1 year ago

@dalanicolai

please verify whether it fixes your issue

nickanderson commented 1 year ago

The elisp linked by @Sergey-Makarov (https://github.com/org-roam/org-roam/issues/1732#issuecomment-1465326574) fixes this issue for me as well.

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!