emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/1] compile.el bug in recognizing -o switches among output


From: Jes Bodi Klinke
Subject: [PATCH 1/1] compile.el bug in recognizing -o switches among output
Date: Wed, 27 Oct 2010 14:11:06 -0700 (PDT)
User-agent: SquirrelMail/1.4.15

Hello emacs developers

I have long been an satisfied user of Emacs for coding, this is my first
attempt at modifying the code of Emacs itself, so please bear with me.

I have noticed that the highlighting of -o switches in the *compilation*
buffer (or rather the filename following any -o switch) does not properly
handle some cases of extended switches.  For example if it encounters
"--omega" in the output, it will highligt "mega" as a file name.  (If
there had been just a single dash, like "-omega", then it would be correct
to highligt "mega".)

I have located the following regex inside compile.el:
" --?o\\(?:utfile\\|utput\\)?[= ]?\\(\\S +\\)"

It seems to me that this was thought to handle three cases:
 -o optionally followed by space or equal sign before filename
 --outfile followed by space or equal sign before filename
 --output followed by space or equal sign before filename

However, the regex also matches cases such as:
 --o followed by any other characters
       "--omega" will highligt "mega"
 --output followed by any other characters (without space or equal)
       "--output-html-file" will highligt "-html-file"

I do not think the two examples above should result in any highlighting,
in fact i propose to limit the regex to the three initial cases only. 
Please correct me if I have failed to consider other cases.

I have attached a patch which changes the regex into:
" -\\(o[= ]?\\|-\\(?:outfile\\|output\\)[= ]\\)\\(\\S +\\)"

I have separated the regex into two cases, single dash followed by o and
optional space or equal sign, or the other case of double dash followed by
any of two long switch names and the mandatory space or equal sign.

I do not (yet) subscribe to the emacs-devel list, so please cc me on any
reply.

Regards
Jes Bodi Klinke

=== modified file 'lisp/progmodes/compile.el'
*** lisp/progmodes/compile.el   2010-09-24 03:06:33 +0000
--- lisp/progmodes/compile.el   2010-10-27 20:44:03 +0000
*** 543,549 ****
       ;; Command output lines.  Recognize `make[n]:' lines too.
       ("^\\([[:alnum:]_/.+-]+\\)\\(\\[\\([0-9]+\\)\\]\\)?[ \t]*:"
        (1 font-lock-function-name-face) (3 compilation-line-face nil t))
!      (" --?o\\(?:utfile\\|utput\\)?[= ]?\\(\\S +\\)" . 1)
       ("^Compilation \\(finished\\).*"
        (0 '(face nil message nil help-echo nil mouse-face nil) t)
        (1 compilation-info-face))
--- 543,549 ----
       ;; Command output lines.  Recognize `make[n]:' lines too.
       ("^\\([[:alnum:]_/.+-]+\\)\\(\\[\\([0-9]+\\)\\]\\)?[ \t]*:"
        (1 font-lock-function-name-face) (3 compilation-line-face nil t))
!      (" -\\(o[= ]?\\|-\\(?:outfile\\|output\\)[= ]\\)\\(\\S +\\)" . 1)
       ("^Compilation \\(finished\\).*"
        (0 '(face nil message nil help-echo nil mouse-face nil) t)
        (1 compilation-info-face))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]