etags problem in bash, not in cmd.exe

Markus Hoenicka Markus.Hoenicka@uth.tmc.edu
Fri Dec 1 10:14:00 GMT 2000


Hi,

I ran into a problem with the etags.exe shipped with NTEmacs
20.7.1. I'm not sure whether it is an etags problem or a CygWin bash
problem, therefore I ask on both sides.

My setup:
I use the CygWin bash as the default shell in NTEmacs. I also use the
tdtd package to edit SGML DTDs. This uses etags to create a list of
entities, elements, notations etc. With my setup etags will run in
bash, not in cmdproxy.exe or cmd.exe.

The problem:
The regular expression provided with tdtd does not work as is (it
works on Linux, though). This is mainly a backslash-escape problem
which can be fixed easily. The tricky part of the problem is that
whitespace in the regular expression screws up things. This part of
the problem exists only if etags runs in bash, it does not show up if
etags runs in NT4 cmd.exe. I know it's a bit complex but I'd be glad
if anyone could shed some light on this.

The testcase:
The file tutorial.dtd is a simple example to show the problem:
--------------
<?xml version="1.0"?>
<!ENTITY % paracon     "#PCDATA | list"                              >
<!ELEMENT  book         (para | list)+                               >
---------------

Using simplified regexps, I try to find ENTITY and ELEMENT with etags
first in cmd.exe and then in bash with the following commands (the
full path is required to bypass CygWin etags which can't handle
--regex):

F:\home\markus\workspace\test2>d:\win32app\emacs207\bin\etags
--regex='/<!\(ELEMENT\|ENTITY\)/' --output=- tutorial.dtd
?
tutorial.dtd,32
<!ENTITY¦8,378
<!ELEMENT¦12,592

$ /cygdrive/d/win32app/emacs207/bin/etags.exe
--regex='/<!\(ELEMENT\|ENTITY\)/' --output=- tutorial.dtd
?
tutorial.dtd,32
<!ENTITY¦8,378
<!ELEMENT¦12,592

Both work ok.

Now I add one space after ENTITY. This should not change the etags output
as there is one space in the test file after ENTITY. In cmd.exe I get:
F:\home\markus\workspace\test2>d:\win32app\emacs207\bin\etags
--regex='/<!\(ELEMENT\|ENTITY \)/' --output=- tutorial.dtd
?
tutorial.dtd,33
<!ENTITY ¦8,378
<!ELEMENT¦12,592

whereas in bash I end up with:
$ /cygdrive/d/win32app/emacs207/bin/etags.exe
--regex='/<!\(ELEMENT\|ENTITY \)/' --output=- tutorial.dtd
?
tutorial.dtd,19
<?xml version=¦1,0

which is certainly wrong. Please remember that the regexp is protected from
the shell with single quotation marks so the space should not be visible to
the shell.

For the record, I currently use a slimy hack which gets around the problem
but does not fix it (and may even fail in some cases, although I didn't see
this yet):
-------------
;; we need the NTEmacs etags, not the cygwin etags
(setq dtd-etags-program "/cygdrive/d/Win32App/emacs207/bin/etags.exe")

;; this regexp is a slimy hack to get around a whitespace problem of
NTEmacs etags when running in cygwin bash
(setq dtd-etags-regex-option
"--regex=\'/<!\\(ELEMENT\\|ENTITY.+%\\|NOTATION\\|ATTLIST\\)[^a-zA-Z0-9]+\\
(.+\\)/\\2/\'")
-------------

regards
Markus

-- 
Markus Hoenicka, PhD
UT Houston Medical School
Dept. of Integrative Biology and Pharmacology
6431 Fannin MSB4.114
Houston, TX 77030
(713) 500-6313, -7477
(713) 500-7444 (fax)
Markus.Hoenicka@uth.tmc.edu
http://ourworld.compuserve.com/homepages/hoenicka_markus/


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com



More information about the Cygwin mailing list