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

compilation-mode in emacs no-longer creates links to files on errors/warnings #5430

Closed
wraithm opened this issue Nov 12, 2020 · 4 comments · Fixed by #5523
Closed

compilation-mode in emacs no-longer creates links to files on errors/warnings #5430

wraithm opened this issue Nov 12, 2020 · 4 comments · Fixed by #5523

Comments

@wraithm
Copy link
Contributor

wraithm commented Nov 12, 2020

Stack version

$ stack --version
Version 2.5.1, Git revision d6ab861544918185236cf826cb2028abb266d6d5 x86_64 hpack-0.33.0

Method of installation

  • Official binary, downloaded from stackage.org or fpcomplete's package repository

Problem

Previous versions of stack printed errors in such a way that compilation-mode in emacs would detect the error and you could execute M-x first-error or similar function to go to the first error, and you can traverse the errors with M-x next-error and such. I think I actually also had to set --no-interleaved-output to get this to work well too in the previous version of stack I was on.

The new version of stack that I'm using breaks this. I think it's simply that the file paths are indented a bit. Emacs (and vim for quickfix afaict) use filepaths on newlines for detecting these errors. This is very frustrating that first-error, next-error, etc are broken.

Is it possible to use compilation-mode with stack in a simple way and get output such that emacs detects the errors?

@wraithm
Copy link
Contributor Author

wraithm commented Apr 12, 2021

@snoyberg @mattaudesse @chrisdone Any thoughts here?

@mattaudesse
Copy link
Member

Sorry @wraithm - I don't use this feature or know much about it.

@wraithm
Copy link
Contributor Author

wraithm commented Apr 13, 2021

I think it's as simple as removing the indentation in the error output:

          indent = dropWhileEnd isSpace . unlines . fmap (\line -> "  " ++ line) . lines
          doubleIndent = indent . indent

https://github.com/commercialhaskell/stack/blob/master/src/Stack/Types/Build.hs#L216-L217

The file-name where the error occurs has to be at the beginning of the line for emacs or vim to detect it as an error.

This is a pretty serious usability bug, in my humble opinion. I've honestly been a lot slower at fixing code because of this! I imagine that there are some people silently suffering that vim quickfix and emacs compilation-mode aren't working properly.

@wraithm
Copy link
Contributor Author

wraithm commented Apr 13, 2021

Okay, I built stack removing the indentation in Stack.Types.Build, and with --no-interleaved-output, compilation-mode started detecting errors again.

This issue is specific to having multiple packages in the same stack project. In a single package project, there is no extra indentation put in front of errors, and emacs/vim will detect the errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants