Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bookmark restoration seems broken? #745

Closed
minad opened this issue Nov 25, 2020 · 12 comments
Closed

Bookmark restoration seems broken? #745

minad opened this issue Nov 25, 2020 · 12 comments

Comments

@minad
Copy link
Contributor

minad commented Nov 25, 2020

I was wondering before if it's my code (#744) or if its treemacs but it seems treemacs has problems restoring bookmarks when I have selected a node in the imenu.

  1. Select a node
  2. Call bookmark-set in the treemacs buffer, which stores the path to the node
  3. Restart emacs
  4. Restore the treemacs bookmark, I am getting a listp type error from inside the treemacs--bookmark-handler

It seems restoring works if I am not restarting. Is it a serialization problem?

Example backtrace:

Debugger entered--Lisp error: (wrong-type-argument listp "/home/user/.config/emacs/init.el")
  -last-item("/home/user/.config/emacs/init.el")
  treemacs--find-custom-dir-node(("/home/user/.config/emacs/init.el" "Functions" "warp--log"))
  treemacs-goto-node(("/home/user/.config/emacs/init.el" "Functions" "warp--log"))
  treemacs--bookmark-handler(("Treemacs - emacs: warp--log" (treemacs-bookmark-path "/home/user/.config/emacs/init.el" "Functions" "warp--log") (handler . treemacs--bookmark-handler)))
  bookmark-handle-bookmark("Treemacs - emacs: warp--log")
  bookmark--jump-via("Treemacs - emacs: warp--log" pop-to-buffer-same-window)
  bookmark-jump("Treemacs - emacs: warp--log")
@Alexander-Miller
Copy link
Owner

I'll investigate.

It's possible that the bookmark integration before the whole scoping business from #744. If that's the case and bookmarks need a reliable buffer name we might have a problem.

@Alexander-Miller
Copy link
Owner

Update: The problem is specific to tag nodes, files are working.

@minad
Copy link
Contributor Author

minad commented Nov 25, 2020

Update: The problem is specific to tag nodes, files are working.

Yes, this is what I meant by imenu.

@Alexander-Miller
Copy link
Owner

Ok, here's where it gets ugly: Treemacs actually has no way to "move to a tag node" in the way that restoring a bookmark would require. The fact that it does work under some circumstances is pure chance, a related move method is used that does sometimes work out.

Now I could go and fill that gap of course, but the code responsible for finding nodes has undergone a major rewrite on account of #677, working on it now would be utterly uneconomical. So I'm afraid I'm going to have to put this bug on ice until #677 is finished.

In fact please remind me to tackle this issue if you see I haven't done so after #677, bugs are always my first priority, so this one should be fixed as soon as possible.

@minad
Copy link
Contributor Author

minad commented Nov 25, 2020

Ok, thank you for looking at this! Actually for me it would be ok if treemacs does not restore the selected tag node for a bookmark and only restore up to the file. Just in case this makes things simpler.

@Alexander-Miller
Copy link
Owner

Just in case this makes things simpler.

It does. I'll add it as a temporary workaround.

@minad
Copy link
Contributor Author

minad commented Nov 25, 2020

If I recall correctly, most bugs I had in treemacs were due to the imenu. So I think every simplification in that part would help a lot. Furthermore since this imenu part is also dynamically created by an external provider I think treemacs should not try too hard in this area!

@Alexander-Miller
Copy link
Owner

The whole imenu feature hasn't seen much change since I've written it a long time ago, when I was a lot less experienced with elisp. I don't think it's all that well used either. So it makes sense that it can sometimes be rickety. When #677 is done I plan to rewrite it based on the new extension api. That should help with the issues and instabilities that are caused by the current special-casing.

@minad
Copy link
Contributor Author

minad commented Nov 26, 2020

Sounds good!

@Alexander-Miller
Copy link
Owner

Workaround is up now.

@minad
Copy link
Contributor Author

minad commented Nov 28, 2020

Thank you! I will try when updating the packages the next time, when the melpa build finished.

@minad
Copy link
Contributor Author

minad commented Nov 28, 2020

I can confirm, it works!

@minad minad closed this as completed Nov 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants