Skip to content

Improve tags behavior #1326

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

Closed
wants to merge 3 commits into from
Closed

Conversation

bergey
Copy link
Contributor

@bergey bergey commented May 15, 2016

This PR fixes problems with tags that I run into when using haskell-mode without an interactive-haskell-mode session.

bergey added 3 commits May 15, 2016 08:27
The function name & docs suggest this is the intended behavior.
`haskell-mode-find-def` errors if there is no session, so we need to
only call it if there is a session.

closes haskell#1180
In my tests, calling hasktags is faster, and has better rules of which
files & directories to search.  More importantly, it produces a more
accurate tags table.

For example, the old version links some types to functions with the same
name (in lowercase).
`interactive-haskell-mode` has `M-.` bound to
`haskell-mode-jump-to-def-or-tag`.  The emacs default `find-tag` does
not work in `haskell-mode`.  This patch allows users of `haskell-mode`
without `interactive-haskell-mode` to use tags.  The binding is
overridden by the `interactive-haskell-mode` map, if that minor mode is active.
@gracjan
Copy link
Contributor

gracjan commented May 15, 2016

We had a PR recently that introduced exactly this find code. What was wrong with it?

@gracjan
Copy link
Contributor

gracjan commented May 15, 2016

Reference #964, #1204.

@bergey
Copy link
Contributor Author

bergey commented May 15, 2016

Thanks for pointing out those related commits. I think #1204 is necessary but not sufficient to using tags without a haskell session.

haskell-mode-generate-tags seems to assume that haskell-mode-find-def will return nil if there is no haskell-session. The actual behavior is (error "No session associated with this buffer. Try M-x haskell-session-change or report this as a bug."). 1919b7d only calls haskell-mode-find-def if the session exists.

I don't think the find code was added in #1204. It was reformatted onto multiple lines, and moved into a different module. The main problem is that when invoked this way, the tags table sometimes sends emacs to the wrong definition. I mentioned this in a comment on #1204 - it's been true for a while. I don't understand the TAGS file format, or exactly what goes wrong.

It seems the main point of #1204 was to call hasktags from emacs without going through ghci. It also finds the .cabal directory (where the TAGS should go) without using ghci. These are also improvements!

If you want some but not all three of these commits I can split them up.

@gracjan
Copy link
Contributor

gracjan commented May 15, 2016

The pruning of irrelevant directories seems to be important: #1204 (comment), we need the find command in place.

Redefining M-. does not look like a good idea to me. There are other keys that are also in the same group: C-x 4 ., C-x 5 . and M-C-.. We do not want to redefine too much.

Note that I do not understand why we at all need functions like haskell-mode-tag-find or haskell-mode-jump-to-tag when pure Emacs functionality seems to be doing the trick just fine.

@bergey
Copy link
Contributor Author

bergey commented May 17, 2016

Would you like me to make a new PR with just 1919b7d? Or shall I just close this entirely? I don't have time to figure out the find situation, and I don't feel strongly about the binding.

@gracjan
Copy link
Contributor

gracjan commented May 18, 2016

Yes, lets go with 1919b7d first. I have slightly negative feelings above the two others, I hope we can find better ways.

@bergey
Copy link
Contributor Author

bergey commented May 18, 2016

I expect we can find better ways. Closed in favor of #1330.

@bergey bergey closed this May 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants