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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use fast-tags instead of hasktags? #1686

Open
chshersh opened this issue Dec 5, 2019 · 4 comments
Open

How to use fast-tags instead of hasktags? #1686

chshersh opened this issue Dec 5, 2019 · 4 comments

Comments

@chshersh
Copy link
Member

chshersh commented Dec 5, 2019

Thanks for writing and maintaining this Emacs mode! It works really well so far 馃憤

I have some difficulties figuring out how to use fast-tags instead of hasktags. I've installed fast-tags and I can generate proper TAGS file using the following command from the package root:

fast-tags -R -e .

However, I don't know how to call it automatically on file save. I tried the following (similar to #1576):

(setq
   haskell-tags-on-save t
   haskell-hasktags-path "~/.cabal/bin/fast-tags"
)

But this doesn't generate TAGS file on file save. Could you please help to find proper configuration to make fast-tags work properly with haskell-mode? Thanks in advance!

@purcell
Copy link
Member

purcell commented Dec 19, 2019

There is no such configuration possible currently because the code which constructs the hasktags command is pretty much hardcoded. You might consider writing your own function to call fast-tags, e.g.

(defun my/haskell-fast-tags ()
   ;; Use (buffer-file-name) and/or `default-directory` if necessary here
   (shell-command "~/.cabal/bin/fast-tags ..."))

(add-hook 'haskell-mode-hook (lambda () (add-hook 'after-save-hook 'my/haskell-fast-tags t)))

@chshersh
Copy link
Member Author

@purcell Thanks! I will try to use this hook and report the status back 馃憤

@chshersh
Copy link
Member Author

@purcell That command, works, thanks! I specified the following command:

"~/.cabal/bin/fast-tags -R -e ."

Unfortunately, it doesn't completely work. When I'm trying to jump to definition, I see that haskell-mode is looking for the <project_root>/TAGS file while with my command the TAGS file is generated near the module I'm currently editing.

Anyway, looks like it's possible to implement a better integration with fast-tags either by patching fast-tags, or haskell-mode or implementing a wrapper fast-tags-emacs that will created a module in a proper place, or implementing more custom emacs hook.

@purcell
Copy link
Member

purcell commented Dec 24, 2019

or implementing a wrapper fast-tags-emacs that will created a module in a proper place

This is the way to go, I think. You can probably try something like this:

(defun my/haskell-fast-tags ()
   ;; Use (buffer-file-name) and/or `default-directory` if necessary here
   (let ((default-directory (haskell-cabal--find-tags-dir)))
     (shell-command "~/.cabal/bin/fast-tags ...")))

(add-hook 'haskell-mode-hook (lambda () (add-hook 'after-save-hook 'my/haskell-fast-tags t)))

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

No branches or pull requests

2 participants