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

Emacs 24 jump to compilation errors #67

Closed
jabolopes opened this issue Jun 23, 2012 · 6 comments
Closed

Emacs 24 jump to compilation errors #67

jabolopes opened this issue Jun 23, 2012 · 6 comments

Comments

@jabolopes
Copy link

Hello,

I have been using haskell-mode with emacs 23.* for quite some time. Great work!
Recently, I have upgraded emacs to version 24.1.1 and compilation error jumps seem to have stopped working.

For example, you're working on a haskell file, you do C-c C-l to load that file, and compilation errors (if any) will appear in the compilation buffer.
In emacs 23.*, you could hit RET on those compilation errors to jump to the appropriate file location.
This does not seem to work anymore.

If you need any more information, please let me know!

Cheers,
José

@dop
Copy link
Contributor

dop commented Jul 21, 2012

I don't know why but removing some elements in one of regexps of inferior-haskell-error-regexp-alist (inf-haskell.el) fixes hyperlinks. I've changed this

;; Format of error messages used by GHCi.
("^\\(.+?\\):\\([0-9]+\\):\\(\\([0-9]+\\):\\)?\\( \\|\n *\\)\\(Warning\\)?"
 1 2 4 ,@(if (fboundp 'compilation-fake-loc)
         '((6) nil (5 '(face nil font-lock-multiline t)))))

to this

("^\\(.+?\\):\\([0-9]+\\):\\(\\([0-9]+\\):\\)?\\( \\|\n *\\)\\(Warning\\)?"
 1 2 4 ,@(if (fboundp 'compilation-fake-loc)
         '((6) nil)))

Actually I've added hook, so that I don't have to change inf-haskell.el:

(add-hook 'inferior-haskell-mode-hook
      (lambda ()
        (setq compilation-first-column 1)
        (setq compilation-error-regexp-alist
          (cons `("^\\(.+?\\):\\([0-9]+\\):\\(\\([0-9]+\\):\\)?\\( \\|\n *\\)\\(Warning\\)?"
              1 2 4 ,@(if (fboundp 'compilation-fake-loc)
                      '((6) nil)))
            (cdr (cdr inferior-haskell-error-regexp-alist))))))

This removes first element which is regexp for Hugs errors.

@jabolopes
Copy link
Author

Thanks dop, that seem to have worked!

@manzyuk
Copy link

manzyuk commented Aug 4, 2012

Unlike Emacs 23, in which fontification of compilation error is handled by font-lock.el, in Emacs 24, it is performed by compile.el itself, in a rather ad hoc fashion. In particular, it doesn't handle the faces specified by property lists of the form (face FACE PROP1 VAL1 PROP2 VAL2 ...). I fixed this by patching compile.el.

However, even with proper fontification, visiting error messages and source code locations with C-x `` is inconsistent. For example, if I first start an inferior Haskell process with M-x run-haskelland then load my file into it by pressingC-c C-lfrom the file's buffer, pressingC-x brings me to the location of the first error (if there are any). However, if no Haskell process is running and I press `C-c C-l`, then even if there are any compilation errors, pressing `C-x merely displays a message "No more errors yet". Also, error navigation stops working once the file is reloaded from the inferior Haskell buffer by entering :r. Loading the file with C-c C-l fixes the problem, but it is still annoying.

I suspect that the problem is again in the new compile.el, so maybe it's better to report it to the bug-gnu-emacs list.

@jabolopes
Copy link
Author

I am not sure if manzyuk fixed this problem but when jumping to an error it does not always jump to the appropriate line.
SOMETIMES it jumps a few lines ahead.

@manzyuk
Copy link

manzyuk commented Aug 17, 2012

I've filed a bug report to bug-gnu-emacs: http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-08/msg00111.html.

@manzyuk
Copy link

manzyuk commented Aug 17, 2012

It turns out that the inconsistent error navigation I'm talking about above is not particular to Emacs 24, it is also present in Emacs 23. In fact, jumping to errors seems to work only when the file is loaded into the inferior Haskell process with C-c C-l. I've tried to debug this problem and have chased it down to the function compilation-forget-errors, which resets the variables compilation-current-error and compilation-messages-start. This function is called from the function inferior-haskell-load-file bound to C-c C-l. To confirm my guess, evaluating M-: (compilation-forget-errors) before manually loading or reloading a file with :l resp. :r helps.

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

4 participants