universal-ctags/citre

Unnecessary escaping of \

ksqsf opened this issue · 4 comments

ksqsf commented

I'm trying to use Citre to tag Emacs source code, and using the following config.

ctags
-o
%TAGSFILE%
--langdef=EmacsC{base=C}
--kinddef-EmacsC=D,defun,Lisp functions
--kinddef-EmacsC=V,defvar,Lisp variables
--kinddef-EmacsC=S,defsym,Lisp symbols
--regex-EmacsC=/^DEFUN.*"(.*)"/F\1/D/
--regex-EmacsC=/DEFVAR_.*"(.*)"/V\1/V/
--regex-EmacsC=/DEFSYM.*(Q[_a-zA-Z0-9]+)/\1/S/
--languages=C,EmacsC,C++,EmacsLisp,ObjectiveC
--kinds-all=*
--fields=*
--extras=*
-R

C-c C-c works, but when I try to edit this recipe again using ``, the buffer is loaded like this:

ctags
-o
%TAGSFILE%
--langdef=EmacsC{base=C}
--kinddef-EmacsC=D,defun,Lisp functions
--kinddef-EmacsC=V,defvar,Lisp variables
--kinddef-EmacsC=S,defsym,Lisp symbols
--regex-EmacsC=/^DEFUN.*"(.*)"/F\\\\1/D/
--regex-EmacsC=/DEFVAR_.*"(.*)"/V\\\\1/V/
--regex-EmacsC=/DEFSYM.*(Q[_a-zA-Z0-9]+)/\\\\1/S/
--languages=C,EmacsC,C++,EmacsLisp,ObjectiveC
--kinds-all=*
--fields=*
--extras=*
-R

Note the \\\\ part. It should be one single \ instead of four.

  • Citre version: 20221123.308
  • Emacs version: GNU Emacs 29.0.60 (build 4, x86_64-apple-darwin22.1.0, NS appkit-2299.00 Version 13.0.1 (Build 22A400))
ksqsf commented

Also, Citre seems to pass \\1 instead of \1 to Ctags. And the result tags will include an extra \. I'm not familiar with Ctags but this seems like a related bug?

Should be fixed, please test.

BTW,

--langdef=EmacsC{base=C}
--kinddef-EmacsC=D,defun,Lisp functions
--kinddef-EmacsC=V,defvar,Lisp variables
--kinddef-EmacsC=S,defsym,Lisp symbols
--regex-EmacsC=/^DEFUN.*"(.*)"/F\\\\1/D/
--regex-EmacsC=/DEFVAR_.*"(.*)"/V\\\\1/V/
--regex-EmacsC=/DEFSYM.*(Q[_a-zA-Z0-9]+)/\\\\1/S/
...

@ksqsf Your .ctags is very impressive.
I'm encouraged.

ksqsf commented

I can confirm the latest commit works. Thanks.