all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Jes Bodi Klinke" <jes@bodi-klinke.dk>
To: emacs-devel@gnu.org
Subject: [PATCH 1/1] compile.el bug in recognizing -o switches among output
Date: Wed, 27 Oct 2010 14:11:06 -0700 (PDT)	[thread overview]
Message-ID: <5e0d0f4adb8ef5510aeacb9bcbe9a1a7.squirrel@xspect.dk> (raw)

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	other threads:[~2010-10-27 21:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-27 21:11 Jes Bodi Klinke [this message]
2010-10-27 21:37 ` [PATCH 1/1] compile.el bug in recognizing -o switches among output 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5e0d0f4adb8ef5510aeacb9bcbe9a1a7.squirrel@xspect.dk \
    --to=jes@bodi-klinke.dk \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.