Coder Social home page Coder Social logo

Comments (22)

redguardtoo avatar redguardtoo commented on June 12, 2024 1

Sounds good. If you find any new issues, don't hesitate to report.

from counsel-etags.

redguardtoo avatar redguardtoo commented on June 12, 2024

Windows has its own find.exe. If you install cygwin/msys2 to its default location (drivers doesn't matter). The correct find will be AUTOMATICALLY found. Or else, you need (setq counsel-etags-find-program "c:\\\\whatever-path\\\\bin\\\\find.exe") by yourself.

from counsel-etags.

Opioid avatar Opioid commented on June 12, 2024

Ah, that is good to know. However, after pointing counsel-etags to the gnu-find.exe I get the following message:

C:/bin/find.exe . ( -iwholename "/.vscode/" -or -iwholename "/extern/" -or -iwholename "/deps/" -or -iwholename "/build/" -or -iwholename "/.git/" -or -iwholename "/.svn/" -or -iwholename "/.cvs/" -or -iwholename "/.bzr/" -or -iwholename "/.hg/" -or -iwholename "/bin/" -or -iwholename "/fonts/" -or -iwholename "/images/" -or -iwholename "/.DS_Store/" -or -iwholename "/.npm/" -or -iwholename "/.tmp/" -or -iwholename "/.sass-cache/" -or -iwholename "/.idea/" -or -iwholename "/node_modules/" -or -iwholename "/bower_components/" -or -iwholename "/.tox/" -or -iwholename "/.cask/" ) -prune -o -type f -not -size +800k -not -name ".clang-format" -not -name ".json" -not -name ".log" -not -name "tags" -not -name "TAGS" -not -name ".gz" -not -name ".zip" -not -name ".tar" -not -name ".rar" -not -name "GTAGS" -not -name "GPATH" -not -name "GRTAGS" -not -name "cscope.files" -not -name "bundle.js" -not -name "min.js" -not -name "min.css" -not -name ".png" -not -name ".jpg" -not -name ".jpeg" -not -name ".gif" -not -name ".bmp" -not -name ".tiff" -not -name ".ico" -not -name ".doc" -not -name ".docx" -not -name ".xls" -not -name ".ppt" -not -name ".pdf" -not -name ".odt" -not -name ".obj" -not -name ".o" -not -name ".a" -not -name ".dylib" -not -name ".lib" -not -name ".d" -not -name ".dll" -not -name ".exe" -not -name ".metadata*" -not -name ".class" -not -name ".war" -not -name ".jar" -not -name "flymake" -not -name "##" -not -name ".#" -not -name ".swp" -not -name "~" -not -name ".elc" -not -name ".pyc" -print | ctags -e -L -: exited abnormally with code 255.

Any idea what that could be?

from counsel-etags.

redguardtoo avatar redguardtoo commented on June 12, 2024

you may need set ctags.exe too. check counsel-etags-tags-program

from counsel-etags.

Opioid avatar Opioid commented on June 12, 2024

Hm, ctags is in my path so I'm pretty sure it is found.
counsel-etags-tags-program is nil in my emacs, so the value is picked automatically. Are you suggesting I overwrite the value with the absolute path to the executable?

from counsel-etags.

redguardtoo avatar redguardtoo commented on June 12, 2024

Run ctags in dos window, what's output?

Please run that cli in Dos window (replace c:/bin/find.exe with c:\bin\find.exe at first)? what's the output?

from counsel-etags.

Opioid avatar Opioid commented on June 12, 2024

D:\Workspace\p2render>C:\bin\find.exe . ( -iwholename "/.vscode/" -or -iwholename "/tools/" -or -iwholename "/extern/" -or -iwholename "/deps/" -or -iw
holename "/build/" -or -iwholename "/.git/" -or -iwholename "/.svn/" -or -iwholename "/.cvs/" -or -iwholename "/.bzr/" -or -iwholename "/.hg/" -or -
iwholename "/bin/" -or -iwholename "/fonts/" -or -iwholename "/images/" -or -iwholename "/.DS_Store/" -or -iwholename "/.npm/" -or -iwholename "/.tmp
/
" -or -iwholename "/.sass-cache/" -or -iwholename "/.idea/" -or -iwholename "/node_modules/" -or -iwholename "/bower_components/" -or -iwholename "/.
tox/
" -or -iwholename "/.cask/" ) -prune -o -type f -not -size +800k -not -name ".clang-format" -not -name ".json" -not -name ".log" -not -name "tags" -no
t -name "TAGS" -not -name ".gz" -not -name ".zip" -not -name ".tar" -not -name ".rar" -not -name "GTAGS" -not -name "GPATH" -not -name "GRTAGS" -not -name "
cscope.files" -not -name "bundle.js" -not -name "min.js" -not -name "min.css" -not -name ".png" -not -name ".jpg" -not -name ".jpeg" -not -name ".gif" -n
ot -name "
.bmp" -not -name ".tiff" -not -name ".ico" -not -name ".doc" -not -name ".docx" -not -name ".xls" -not -name ".ppt" -not -name ".pdf" -not -na
me "
.odt" -not -name ".obj" -not -name ".o" -not -name ".a" -not -name ".dylib" -not -name ".lib" -not -name ".d" -not -name ".dll" -not -name ".exe" -
not -name ".metadata*" -not -name ".class" -not -name ".war" -not -name ".jar" -not -name "flymake" -not -name "##" -not -name ".#" -not -name ".swp" -no
t -name "
~" -not -name ".elc" -not -name ".pyc" -print | ctags -e -L -
C:\bin\find.exe: paths must precede expression
Usage: C:\bin\find.exe [-H] [-L] [-P] [path...] [expression]

So it's still a problem with my find program. I wonder what that means.

EDIT:
I found this thread on stackoverflow that might contain some hints to the problem.
When I try the older find version that is mentioned I get a different error message:

C:\bin\find.exe: invalid predicate `-iwholename'

I'm not sure I understand 100%, but apparently it is possible to provide find arguments that work both on linux and windows. Would you even be interested in accepting such things in counsel-etags?

from counsel-etags.

redguardtoo avatar redguardtoo commented on June 12, 2024

install cygwin or msys, we only support GNU Find and BSD Find.

from counsel-etags.

Opioid avatar Opioid commented on June 12, 2024

C:\bin>find --version
GNU find version 4.2.20
Features enabled: CACHE_IDS D_TYPE

Do you think the problem would be resolved by installing cygwin? I will do some more research.

from counsel-etags.

redguardtoo avatar redguardtoo commented on June 12, 2024

What's output of find --help, looks you find.exe is correct.

from counsel-etags.

Opioid avatar Opioid commented on June 12, 2024

C:\bin>find --help
Usage: find [path...] [expression]

default path is the current directory; default expression is -print
expression may consist of: operators, options, tests, and actions:

operators (decreasing precedence; -and is implicit where no others are given):
( EXPR ) ! EXPR -not EXPR EXPR1 -a EXPR2 EXPR1 -and EXPR2
EXPR1 -o EXPR2 EXPR1 -or EXPR2 EXPR1 , EXPR2

positional options (always true): -daystart -follow
normal options (always true, specified before other expressions):
-depth --help -maxdepth LEVELS -mindepth LEVELS -mount -noleaf
--version -xdev -ignore_readdir_race -noignore_readdir_race

tests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N
-cnewer FILE -ctime N -empty -false -fstype TYPE -gid N -group NAME
-ilname PATTERN -iname PATTERN -inum N -iwholename PATTERN -iregex PATTERN
-links N -lname PATTERN -mmin N -mtime N -name PATTERN -newer FILE
-nouser -nogroup -path PATTERN -perm [+-]MODE -regex PATTERN
-wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N
-used N -user NAME -xtype [bcdpfls]

actions: -exec COMMAND ; -fprint FILE -fprint0 FILE -fprintf FILE FORMAT
-fls FILE -ok COMMAND ; -print -print0 -printf FORMAT -prune -ls -delete
-quit

Report (and track progress on fixing) bugs via the findutils bug-reporting
page at http://savannah.gnu.org/ or, if you have no web access, by sending
email to [email protected].

from counsel-etags.

Opioid avatar Opioid commented on June 12, 2024

This is getting more and more mysterious.

  1. It really has to be (setq counsel-etags-find-program "C:\bin\find.exe"). Unix style path doesn't work in this case for some reason.
  2. The GNU find version I was using still doesn't work. The TAGS file stays empty.
  3. I extracted find (and its dependencies) from cygwin. Now a TAGS file is created and filled with content, but using it leads to unexpected results. Basically the tags cannot be used.
  4. The only thing that works for me so far, is just calling something like "ctags -Re --exclude=build --exclude=deps --exclude=extern --exclude=tools". Afterwards I can navigate the tags as expected.

from counsel-etags.

redguardtoo avatar redguardtoo commented on June 12, 2024

just double check:

first, your are running native windows version

second, you have not setup any term or shell in your .emacs. So I suppose Emacs will start a dos shell to run cli

third, you are using GNU Find and CTags.

At last, if you want to setup programs manually, please follow my sample (setq counsel-etags-find-program "c:\\\\whatever-path\\\\bin\\\\find.exe"), note the extra slashes. Please note you need setup both find and ctags to be sure.

If you just install Cygwin (64bit) to the default location and have not done any extra setup in your .emacs, this plugin should work out of box.

I've tested on Windows 7 and 10. It works.

from counsel-etags.

Opioid avatar Opioid commented on June 12, 2024

I installed cygwin now. counsel-etags automatically finds the cygwind find.exe and generates the tags. The outcome, however, is the same as point 3 in my previous post. It will for example open a new buffer with the name of the file where a certain symbol is defined, but the buffer will be empty.

Comparing the contents of the TAGS file created "manually" and the one by counsel-etags, I notice that the manual TAGS file contains relative file paths, while the other file contains absolute file paths. Is there an option for counsel-etags to adjust this behavior?

EDIT:
I tried

(when is-win
(setq counsel-etags-tags-program "C:\\bin\\ctags.exe -Re -L")
)

and it does what I intended to achieve, but the generated TAGS file is exactly the same as without the adjustment.

from counsel-etags.

redguardtoo avatar redguardtoo commented on June 12, 2024

Ok, now I know what happens, (setq counsel-etags-project-root "the/directory/of/your/tag-file").

Another solution (if you prefer create tags file by yourself):
Search counsel-etags-update-tags-backend in README. You can use your own way to create tags.

See https://emacs.stackexchange.com/questions/19075/regenerate-ctags-tags-file-without-freezing-emacs-for-a-while/38911#38911 for the technique not to block user input when generating ctags.

from counsel-etags.

Opioid avatar Opioid commented on June 12, 2024

Ah, but then I can only have a single tag-file-root, right? Generally counsel-etags seemed to perform perfectly fine with different tag files in different project directories, even when switching buffers and so on. Is there a way to make counsel-etags automatically select the project root to the directory where the tag file is created? It sounds confusing while I write it, but I guess it is a matter of changing the working directory when executing ctags or something.

from counsel-etags.

redguardtoo avatar redguardtoo commented on June 12, 2024

counsel-etags will detect project root automatically if you use git/svn/hg to manage code, see counsel-etags-project-file if you want it support more project types. Or you can use https://www.gnu.org/software/emacs/manual/html_node/elisp/Directory-Local-Variables.html to setup per directory variables?

Can you do code navigation after seting project root?
If not, could you give me more details about your setup, OS, Emacs, the CLI tools you use?

from counsel-etags.

redguardtoo avatar redguardtoo commented on June 12, 2024

I tested v1.5.0 on windows 7, 10. Install Cygwin and its package ctags, and run M-x counsel-etags-find-tag-at-point. It works out of box.

from counsel-etags.

Opioid avatar Opioid commented on June 12, 2024

Maybe we misunderstood each other. I believe the project root selection works just fine. I manually created tag files for two different projects and could freely switch between the two and do code navigation.

My problem is more like this: I have open file A and B of the same project without any tags. I use counsel-etags to crate the tags. I press M-. in file A, the symbol is defined in file B, and I end up in an empty buffer called B<2>.

This does not happen with the manually created tag files, for some reason. The only difference I noticed was absolute paths in counsel-etags generated tag files, and paths relative to project root in the other case. That's why I was curious whether it is possible to change the working directory before calling ctags.

from counsel-etags.

redguardtoo avatar redguardtoo commented on June 12, 2024

Check v1.5.0 the relative path is always relative to the file TAGS

from counsel-etags.

Opioid avatar Opioid commented on June 12, 2024

I used melpa to update counsel-etags. counsel-etags.el has version 1.5.0 written in it. Everything actually works now, although the generated tags file looks exactly the same as before. Absolute file paths that is. Not that it really matters, but still interesting to see, that we get such different behavior on windows.

from counsel-etags.

Opioid avatar Opioid commented on June 12, 2024

Thanks for helping me out!

from counsel-etags.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.