Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect file path in counsel-etags-find-tag-at-point #697

Closed
phye opened this issue May 31, 2018 · 13 comments
Closed

Incorrect file path in counsel-etags-find-tag-at-point #697

phye opened this issue May 31, 2018 · 13 comments

Comments

@phye
Copy link
Contributor

phye commented May 31, 2018

I was trying your configs for C++ code navigation, however, I ran into issues when Emacs incorrectly jump to a file which does not exist at all.

Sometimes, there was missing one or more letters in the path prompt, sometimes there're duplicates chars in the path, in any case the selected path pointed to nothing in my file system and Emacs was complaining the following messages. However, sometimes, the path is correct and Emacs can jump to the correct location.

File mode specification error: (file-error Setting current directory No such file or directory /home/phye/ws/XXX/libXXXctct/include/)

BTW, I was using Ctags as the backend for navigation, I'm not sure whether this is a bug of counsel-etags or Ctags itself.

I'll provide more examples later with navigating open source code.

@redguardtoo
Copy link
Owner

Run M-x counsel-etags-scan if you got any error.

@phye
Copy link
Contributor Author

phye commented May 31, 2018

There're no errors.

Also, I've been ran into emacs coredump occasionally when I was using counsel-etags-find-tag-at-point

Just FYI, some of the classes/functions are compiled in separate .so files, not sure if this related, though.

@redguardtoo
Copy link
Owner

Yes, you should exclude *.so.

I use Emacs Lisp to parse the text. The Emacs Lisp can't handle long lines (say 10000). This is a known problem of Emacs for ages.

@redguardtoo
Copy link
Owner

redguardtoo commented May 31, 2018

fe93a58

@phye
Copy link
Contributor Author

phye commented May 31, 2018

Thanks! I'll give them a try a.s.a.p!

@phye
Copy link
Contributor Author

phye commented May 31, 2018

Confirmed that emacs coredump issue is not reoccuring (at least for the short period I tried), however, the incorrect path issue still exists. Even if I regenerate the tags files.

BTW, is the tags file generated by ctags usable by vim? I can try that to check if it's due to incorrect tag file.

@redguardtoo
Copy link
Owner

Try to give me more details on incorrect path. Or else I can't debug.

tags file could only be used by Emacs.

@phye
Copy link
Contributor Author

phye commented Jun 1, 2018

Was busy shopping last night... Will provide more detail in the weekend...

Sorry :(

@phye
Copy link
Contributor Author

phye commented Jun 2, 2018

I've managed to reproduce the issue with opencv. Here's the procedure:

  1. git clone https://github.com/opencv/opencv.git
  2. emacs -nw /ws/opencv/include/opencv/cv.h
  3. At line 51, locate cursor to CV_DO_PRAGMA and enter C-] to call counsel-etags-find-tag-at-point
  4. Emacs will complain that no tags are found and will create one
  5. In the prompt window for the symbol below, the first three lines are all incorrect paths and point to nothing. As you can see, include have been cut to incde. And if you choose any of the first three lines, Emacs will not find the file correctly.
6    Find Tag (0.0 seconds):
incde/opencv/v/cv.h:56:    #define CV_DO_PRAGMA(
incde/opencv/v/cv.h:53:    #define CV_DO_PRAGMA(
incde/opencv/v/cv.h:47:    #define CV_DO_PRAGMA(
modes/core/ininclude/opencv2/core/base.hpp:328:    #define CV_DO_PRAGMA(
modes/core/ininclude/opencv2/core/base.hpp:326:    #define CV_DO_PRAGMA(
modes/core/ininclude/opencv2/core/base.hpp:324:    #define CV_DO_PRAGMA(

@redguardtoo
Copy link
Owner

I can't reproduce the bug. Try to update with latest counsel-etags

Maybe it's ctags problem? Could you double check content of TAGS? Is path correct in that file?

My ctags version is Exuberant Ctags 5.9

@phye
Copy link
Contributor Author

phye commented Jun 3, 2018

That's really strange.

I just checked the TAGS file, the path in that file is not correct:

**incde/opencv/v/cv.h,543**
#define OPENCV_OLD_CV_H^?OPENCV_OLD_CV_H^A44,2181
    #define CV_DO_PRAGMA(^?CV_DO_PRAGMA^A47,2228
    #define __CVSTR2__(^?__CVSTR2__^A48,2268
    #define __CVSTR1__(^?__CVSTR1__^A49,2297
    #define __CVMSVCLOC__ ^?__CVMSVCLOC__^A50,2337
    #define CV_MSG_PRAGMA(^?CV_MSG_PRAGMA^A51,2402
    #define CV_DO_PRAGMA(^?CV_DO_PRAGMA^A53,2501
    #define CV_MSG_PRAGMA(^?CV_MSG_PRAGMA^A54,2542
    #define CV_DO_PRAGMA(^?CV_DO_PRAGMA^A56,2609
    #define CV_MSG_PRAGMA(^?CV_MSG_PRAGMA^A57,2637
#define CV_WARNING(^?CV_WARNING^A59,2676
#define CV_IMPL ^?CV_IMPL^A70,3079

I am using Exuberant ctags versioned 5.8.5 from ArchLinux original repo, which points to
http://ctags.sourceforge.net/ from where I cannot find any newer version from sourceforge:

https://www.archlinux.org/packages/extra/x86_64/ctags/
https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/ctags
http://ctags.sourceforge.net/

pacman -Ss ctags | grep installed                                         [18-06-03 8:12:21]
extra/ctags 5.8-5 [installed]

I'd like to try with your version of 5.9 Exuberant Ctags, can you paste me the link to it? Thanks.

BTW, updating counsel-etags does not change anything.

@redguardtoo
Copy link
Owner

I use ctags from debian testing. Looks it's ctags problem. You can use unverisal ctags instead.

@phye
Copy link
Contributor Author

phye commented Jun 3, 2018

Thanks. After switching to universal ctags, there're no such issues now.

Perhaps you may update README to record this issue.

@phye phye closed this as completed Jun 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants