GNU bug report logs - #18405
24.3.93; bat-mode.el

Previous Next

Package: emacs;

Reported by: Achim Gratz <Stromeko <at> nexgo.de>

Date: Thu, 4 Sep 2014 18:46:02 UTC

Severity: minor

Found in version 24.3.93

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18405 in the body.
You can then email your comments to 18405 AT debbugs.gnu.org in the normal way.

the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2014年9月04日 18:46:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Achim Gratz <Stromeko <at> nexgo.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (2014年9月04日 18:46:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Achim Gratz <Stromeko <at> nexgo.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.93; bat-mode.el
Date: 2014年9月04日 20:44:50 +0200
In GNU Emacs 24.3.93.1 (i686-pc-linux-gnu, GTK+ Version 3.12.2)
 of 2014年08月24日 on Rainer.invalid
Windowing system distributor `The X.Org Foundation', version 11.0.11403901
System Description:	openSUSE 13.1 (Bottle) (i586)
The fontlock pattern for environment variables ins bat-mode.el is
 ("%\\(\\w+\\)%?"
 (1 font-lock-variable-name-face))
 ("!\\(\\w+\\)!?" ; delayed-expansion !variable!
 (1 font-lock-variable-name-face))
For CMD.EXE at least from Windows 7 onward (I've also tested with the
cmd.exe that comes with Wine), the name of an environment variable can
actually be any character including shell special characters (which
you'd then have to quote separately). While it's possible to define a
variable that has a "%" character in its name, it can not be used it in
cmd itself since it never gets expanded, so the easiest replacement
pattern would be
 ("%\\([^%]+\\)%?"
 (1 font-lock-variable-name-face))
 ("!\\([^!%]+\\)!?" ; delayed-expansion !variable!
 (1 font-lock-variable-name-face))
I've noticed this discrepancy when using variables with underscores in
their name, which only fontified the part up to the first underscore
correctly.
Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
Factory and User Sound Singles for Waldorf Q+, Q and microQ:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2014年9月04日 20:40:02 GMT) Full text and rfc822 format available.

Message #8 received at 18405 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Achim Gratz <Stromeko <at> nexgo.de>
Cc: 18405 <at> debbugs.gnu.org
Subject: Re: bug#18405: 24.3.93; bat-mode.el
Date: 2014年9月04日 16:39:25 -0400
> ("%\\([^%]+\\)%?"
> (1 font-lock-variable-name-face))
> ("!\\([^!%]+\\)!?" ; delayed-expansion !variable!
> (1 font-lock-variable-name-face))
I know nothing of cmd.exe's syntax and the general thrust of the change
sounds good, but: the above matches "%foo\nbar", which is probably not
right. When can variable refs be of the form %name or !name
(i.e. without the terminating % or !)?
 Stefan

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2014年9月04日 20:52:02 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Achim Gratz <Stromeko <at> nexgo.de>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#18405: 24.3.93; bat-mode.el
Date: 2014年9月04日 22:51:04 +0200
Stefan Monnier writes:
> I know nothing of cmd.exe's syntax and the general thrust of the change
> sounds good, but: the above matches "%foo\nbar", which is probably not
> right. When can variable refs be of the form %name or !name
> (i.e. without the terminating % or !)?
I haven't tried embedded newlines (or rather \r\n as it were) in
variable names. Just like the embedded '%' character they probably are
possible somehow, but mostly useless. So it would make sense to exclude
them (embedded whitespace is also somewhat iffy, but it tends to work
surprisingly well within CMD itself). The syntax for variable names in
CMD does not seem to be specified formally, at least I haven't found
anything.
Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
Wavetables for the Terratec KOMPLEXER:
http://Synth.Stromeko.net/Downloads.html#KomplexerWaves

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2014年9月05日 07:03:02 GMT) Full text and rfc822 format available.

Message #14 received at 18405 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Stromeko <at> nexgo.de, 18405 <at> debbugs.gnu.org
Subject: Re: bug#18405: 24.3.93; bat-mode.el
Date: 2014年9月05日 10:03:00 +0300
> Date: 2014年9月04日 16:39:25 -0400
> Cc: 18405 <at> debbugs.gnu.org
> 
> When can variable refs be of the form %name or !name (i.e. without
> the terminating % or !)?
In the FOR loops. The simplest example is (words in caps are
keywords, but don't need to appear in caps):
 FOR %f in (*.c) DO something %f

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2014年9月05日 07:20:01 GMT) Full text and rfc822 format available.

Message #17 received at 18405 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: monnier <at> iro.umontreal.ca
Cc: Stromeko <at> nexgo.de, 18405 <at> debbugs.gnu.org
Subject: Re: bug#18405: 24.3.93; bat-mode.el
Date: 2014年9月05日 10:19:21 +0300
> Date: 2014年9月05日 10:03:00 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: Stromeko <at> nexgo.de, 18405 <at> debbugs.gnu.org
> 
> > When can variable refs be of the form %name or !name (i.e. without
> > the terminating % or !)?
> 
> In the FOR loops.
And, of course, in references to batch file arguments, like %1, %2,
etc.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2014年9月05日 18:41:01 GMT) Full text and rfc822 format available.

Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Achim Gratz <Stromeko <at> nexgo.de>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#18405: 24.3.93; bat-mode.el
Date: 2014年9月05日 20:39:48 +0200
Stefan Monnier writes:
> When can variable refs be of the form %name or !name
> (i.e. without the terminating % or !)?
These are so-called parameter variables; more specifically loop
variables and arguments, these must be single alpha character or
numerical. There are also local variables when you enable extended
syntax, but they localize the environment variables and thus keep their
syntax.
I think that's the best syntax description (and most concise) I've found
so far:
http://ss64.com/nt/syntax-variables.html
http://ss64.com/nt/syntax-args.html
Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
SD adaptations for Waldorf Q V3.00R3 and Q+ V3.54R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2014年9月07日 03:25:02 GMT) Full text and rfc822 format available.

Message #23 received at 18405 <at> debbugs.gnu.org (full text, mbox):

From: Daniel Colascione <dancol <at> dancol.org>
To: Achim Gratz <Stromeko <at> nexgo.de>, 18405 <at> debbugs.gnu.org
Subject: Re: bug#18405: 24.3.93; bat-mode.el
Date: 2014年9月06日 20:24:46 -0700
[Message part 1 (text/plain, inline)]
On 09/05/2014 11:39 AM, Achim Gratz wrote:
> Stefan Monnier writes:
>> When can variable refs be of the form %name or !name
>> (i.e. without the terminating % or !)?
> 
> These are so-called parameter variables; more specifically loop
> variables and arguments, these must be single alpha character or
> numerical. There are also local variables when you enable extended
> syntax, but they localize the environment variables and thus keep their
> syntax.
> 
> I think that's the best syntax description (and most concise) I've found
> so far:
> 
Mind just importing http://www.emacswiki.org/emacs/ntcmd.el into trunk?
It handles a bunch of nasty cmd.exe syntactic corner cases.
[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2014年9月07日 15:19:02 GMT) Full text and rfc822 format available.

Message #26 received at 18405 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Daniel Colascione <dancol <at> dancol.org>
Cc: Stromeko <at> nexgo.de, 18405 <at> debbugs.gnu.org
Subject: Re: bug#18405: 24.3.93; bat-mode.el
Date: 2014年9月07日 18:17:59 +0300
> Date: 2014年9月06日 20:24:46 -0700
> From: Daniel Colascione <dancol <at> dancol.org>
> 
> Mind just importing http://www.emacswiki.org/emacs/ntcmd.el into trunk?
Would you mind some comments about it?

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2014年9月08日 01:05:02 GMT) Full text and rfc822 format available.

Message #29 received at 18405 <at> debbugs.gnu.org (full text, mbox):

From: Daniel Colascione <dancol <at> dancol.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Stromeko <at> nexgo.de, 18405 <at> debbugs.gnu.org
Subject: Re: bug#18405: 24.3.93; bat-mode.el
Date: 2014年9月07日 18:04:15 -0700
[Message part 1 (text/plain, inline)]
On 09/07/2014 08:17 AM, Eli Zaretskii wrote:
>> Date: 2014年9月06日 20:24:46 -0700
>> From: Daniel Colascione <dancol <at> dancol.org>
>>
>> Mind just importing http://www.emacswiki.org/emacs/ntcmd.el into trunk?
> 
> Would you mind some comments about it?
Sorry --- I should have been more specific. I wrote ntcmd a while ago
because I was frustrated with existing modes for working with batch
files. ntcmd uses a parser to deal with cmd.exe's very weird syntax;
it's important to do that because cmd's syntax is highly irregular and
using regular font-lock patterns to match it is doomed --- in
particular, matches involving loop variables are complicated. (See
ntcmd-forward-generic-cmd and ntcmd-forward-for-cmd for some interesting
special cases and fossilized cmd.exe bugs.)
[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2014年9月08日 02:43:02 GMT) Full text and rfc822 format available.

Message #32 received at 18405 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Daniel Colascione <dancol <at> dancol.org>
Cc: Stromeko <at> nexgo.de, 18405 <at> debbugs.gnu.org
Subject: Re: bug#18405: 24.3.93; bat-mode.el
Date: 2014年9月08日 05:42:26 +0300
> Date: 2014年9月07日 18:04:15 -0700
> From: Daniel Colascione <dancol <at> dancol.org>
> CC: Stromeko <at> nexgo.de, 18405 <at> debbugs.gnu.org
> 
> On 09/07/2014 08:17 AM, Eli Zaretskii wrote:
> >> Date: 2014年9月06日 20:24:46 -0700
> >> From: Daniel Colascione <dancol <at> dancol.org>
> >>
> >> Mind just importing http://www.emacswiki.org/emacs/ntcmd.el into trunk?
> > 
> > Would you mind some comments about it?
> 
> Sorry --- I should have been more specific. I wrote ntcmd a while ago
> because I was frustrated with existing modes for working with batch
> files. ntcmd uses a parser to deal with cmd.exe's very weird syntax;
> it's important to do that because cmd's syntax is highly irregular and
> using regular font-lock patterns to match it is doomed --- in
> particular, matches involving loop variables are complicated. (See
> ntcmd-forward-generic-cmd and ntcmd-forward-for-cmd for some interesting
> special cases and fossilized cmd.exe bugs.)
I've read the code, so yes, I've seen that.
My point was that I saw a few of its aspects that might benefit from
improvements, and if we are going to add that package to Emacs, I'd
like to see those happen.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2014年9月08日 02:49:02 GMT) Full text and rfc822 format available.

Message #35 received at 18405 <at> debbugs.gnu.org (full text, mbox):

From: Daniel Colascione <dancol <at> dancol.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Stromeko <at> nexgo.de, 18405 <at> debbugs.gnu.org
Subject: Re: bug#18405: 24.3.93; bat-mode.el
Date: 2014年9月07日 19:47:52 -0700
[Message part 1 (text/plain, inline)]
On 09/07/2014 07:42 PM, Eli Zaretskii wrote:
>> Date: 2014年9月07日 18:04:15 -0700
>> From: Daniel Colascione <dancol <at> dancol.org>
>> CC: Stromeko <at> nexgo.de, 18405 <at> debbugs.gnu.org
>>
>> On 09/07/2014 08:17 AM, Eli Zaretskii wrote:
>>>> Date: 2014年9月06日 20:24:46 -0700
>>>> From: Daniel Colascione <dancol <at> dancol.org>
>>>>
>>>> Mind just importing http://www.emacswiki.org/emacs/ntcmd.el into trunk?
>>>
>>> Would you mind some comments about it?
>>
>> Sorry --- I should have been more specific. I wrote ntcmd a while ago
>> because I was frustrated with existing modes for working with batch
>> files. ntcmd uses a parser to deal with cmd.exe's very weird syntax;
>> it's important to do that because cmd's syntax is highly irregular and
>> using regular font-lock patterns to match it is doomed --- in
>> particular, matches involving loop variables are complicated. (See
>> ntcmd-forward-generic-cmd and ntcmd-forward-for-cmd for some interesting
>> special cases and fossilized cmd.exe bugs.)
> 
> I've read the code, so yes, I've seen that.
> 
> My point was that I saw a few of its aspects that might benefit from
> improvements, and if we are going to add that package to Emacs, I'd
> like to see those happen.
Like what? In 2011, you just mentioned that we should be using or
enhancing bat-generic-mode, which, as I explained, is insufficient.
[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2014年9月08日 07:33:01 GMT) Full text and rfc822 format available.

Message #38 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Achim Gratz <Stromeko <at> nexgo.de>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#18405: 24.3.93; bat-mode.el
Date: 2014年9月08日 09:32:12 +0200
Daniel Colascione writes:
> Mind just importing http://www.emacswiki.org/emacs/ntcmd.el into trunk?
> It handles a bunch of nasty cmd.exe syntactic corner cases.
I've briefly looked at it and this seems like a better approach in the
long run. However, I'd still like to have that particular bug in
bat-mode fixed in the next release, while ntcmd.el looks like something
that would have to be done in trunk. So I suggest that this should be
separate bug report or split it off from the original one if possible.
Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
Wavetables for the Terratec KOMPLEXER:
http://Synth.Stromeko.net/Downloads.html#KomplexerWaves

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2014年9月09日 13:06:02 GMT) Full text and rfc822 format available.

Message #41 received at 18405 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Daniel Colascione <dancol <at> dancol.org>
Cc: Stromeko <at> nexgo.de, 18405 <at> debbugs.gnu.org
Subject: Re: bug#18405: 24.3.93; bat-mode.el
Date: 2014年9月09日 16:05:02 +0300
> Date: 2014年9月07日 19:47:52 -0700
> From: Daniel Colascione <dancol <at> dancol.org>
> CC: Stromeko <at> nexgo.de, 18405 <at> debbugs.gnu.org
> 
> > My point was that I saw a few of its aspects that might benefit from
> > improvements, and if we are going to add that package to Emacs, I'd
> > like to see those happen.
> 
> Like what?
See below.
> In 2011, you just mentioned that we should be using or enhancing
> bat-generic-mode
My goodness, I hope you don't expect me to forever hold my peace about
this just because I happened to write something 3 years ago.
Here are my comments:
 . There are some strange decisions about faces, for example:
 . the switch letters in Unix-style -x switches are highlighted in
 font-lock-type-face
 . redirection characters are highlighted in font-lock-constant-face
 . opening parenthesis in "echo" commands are given
 font-lock-warning-face
 . variable definitions in for loops (the 'x' part in "for %%x") are
 highlighted with different face from their references in the "do"
 part of the loop
 . Text after "echo" (up to redirection character, if any) is always a
 simple string, except if it's "on" or "off", but is not highlighted
 as a string, which then causes some random highlighting of the
 parts of the string that just happen to match other possible
 syntaxes
 . Something like this confuses fontification of the redirection
 character, probably because of the parentheses (the opening paren
 is given the font-lock-warning-face):
 echo int main() >junk.c
 . In general, I don't understand what was intended to be the handling
 of parentheses, they seem to be either not highlighted at all or
 given the warning face.
 . A command of this form:
 if exist somefile dosomethingwith somefile
 has "dosomethingwith" sometimes in the font-lock-builtin-face and
 sometimes with no face at all, not sure why. Looks like when
 'somefile' includes slashes, the command is not fontified.
 . The value to which a variable is set in "set foo-bar" doesn't have
 any face, which causes some funny fontifications if that value
 happens to match unrelated syntaxes, as in "set foo=-bar=baz"
 . The equals sign in "if foo == bar" is sometimes given the
 font-lock-keyword-face and sometimes no face at all. Here's one
 example of the latter:
 if not (%svgsupport%) == (Y) goto :svgDone
 . This line has its fontifications after "(%distfiles%)" screwed:
 for %%d in (%distfiles%) do if not exist %%d set fileNotFound=%%d
 In particular, built-in commands are not fontified as such.
 . Some built-in commands are missing from ntcmd-shell-builtins:
 assoc, call, mklink
 . "dir" and "rem" appear twice in the list in ntcmd-shell-builtins
 . The support of "set /a" command is incomplete, e.g. try
 set /a y+=140
Thanks.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2014年9月09日 13:46:02 GMT) Full text and rfc822 format available.

Message #44 received at 18405 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Stromeko <at> nexgo.de, Daniel Colascione <dancol <at> dancol.org>,
 18405 <at> debbugs.gnu.org
Subject: Re: bug#18405: 24.3.93; bat-mode.el
Date: 2014年9月09日 09:45:50 -0400
> . variable definitions in for loops (the 'x' part in "for %%x") are
> highlighted with different face from their references in the "do"
> part of the loop
FWIW in sh-mode, for something like "for f in echo $f", we also
highlight the two occurrences of "f" differently. I'm not saying it's
a feature, but it's definitely a common behavior to highlight the
"introduction" occurrence differently from the "reference" occurrences.
 Stefan

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2014年9月09日 14:40:01 GMT) Full text and rfc822 format available.

Message #47 received at 18405 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: Stromeko <at> nexgo.de, dancol <at> dancol.org, 18405 <at> debbugs.gnu.org
Subject: Re: bug#18405: 24.3.93; bat-mode.el
Date: 2014年9月09日 17:40:00 +0300
> From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
> Cc: Daniel Colascione <dancol <at> dancol.org>, Stromeko <at> nexgo.de,
> 18405 <at> debbugs.gnu.org
> Date: 2014年9月09日 09:45:50 -0400
> 
> > . variable definitions in for loops (the 'x' part in "for %%x") are
> > highlighted with different face from their references in the "do"
> > part of the loop
> 
> FWIW in sh-mode, for something like "for f in echo $f", we also
> highlight the two occurrences of "f" differently. I'm not saying it's
> a feature, but it's definitely a common behavior to highlight the
> "introduction" occurrence differently from the "reference" occurrences.
Except that in the ntcmd case, that's not the intended behavior,
AFAICT.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2017年9月22日 13:44:02 GMT) Full text and rfc822 format available.

Message #50 received at 18405 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Achim Gratz <Stromeko <at> nexgo.de>, Anders Lindgren <andlind <at> gmail.com>
Cc: 28311 <at> debbugs.gnu.org, 18405 <at> debbugs.gnu.org
Subject: Re: bug#28311: 25.2; Improve syntax highlighting in bat-mode
Date: 2017年9月22日 16:43:20 +0300
> From: Achim Gratz <Stromeko <at> nexgo.de>
> Date: 2017年8月31日 21:27:43 +0200
> 
> Anders Lindgren writes:
> > I've noticed some problems with syntax highlighting in bat-mode.
> 
> Consider joining this report with bug#18405.
I've picked the lower-hanging fruit and fixed some of the problems
reported in these two bug reports on the emacs-26 branch.
Thanks.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2017年9月22日 17:02:02 GMT) Full text and rfc822 format available.

Message #53 received at 18405 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 28311 <at> debbugs.gnu.org, Achim Gratz <Stromeko <at> nexgo.de>,
 Anders Lindgren <andlind <at> gmail.com>, 18405 <at> debbugs.gnu.org
Subject: Re: bug#28311: 25.2; Improve syntax highlighting in bat-mode
Date: 2017年9月22日 13:01:03 -0400
Running 5 tests (2017年09月22日 09:57:54-0700)
 passed 1/5 bat-test-fill-paragraph-comment
hfy batch mode ( *temp*-973592:bat-mode)
Test bat-test-fontification-iter-var-1 backtrace:
 signal(ert-test-failed (((should (equal (bat-test-fontify "echo %%a\
 ert-fail(((should (equal (bat-test-fontify "echo %%a\necho %%~dp1\ne
 (if (unwind-protect (setq value-17 (apply fn-15 args-16)) (setq form
 (let (form-description-19) (if (unwind-protect (setq value-17 (apply
 (let ((value-17 'ert-form-evaluation-aborted-18)) (let (form-descrip
 (let* ((fn-15 (function equal)) (args-16 (condition-case err (let ((
 (closure (t) nil (let* ((fn-15 (function equal)) (args-16 (condition
 ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
 ert-run-test(#s(ert-test :name bat-test-fontification-iter-var-1 :do
 ert-run-or-rerun-test(#s(ert--stats :selector t :tests [#s(ert-test 
 ert-run-tests(t #f(compiled-function (event-type &rest event-args) #
 ert-run-tests-batch(nil)
 ert-run-tests-batch-and-exit(nil)
 eval((ert-run-tests-batch-and-exit nil))
 command-line-1(("-L" ":." "-l" "ert" "-l" "lisp/progmodes/bat-mode-t
 command-line()
 normal-top-level()
Test bat-test-fontification-iter-var-1 condition:
 (ert-test-failed
 ((should
 (equal
	(bat-test-fontify "echo %%a
echo %%~dp1
echo %%~$PATH:I")
	"<span class=\"builtin\">echo</span> %%<span class=\"variable-name\">a</span>
<span class=\"builtin\">echo</span> %%~dp<span class=\"variable-name\">1</span>
<span class=\"builtin\">echo</span> %%~$<span class=\"variable-name\">PATH</span>:<span class=\"variable-name\">I</span>"))
 :form
 (equal
 #("<span class=\"builtin\">echo</span> %%<span class=\"variable-name\">a</span>
<span class=\"builtin\">echo</span> %%<span class=\"variable-name\">~dp1</span>
<span class=\"builtin\">echo</span> %%<span class=\"variable-name\">~$PATH:I</span>" 22 26
(face font-lock-builtin-face)
64 65
(face font-lock-variable-name-face)
95 99
(face font-lock-builtin-face)
137 141
(face font-lock-variable-name-face)
171 175
(face font-lock-builtin-face)
213 221
(face font-lock-variable-name-face))
 "<span class=\"builtin\">echo</span> %%<span class=\"variable-name\">a</span>
<span class=\"builtin\">echo</span> %%~dp<span class=\"variable-name\">1</span>
<span class=\"builtin\">echo</span> %%~$<span class=\"variable-name\">PATH</span>:<span class=\"variable-name\">I</span>")
 :value nil :explanation
 (arrays-of-different-length 228 263
				 #("<span class=\"builtin\">echo</span> %%<span class=\"variable-name\">a</span>
<span class=\"builtin\">echo</span> %%<span class=\"variable-name\">~dp1</span>
<span class=\"builtin\">echo</span> %%<span class=\"variable-name\">~$PATH:I</span>" 22 26
(face font-lock-builtin-face)
64 65
(face font-lock-variable-name-face)
95 99
(face font-lock-builtin-face)
137 141
(face font-lock-variable-name-face)
171 175
(face font-lock-builtin-face)
213 221
(face font-lock-variable-name-face))
				 "<span class=\"builtin\">echo</span> %%<span class=\"variable-name\">a</span>
<span class=\"builtin\">echo</span> %%~dp<span class=\"variable-name\">1</span>
<span class=\"builtin\">echo</span> %%~$<span class=\"variable-name\">PATH</span>:<span class=\"variable-name\">I</span>" first-mismatch-at 109)))
 FAILED 2/5 bat-test-fontification-iter-var-1
hfy batch mode ( *temp*-454955:bat-mode)
 passed 3/5 bat-test-fontification-var-decl
hfy batch mode ( *temp*-493544:bat-mode)
 passed 4/5 bat-test-fontification-var-delayed-exp
hfy batch mode ( *temp*-832943:bat-mode)
 passed 5/5 bat-test-fontification-var-exp
Ran 5 tests, 4 results as expected, 1 unexpected (2017年09月22日 09:57:54-0700)
1 unexpected results:
 FAILED bat-test-fontification-iter-var-1

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2017年9月22日 17:43:02 GMT) Full text and rfc822 format available.

Message #56 received at 18405 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 28311-done <at> debbugs.gnu.org, Stromeko <at> nexgo.de, andlind <at> gmail.com,
 18405 <at> debbugs.gnu.org
Subject: Re: bug#28311: 25.2; Improve syntax highlighting in bat-mode
Date: 2017年9月22日 20:42:28 +0300
> From: Glenn Morris <rgm <at> gnu.org>
> Cc: Achim Gratz <Stromeko <at> nexgo.de>, Anders Lindgren <andlind <at> gmail.com>, 28311 <at> debbugs.gnu.org, 18405 <at> debbugs.gnu.org
> Date: 2017年9月22日 13:01:03 -0400
> 
> 
> Running 5 tests (2017年09月22日 09:57:54-0700)
> passed 1/5 bat-test-fill-paragraph-comment
> hfy batch mode ( *temp*-973592:bat-mode)
> Test bat-test-fontification-iter-var-1 backtrace:
Thanks, fixed.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2017年9月22日 19:05:02 GMT) Full text and rfc822 format available.

Message #59 received at 18405 <at> debbugs.gnu.org (full text, mbox):

From: Anders Lindgren <andlind <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 28311 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 Achim Gratz <Stromeko <at> nexgo.de>, 18405 <at> debbugs.gnu.org
Subject: Re: bug#28311: 25.2; Improve syntax highlighting in bat-mode
Date: 2017年9月22日 21:04:19 +0200
[Message part 1 (text/plain, inline)]
Hi!
Unfortunately, I can't comment on the actual error found, as I wasn't
involved in the fix...
Anyway, I am positively glad that you have tests for font-lock rules.
However, using htmlfontify for this doesn't seem like the best tool for
this. 1) The output of htmlfontify may change in the future, in which case
you will need to rewrite all your tests, 2) HTML is hard to read, and 3)
The ert explainer doesn't really help you here. If example, in this case
all it tells you is that the resulting html strings have different lengths.
On other words, it may work for snippets like this, but it would not scale
well.
A couple of years ago I wrote a tool, faceup (https://github.com/
Lindydancer/faceup), specifically for testing highlighting in Emacs using
ert. It uses a simple markup language, so the result is easier to read than
when using HTML. The reference text can be used inline (like in your test)
or stored in a corresponding ".faceup" file, which makes it possible to
test files thousands of lines long. When a test fails, the ert explainer
will tell you which lines contained errors, what that lines contained, and
what they should contain, so it's much easier to find errors. I have
successfully used this is several of my font-lock packages. In addition,
I've accumulated a number of source files in various programming languages
in a regression test suite for font-lock (https://github.com/
Lindydancer/font-lock-regression-suite).
If you would like to modernise your font-lock test, I would be happy to
contribute it to Emacs (as I suggested in bug#16063).
 -- Anders
On Fri, Sep 22, 2017 at 7:01 PM, Glenn Morris <rgm <at> gnu.org> wrote:
>
> Running 5 tests (2017年09月22日 09:57:54-0700)
> passed 1/5 bat-test-fill-paragraph-comment
> hfy batch mode ( *temp*-973592:bat-mode)
> Test bat-test-fontification-iter-var-1 backtrace:
> signal(ert-test-failed (((should (equal (bat-test-fontify "echo %%a\
> ert-fail(((should (equal (bat-test-fontify "echo %%a\necho %%~dp1\ne
> (if (unwind-protect (setq value-17 (apply fn-15 args-16)) (setq form
> (let (form-description-19) (if (unwind-protect (setq value-17 (apply
> (let ((value-17 'ert-form-evaluation-aborted-18)) (let (form-descrip
> (let* ((fn-15 (function equal)) (args-16 (condition-case err (let ((
> (closure (t) nil (let* ((fn-15 (function equal)) (args-16 (condition
> ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
> ert-run-test(#s(ert-test :name bat-test-fontification-iter-var-1 :do
> ert-run-or-rerun-test(#s(ert--stats :selector t :tests [#s(ert-test
> ert-run-tests(t #f(compiled-function (event-type &rest event-args) #
> ert-run-tests-batch(nil)
> ert-run-tests-batch-and-exit(nil)
> eval((ert-run-tests-batch-and-exit nil))
> command-line-1(("-L" ":." "-l" "ert" "-l" "lisp/progmodes/bat-mode-t
> command-line()
> normal-top-level()
> Test bat-test-fontification-iter-var-1 condition:
> (ert-test-failed
> ((should
> (equal
> (bat-test-fontify "echo %%a
> echo %%~dp1
> echo %%~$PATH:I")
> "<span class=\"builtin\">echo</span> %%<span
> class=\"variable-name\">a</span>
> <span class=\"builtin\">echo</span> %%~dp<span class=\"variable-name\">1</
> span>
> <span class=\"builtin\">echo</span> %%~$<span
> class=\"variable-name\">PATH</span>:<span class=\"variable-name\">I</
> span>"))
> :form
> (equal
> #("<span class=\"builtin\">echo</span> %%<span
> class=\"variable-name\">a</span>
> <span class=\"builtin\">echo</span> %%<span class=\"variable-name\">~dp1</
> span>
> <span class=\"builtin\">echo</span> %%<span class=\"variable-name\">~$PATH:I</span>"
> 22 26
> (face font-lock-builtin-face)
> 64 65
> (face font-lock-variable-name-face)
> 95 99
> (face font-lock-builtin-face)
> 137 141
> (face font-lock-variable-name-face)
> 171 175
> (face font-lock-builtin-face)
> 213 221
> (face font-lock-variable-name-face))
> "<span class=\"builtin\">echo</span> %%<span
> class=\"variable-name\">a</span>
> <span class=\"builtin\">echo</span> %%~dp<span class=\"variable-name\">1</
> span>
> <span class=\"builtin\">echo</span> %%~$<span
> class=\"variable-name\">PATH</span>:<span class=\"variable-name\">I</
> span>")
> :value nil :explanation
> (arrays-of-different-length 228 263
> #("<span class=\"builtin\">echo</span>
> %%<span class=\"variable-name\">a</span>
> <span class=\"builtin\">echo</span> %%<span class=\"variable-name\">~dp1</
> span>
> <span class=\"builtin\">echo</span> %%<span class=\"variable-name\">~$PATH:I</span>"
> 22 26
> (face font-lock-builtin-face)
> 64 65
> (face font-lock-variable-name-face)
> 95 99
> (face font-lock-builtin-face)
> 137 141
> (face font-lock-variable-name-face)
> 171 175
> (face font-lock-builtin-face)
> 213 221
> (face font-lock-variable-name-face))
> "<span class=\"builtin\">echo</span>
> %%<span class=\"variable-name\">a</span>
> <span class=\"builtin\">echo</span> %%~dp<span class=\"variable-name\">1</
> span>
> <span class=\"builtin\">echo</span> %%~$<span
> class=\"variable-name\">PATH</span>:<span class=\"variable-name\">I</span>"
> first-mismatch-at 109)))
> FAILED 2/5 bat-test-fontification-iter-var-1
> hfy batch mode ( *temp*-454955:bat-mode)
> passed 3/5 bat-test-fontification-var-decl
> hfy batch mode ( *temp*-493544:bat-mode)
> passed 4/5 bat-test-fontification-var-delayed-exp
> hfy batch mode ( *temp*-832943:bat-mode)
> passed 5/5 bat-test-fontification-var-exp
>
> Ran 5 tests, 4 results as expected, 1 unexpected (2017年09月22日 09:57:54-0700)
>
> 1 unexpected results:
> FAILED bat-test-fontification-iter-var-1
>
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2017年9月22日 19:16:02 GMT) Full text and rfc822 format available.

Message #62 received at 18405 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Anders Lindgren <andlind <at> gmail.com>
Cc: 28311 <at> debbugs.gnu.org, rgm <at> gnu.org, Stromeko <at> nexgo.de,
 18405 <at> debbugs.gnu.org
Subject: Re: bug#28311: 25.2; Improve syntax highlighting in bat-mode
Date: 2017年9月22日 22:14:56 +0300
> From: Anders Lindgren <andlind <at> gmail.com>
> Date: 2017年9月22日 21:04:19 +0200
> Cc: Eli Zaretskii <eliz <at> gnu.org>, Achim Gratz <Stromeko <at> nexgo.de>, 28311 <at> debbugs.gnu.org, 
> 	18405 <at> debbugs.gnu.org
> 
> If you would like to modernise your font-lock test, I would be happy to contribute it to Emacs (as I suggested in
> bug#16063).
Why wouldn't we want that? Please go ahead, and thanks.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2017年9月23日 12:51:02 GMT) Full text and rfc822 format available.

Message #65 received at 18405 <at> debbugs.gnu.org (full text, mbox):

From: Anders Lindgren <andlind <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 28311 <at> debbugs.gnu.org, Glenn Morris <rgm <at> gnu.org>, Stromeko <at> nexgo.de,
 18405 <at> debbugs.gnu.org
Subject: Re: bug#28311: 25.2; Improve syntax highlighting in bat-mode
Date: 2017年9月23日 14:50:27 +0200
[Message part 1 (text/plain, inline)]
>
> > If you would like to modernise your font-lock test, I would be happy to
> contribute it to Emacs (as I suggested in
> > bug#16063).
>
> Why wouldn't we want that? Please go ahead, and thanks.
>
Thanks! In which branch should I add it, master or Emacs-26?
I guess it should go into lisp/emacs-lisp, as "ert.el" is located there.
 -- Anders
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2017年9月23日 13:10:02 GMT) Full text and rfc822 format available.

Message #68 received at 18405 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Anders Lindgren <andlind <at> gmail.com>
Cc: 28311 <at> debbugs.gnu.org, rgm <at> gnu.org, Stromeko <at> nexgo.de,
 18405 <at> debbugs.gnu.org
Subject: Re: bug#28311: 25.2; Improve syntax highlighting in bat-mode
Date: 2017年9月23日 16:09:20 +0300
> From: Anders Lindgren <andlind <at> gmail.com>
> Date: 2017年9月23日 14:50:27 +0200
> Cc: Glenn Morris <rgm <at> gnu.org>, Stromeko <at> nexgo.de, 28311 <at> debbugs.gnu.org, 
> 	18405 <at> debbugs.gnu.org
> 
> Why wouldn't we want that? Please go ahead, and thanks.
> 
> Thanks! In which branch should I add it, master or Emacs-26?
How large is it? Also, is it supposed to be used outside of the ert
context?
> I guess it should go into lisp/emacs-lisp, as "ert.el" is located there.
Probably. Actually, why not make it part of ert, say, ert-faces.el?

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2017年9月23日 18:06:02 GMT) Full text and rfc822 format available.

Message #71 received at 18405 <at> debbugs.gnu.org (full text, mbox):

From: Anders Lindgren <andlind <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 28311 <at> debbugs.gnu.org, Glenn Morris <rgm <at> gnu.org>,
 Achim Gratz <Stromeko <at> nexgo.de>, 18405 <at> debbugs.gnu.org
Subject: Re: bug#28311: 25.2; Improve syntax highlighting in bat-mode
Date: 2017年9月23日 20:05:35 +0200
[Message part 1 (text/plain, inline)]
>
> > Thanks! In which branch should I add it, master or Emacs-26?
>
> How large is it? Also, is it supposed to be used outside of the ert
> context?
>
The main source file is about 45 KB, with additional 15KB of test files.
It can be used outside the ERT context, as the markup language is generic.
I can think of many applications for it, like use it as the storage format
for a word-processor like mode, where the user can apply bold, italics etc.
> I guess it should go into lisp/emacs-lisp, as "ert.el" is located there.
>
> Probably. Actually, why not make it part of ert, say, ert-faces.el?
>
As it can be used outside of ert, I would prefer the current name.
 -- Anders
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2017年9月23日 18:19:02 GMT) Full text and rfc822 format available.

Message #74 received at 18405 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Anders Lindgren <andlind <at> gmail.com>
Cc: 28311 <at> debbugs.gnu.org, rgm <at> gnu.org, Stromeko <at> nexgo.de,
 18405 <at> debbugs.gnu.org
Subject: Re: bug#28311: 25.2; Improve syntax highlighting in bat-mode
Date: 2017年9月23日 21:17:46 +0300
> From: Anders Lindgren <andlind <at> gmail.com>
> Date: 2017年9月23日 20:05:35 +0200
> Cc: Glenn Morris <rgm <at> gnu.org>, Achim Gratz <Stromeko <at> nexgo.de>, 28311 <at> debbugs.gnu.org, 
> 	18405 <at> debbugs.gnu.org
> 
> > Thanks! In which branch should I add it, master or Emacs-26?
> 
> How large is it? Also, is it supposed to be used outside of the ert
> context?
> 
> The main source file is about 45 KB, with additional 15KB of test files.
> 
> It can be used outside the ERT context, as the markup language is generic. I can think of many applications
> for it, like use it as the storage format for a word-processor like mode, where the user can apply bold, italics
> etc.
In that case, I guess master is the right place.
Thanks.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18405; Package emacs. (2022年4月24日 13:25:02 GMT) Full text and rfc822 format available.

Message #77 received at 18405 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 28311 <at> debbugs.gnu.org, rgm <at> gnu.org, Stromeko <at> nexgo.de,
 Anders Lindgren <andlind <at> gmail.com>, 18405 <at> debbugs.gnu.org
Subject: Re: bug#18405: 24.3.93; bat-mode.el
Date: 2022年4月24日 15:24:30 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:
>> The main source file is about 45 KB, with additional 15KB of test files.
>> 
>> It can be used outside the ERT context, as the markup language is generic. I can think of many applications
>> for it, like use it as the storage format for a word-processor like mode, where the user can apply bold, italics
>> etc.
>
> In that case, I guess master is the right place.
This was added to Emacs a year later, as a0e5a02125a6.
A quick skim of this bug report seems to indicate that most of the
issues described here were fixed, so I'm closing this bug report. If
there's anything more that should be done in bat-mode, then filing new
bug reports for any remaining issues would be the way forward.
-- 
(domestic pets only, the antidote for overdose, milk.)
 bloggy blog: http://lars.ingebrigtsen.no

bug closed, send any further explanations to 18405 <at> debbugs.gnu.org and Achim Gratz <Stromeko <at> nexgo.de> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (2022年4月24日 13:25:04 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (2022年5月23日 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 233 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.

AltStyle によって変換されたページ (->オリジナル) /