universal-ctags / citre

A superior code reading & auto-completion tool with pluggable backends.
GNU General Public License v3.0
320 stars 26 forks source link

Unnecessary escaping of \ #143

Closed ksqsf closed 1 year ago

ksqsf commented 1 year ago

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.

ksqsf commented 1 year ago

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?

AmaiKinono commented 1 year ago

Should be fixed, please test.

masatake commented 1 year ago

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 1 year ago

I can confirm the latest commit works. Thanks.