all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH 1/1] compile.el bug in recognizing -o switches among output
@ 2010-10-27 21:11 Jes Bodi Klinke
  2010-10-27 21:37 ` Jes Bodi Klinke
  0 siblings, 1 reply; 5+ messages in thread
From: Jes Bodi Klinke @ 2010-10-27 21:11 UTC (permalink / raw
  To: emacs-devel

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))





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-10-29 17:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-27 21:11 [PATCH 1/1] compile.el bug in recognizing -o switches among output Jes Bodi Klinke
2010-10-27 21:37 ` Jes Bodi Klinke
2010-10-28  1:13   ` [PATCH 1/1] compile.el bug in recognizing -o switches among Stefan Monnier
2010-10-28 19:43     ` Jes Bodi Klinke
2010-10-29 17:32       ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.