emacs-haskell-tutorial icon indicating copy to clipboard operation
emacs-haskell-tutorial copied to clipboard

Generation of tags

Open paldepind opened this issue 10 years ago • 8 comments

I'm following along the tutorial. I'm stuck in the section on settings up tags. No TAGS file is being generated when I save.

Related to haskell-mode I have this in my .emacs

(let ((my-cabal-path (expand-file-name "~/.cabal/bin")))
  (setenv "PATH" (concat my-cabal-path path-separator (getenv "PATH")))
  (add-to-list 'exec-path my-cabal-path))

(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)


(custom-set-variables
  '(haskell-tags-on-save t))

If I do M-: (getenv "PATH") then the correct path to .cabal/bin appears. Hasktags is installed and a binary file exists in the Cabal bin directory.

As I mentioned a tags file is not being generated on save. Thus M-. does not work. If however I do haskell-mode-tag-find then a GHCi session is being started and a TAGS file is generated. From then on the TAGS file is also being updated on save.

In the haskell-mode documentation tags appears as belonging to the interactive mode.

I'm unsure if I'm doing something wrong of if the tags part shouldn't have been included in the non interactive part of the tutorial.

paldepind avatar Oct 13 '15 15:10 paldepind

I have the same problem.

gromakovsky avatar Oct 18 '15 13:10 gromakovsky

Be careful that you only have one custom-set-variables in your .emacs file. I had the same issue initially, and this was the problem.

tmbull avatar Nov 17 '15 04:11 tmbull

@tmbull I don't understand. What do you mean?

paldepind avatar Nov 21 '15 18:11 paldepind

custom-set-variables can only be defined once. For example:

(custom-set-variables '(haskell-tags-on-save t) '(some-other-val t))

Rather than two separate instances of custom-set-variables.

tmbull avatar Nov 21 '15 19:11 tmbull

@paldepind Did the solution by @tmbull work for you? If so, I can add it to the tutorial.

serras avatar Nov 24 '15 17:11 serras

No. I only have one custom-set-variables. As I mentioned, starting a GHCi session makes tag generation on save work.

I am still under the impression that one needs to have an open session in order for the on save tag generation to work. That is what I am experiencing. And I guess that is why the haskell-mode wiki page on the topic is titled "Haskell Interactive Mode Tags". Thus I believe the coverage of tags should be moved to the interactive part of the tutorial.

I also think suggesting the following binding to the tutorial would be a great idea:

(define-key haskell-mode-map (kbd "M-.") 'haskell-mode-jump-to-def)

Then a GHCi session will automatically be started and a tags file generated if it is missing.

paldepind avatar Nov 26 '15 20:11 paldepind

I am still under the impression that one needs to have an open session in order for the on save tag generation to work.

It seems so. Take a look here: https://github.com/haskell/haskell-mode/blob/master/haskell.el#L341-L350

ghost avatar Dec 10 '15 18:12 ghost

Is there an agreement that this part of the documentation is in the wrong section? If so, I can move it across to the correct part of the docs.

apuchitnis avatar Jan 16 '16 17:01 apuchitnis