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

Use tags-table-list instead of tags-file-name #592

Merged
merged 1 commit into from
Apr 22, 2015
Merged

Use tags-table-list instead of tags-file-name #592

merged 1 commit into from
Apr 22, 2015

Conversation

geraldus
Copy link
Contributor

Tested:

  • (haskell-process-generate-tags) ⇒ "Tags generated."
  • (haskell-process-generate-tags "SomeTag") ⇒ jumps to tag definition

Sorry, I can't get rid of first commit (without delete and re-fork).

@gracjan
Copy link
Contributor

gracjan commented Apr 22, 2015

Do:

git rebase -i HEAD~2

then squash those commit into one commit (read on the internet how to do this)

then force-push new version:

git push origin +tags-table

@gracjan
Copy link
Contributor

gracjan commented Apr 22, 2015

In magit this is magit-log, got to the commit line, Shift-E, then s, then C-c C-c, then edit commit message so it is nice, then Shift-P then - f, then Shift-P.

@geraldus
Copy link
Contributor Author

Phew, looks like I've done! Thank you, Gracjan!

@gracjan
Copy link
Contributor

gracjan commented Apr 22, 2015

@lukehoersten: can you also have a look at this? How tags work is a bit of mystery to me... Thanks!

@lukehoersten
Copy link
Member

What's the difference between tags-table-list and tags-file-name? Why is tags-table-list better?

@gracjan
Copy link
Contributor

gracjan commented Apr 22, 2015 via email

@geraldus
Copy link
Contributor Author

@lukehoersten I had similar question, original PR #478 message was:

This way I can jump not only in the file I'm in, but to the library sources as well...

Tested:

+ (haskell-process-generate-tags) ⇒ "Tags generated."
+ (haskell-process-generate-tags "SomeTag") ⇒ jumps to tag definition
lukehoersten added a commit that referenced this pull request Apr 22, 2015
Use tags-table-list instead of tags-file-name
@lukehoersten lukehoersten merged commit b2aa551 into haskell:master Apr 22, 2015
@geraldus geraldus deleted the tags-table branch April 22, 2015 15:17
purcell added a commit to purcell/haskell-mode that referenced this pull request Nov 2, 2015
As part of haskell#592, commit 2b4e49c modified this code to alter the global
value of tags-table-list as a side-effect, but this change was incorrect
and causes problems elsewhere.

Specifically, consider the following scenario:

- User tries to jump to a definition with haskell-mode-jump-to-def-or-tag
- That function falls back to haskell-mode-tag-find, which then calls
  haskell-mode-jump-to-tag

This results in a call to haskell-process-generate-tags, which tries to
run hasktags, whether or not it is installed. As a side effect, the
global value of tags-table-list is set to include
"/project/root/dir/TAGS", which was probably not even created
properly (most people won't have hasktags installed).

Then, imagine we're working in an unrelated project, and use Emacs'
built-in completion-at-point functionality (or company-mode, which wraps
it). Now, the tags-completion-at-point-function (enabled by default)
sees and uses the modified value of tags-table-list, and errors noisily
when called because that file does not exist. And even if it didn't
error, the tags would not be relevant to the current project.

In other words, this code either breaks or disrupts completion
everywhere beyond the current haskell project.

So, the correct solution here is to leave tags-table-list unchanged:
users such as the author of 2b4e49c should instead use directory-local
variables to set tags-table-list or tags-file-name locally to their
haskell project.
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.

3 participants