Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

compilation mode: wrong default error regexp blocking workflow

41 views
Skip to first unread message

LanX

unread,
Dec 14, 2014, 10:14:41 AM12/14/14
to
Hi

I have to minor problems which become pretty annoying in combination.


1. There is a default error-regex for some languages like perl and python which I can't alter or delete.

Any sequence with colons 'NAME:NUMBER:' will not only be matched as errorline, but NAME grep anything from line's start, including hashes and whitespace(!)

just compile the following line in perl or python mode, and you'll see that '# file' is considered a filename.

print "# file:15:"

I already checked compilation-error-regexp-alist and compilation-error-regexp-alist-alist but my perl settings do not include such a regex and I don't even have any setting for python.

This seems to be hardcoded somewhere.

2. Unfortunately I can't ignore those false matches cause activating compilation-auto-jump-to-first-error will automatically try to open this unexisting file and hang in the dialog, even pop up a file browser under X.

I couldn't find any option to disable next-error from trying this.

Now my questions:

1. How can I disable or change this default error-regex?
2. How can I tell next-error not to open unexisting files?

emacs -version: GNU Emacs 23.3.1

Cheers
LanX

PS: Crossposted similar stuff on stackoverflow without success so far:

see http://stackoverflow.com/questions/27463431/emacs-compilation-mode-marking-wrong-lines-as-errors

LanX

unread,
Dec 22, 2014, 10:42:46 PM12/22/14
to
OK

I digged into the sources of compilation mode but I wasn't able to identify the origin of this greedy default regexp.

But I found a workaround!

One has to define an own regexp which matches the same lines before the default regexp can do and has to correct the matching groups to avoid strange characters.

This is a proof of concept

(add-to-list 'compilation-error-regexp-alist-alist '(perl "^.*?\\([a-zA-Z/][^ \n#]+\\):\\([0-9]+\\):" 1 2))

Now only paths starting with a character or a slash and w/o whitespace or # in between are matched. Any other leading characters are ignored.

Of course you'll still need to append the old regexp for typical Perl error messages, I left this out for readability.

And you'll have to do it for each programming mode...

HTH
LanX
0 new messages