redguardtoo / counsel-etags Goto Github PK
View Code? Open in Web Editor NEWFast, energy-saving, and powerful code navigation solution
Fast, energy-saving, and powerful code navigation solution
Hi, When I typed counsel-etags-find-tag-at-point, got this error. I'm not sure whether ctags goes wrong or not?
/usr/bin/bash: -c: line 0: syntax error near unexpected token (' /usr/bin/bash: -c: line 0:
c:\\cygwin64\\bin\\find.exe . \( -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 +64k -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\ | c:\\cygwin64\\bin\\ctags.exe -e -L -'
see https://www.reddit.com/r/emacs/comments/82l16v/rms_on_which_improvements_to_emacs_would_be_truly/
C modules or better algorithm
I followed setup instructions from https://github.com/dan-t/rusty-tags
Installed universal ctags, rusty-tags, called rusty-tags emacs
in the project's root, followed the "standard library support" section, i.e. set RUST_SRC_PATH
in my ~/.profile
(echo $RUST_SRC_PATH
) outputs this: /Users/me/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/src/
, installed counsel-etags
, created .dir-locals.el
in my project's root with these contents:
((nil . ((counsel-etags-update-tags-backend . (lambda (src-dir) (shell-command "rusty-tags emacs")))
(counsel-etags-extra-tags-files . ("~/third-party-lib/rusty-tags.emacs" "$RUST_SRC_PATH/rusty-tags.emacs"))
(counsel-etags-tags-file-name . "rusty-tags.emacs"))))
After all this, I start emacs, press shortcut (using evil mode - CTRL+]
) on Result
(which is a type of Rust's standard lib).
Prompt appears: Visit tags table (default TAGS): ~/myProjectRoot/src/
I edit the path to this: ~/myProjectRoot/rusty-tags.emacs
Now it works for local tags, but not the standard lib, since it's not in this file. So it can't find anything for Result
.
How do I configure it to recognize both? I thought that .dir-locals.el
perhaps does this, but it seems to have no effect as I'm prompted to enter a path.
Note that if I don't use shortcut navigation, but M-x counsel-etags-find-tag-at-point
it works for both local and standard lib tags.
I asked in rusty-tags repo but was directed to here dan-t/rusty-tags#60 (comment)
Recently counsel-etags-find-tag-at-point started suggesting and open bogus files. (This happens on windows, I haven't had the chance to try on linux yet.)
Here is an example of a search result suggested by counsel-etags:
e:/projects/workspace/projects/sprout/E:\projects\workspace\projects\sprout\source\core\scene\material\matte\matte_material.cpp:14:material::Sample const& Material::sample(...)
I guess the interesting thing is that the first part of the path is duplicated with different slashes. Selecting such a result will open an empty buffer.
The entry in the TAGS file starts with
E:\projects\workspace\projects\sprout\source\core\scene\material\matte\matte_material.cpp,607
So I don't know where that e:/projects/workspace/projects/sprout/ prefix is coming from.
Periodically counsel-etags will update the tags file by running find and ctags. This creates a huge message that is displayed in the mini-buffer which suddenly grows many lines tall (at least on my setup).
I use (setq counsel-etags-quiet-when-updating-tags t) but it doesn't seem to make a difference. (Maybe those two things are not related).
Is it possible to make this message shorter, so that it comfortably fits in a single-line mini-buffer? As it is, it can be confusing to see the mini-buffer suddenly "jump" to a taller size. I wouldn't mind a short message telling me, that ctags is running, but especially the long list of arguments to find doesn't add value in my opinion.
First off, thanks for the awesome package and the hard work you've put in!
I noticed that the find command does not do what I expect it to for what appears to be two separate reasons.
File names are not correctly ignored because the find command is executed as find . ... -not -name "\*.json"
when it should be find . ... -not -name "*.json"
. This is resolved by removing the (shell-quote-argument n)
call here and replacing it with n
. This boils down to not needing to shell-quote arguments that are passed to the shell as literal quotes.
If I try to ignore the directories build*
, e.g. build_clang
, build_gcc
, etc. by using (add-to-list 'counsel-etags-ignore-directories '"build*")
the find command fails. Find is executed as find . \( ... -iwholename "*build\*/*" ...\)
which does not work. The desired call is find . \(... -iwholename "*build*" ...\)
. This requires changing the line here from (shell-quote-argument (file-name-as-directory p))
to p
.
These two issues may be related to find behaving differently on UNIX and Linux, but I'm not sure.
OS: Arch Linux
Emacs: 25.3.1
Project uses: git
CTags:
Universal Ctags 0.0.0(04a8f1f6), Copyright (C) 2015 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
Compiled: Dec 27 2017, 00:24:29
URL: https://ctags.io/
Optional compiled features: +wildcards, +regex, +multibyte, +option-directory, +xpath, +json, +interactive, +sandbox, +yaml
find:
find (GNU findutils) 4.6.0
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Eric B. Decker, James Youngman, and Kevin Dalley.
Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) CBO(level=2)
counsel-etags: 20171215.2123
Note: This may be useful for #5
For example I want to use rusty-tags for if I am in a rust project.
Manually calling rusty-tags emacs
will generate a usable tags file, which then can be used with counsel-etags, but I would like to automatically always use this backend, including auto-update and so on. Is this possible? Is counsel-etags the right level to handle this?
check ffip code
Thanks for this great package.
After leaving Emacs open for a few hours, I usually end up with dozens of buffers called Emacs Generating Command. My elisp is very poor, but from reading the code I understand that these are created when the TAGS command is (re-)created.
Having that many buffers is not a big issue, but it's annoying. This happens on both Ubuntu and macOS, with Emacs 25.1 and 27. (My emacs setup is the same in both machines).
On my windows I have a problem with counsel-etags-scan-code and counsel-etags-updata-tags-force. I think it is a problem with the find command.
cousel-etags creates the following command:
find . ( -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 -
Which produces this result:
FIND: Parameter format not correct
So find is installed on the machine but the expected format is somehow wrong. Has anybody else seen this problem?
I can still create the tags by just running e.g. "ctags -Re" and use counsel-etags afterwards. For those instances when no tags are found and counsel-etags falls back to ripgrep I get the following message though:
No files were searched, which means ripgrep probably applied a filter you didn't expect. Try running again with --debug.
Could this be related?
Hi
Thanks for so cool project. Almost everything works like a charm!
I have a small problem with counsel-etags-find-tag
on Windows 10 with Emacs 26.1 (also I have ripgrep
in my PATH
and all other apps like find
as well).
The problem is that I cannot find results by doing case-insensitive search. If there's tag ThisIsATag
and I run counsel-etags-find-tag
and search thisisa
, the tag is not found. I tried setting grep program as rg -i
or (setq counsel-etags-case-sensitive nil)
etc. to explicitly ignore case, but nothing helps. Searching counsel-etags-find-tag-at-point
finds all the results.
I hope that this is just my misuse but may be some issue as well.
Thanks,
Taras
Hello everyone,
I would love to use counsel-etags to regularly tag my cplusplus files. I tried to make it work for a small example and I failed.
First of my counsel-etags settings
(use-package counsel-etags
:ensure t
:init
;; (eval-when-compile
;; Silence missing function warnings
;; (declare-function counsel-etags-virtual-update-tags "counsel-etags.el")
;; (declare-function counsel-etags-guess-program "counsel-etags.el")
;; (declare-function counsel-etags-locate-tags-file "counsel-etags.el"))
:bind (
("M-." . counsel-etags-find-tag-at-point)
("M-t" . counsel-etags-grep-symbol-at-point)
("M-s" . counsel-etags-find-tag))
:config
;; Ignore files above 800kb
(setq counsel-etags-max-file-size 800)
;; Ignore build directories for tagging
(add-to-list 'counsel-etags-ignore-directories '"build*")
(add-to-list 'counsel-etags-ignore-directories '".vscode")
(add-to-list 'counsel-etags-ignore-filenames '".clang-format")
;; Don't ask before rereading the TAGS files if they have changed
(setq tags-revert-without-query t)
;; Don't warn when TAGS files are large
(setq large-file-warning-threshold nil)
;; How many seconds to wait before rerunning tags for auto-update
(setq counsel-etags-update-interval 10)
;; Setup auto update now
(add-hook 'prog-mode-hook
(lambda ()
(add-hook 'after-save-hook
'counsel-etags-virtual-update-tags 'append 'local)))
)
Then I created a folder test_cpp and a file test_cpp.cpp. Furthermore I issued the command
touch TAGS
inside this folder.
Then I began to forward declare some functions before the main function. I jumped to the end of my file and implemented the actual definition of these functions. My code looks like this
#include <iostream>
int add( int , int );
int substract (int, int );
int multiplication (int , int);
double division(int , int);
int main()
{
std::cout << "This is substraction:" << "\n";
std::cout << substract(5, 4) << "\n";
std::cout << add(4,5) << "\n";
std::cout << multiplication(5, 4) << "\n";
std::cout << division(5,4);
return 0;
}
int add (int x, int y ){
return x+y;
}
int substract (int x, int y){
return x-y;
}
int multiplication(int x, int y) {
return x*y;
}
double division(int x, int y){
return x/y;
}
Since a TAGS file existed and the update interval was set to 10, I expected the TAGS file to be updated every 10 seconds and every time I saved the code file. But the TAGS file does not change at all.
Am I doing something wrong?
Thank you for your help,
Nils
Hi,
I'm afraid this breaks things with zsh on linux, counsel-etags-grep
doesn't works now in my case.
Here is what it looks like in terminal:
$ /usr/bin/rg -n -M 512 --no-heading --color never -s --path-separator / -g="!.git/* -g="!.svn/* -g="!.cvs/* -g="!.bzr/* -g="!.hg/* -g="!bin/* -g="!fonts/* -g="!images/* -g="!.DS_Store/* -g="!.npm/* -g="!.tmp/* -g="!.sass-cache/* -g="!.idea/* -g="!node_modules/* -g="!bower_components/* -g="!.tox/* -g="!.cask/* -g="!*.json -g="!*.log -g="!tags -g="!TAGS -g="!*.gz -g="!*.zip -g="!*.tar -g="!*.rar -g="!GTAGS -g="!GPATH -g="!GRTAGS -g="!cscope.files -g="!*bundle.js -g="!*min.js -g="!*min.css -g="!*.png -g="!*.jpg -g="!*.jpeg -g="!*.gif -g="!*.bmp -g="!*.tiff -g="!*.ico -g="!*.doc -g="!*.docx -g="!*.xls -g="!*.ppt -g="!*.pdf -g="!*.odt -g="!*.obj -g="!*.o -g="!*.a -g="!*.dylib -g="!*.lib -g="!*.d -g="!*.dll -g="!*.exe -g="!.metadata* -g="!*.class -g="!*.war -g="!*.jar -g="!*flymake -g="!#*# -g="!.#* -g="!*.swp -g="!*~ -g="!*.elc -g="!*.pyc "counsel-etags-grep" --
zsh: event not found: .git/
But bash doesn't have this issue, and I can work around it by let
ting shell-file-name
to "/bin/bash".
I have recently encountered TAGS files that contain lines like the following at the bottom of the file: C:\Users\me\.rusty-tags\cache\base-634785015357407805.emacs,include
. As far as I can tell, counsel-etags does not include those tags in its search. Should this be supported?
Used in counsel-etags-scan-code
:
https://github.com/redguardtoo/counsel-etags/blob/master/counsel-etags.el#L343
Marker position is not saved when fallback function counsel-etags-grep is used.
Second issue: marker is saved even when user decides to quit counsel when selecting candidates (with C-g)
Patch in attachment.
patch.txt
Hi I am getting started with emacs and counsel/ivy/counse-etags
But counse-etags-list-tag
is not working for me.
I get the message above and no results are presented.
After calling 'counsel-etags-find-tag-at-point' and jumping to the function definition, 'pop-tag-mark' doesn't work with message "no previous locations for find-tag invocation".
Package-Version: 20180121.1738
use https://en.wikipedia.org/wiki/Levenshtein_distance
Hello again,
Sorry to bother again, I have a new issue since yesterday : when I save a file (triggering the after-save-hook), emacs asks (and blocks the whole ui) to reload TAGS file saying : Tags file has changed, read new contents ? (y / n)
Note : TAGS file is 30Mb large and also triggers a warning when opening a file withing the project
I have this setup for counsel-etags
(use-package counsel-etags
:ensure t
:init
(setq counsel-etags-update-interval 300) ; 300 seconds, OPTIONAL
(define-key evil-normal-state-map (kbd "M-g") 'counsel-etags-find-tag-at-point)
(add-hook 'prog-mode-hook
(lambda ()
(add-hook 'after-save-hook
'counsel-etags-virtual-update-tags 'append 'local)))
)
Besides, it opens a window with ctags warnings.
My setup : emacs 25.3 / archlinux
Would you have any idea of what is going on ?
Regards
Hi,
Recently I try to use native Emacs with Cygwin on Windows because the Cygwin version occasionaly crashs.
It works almost fine, except that counsel-etags-grep
complains that it can't find grep.
With some tracing, I find out it is due to my installing cygwin in F:\
, which is not covered by counsel-etags-guess-program:
(defun counsel-etags-guess-program (name)
"Guess executable path from its NAME on Windows."
(let* (rlt)
(when (eq system-type 'windows-nt)
(cond
((file-executable-p (setq rlt (concat "c:\\\\cygwin64\\\\bin\\\\" name ".exe"))))
((file-executable-p (setq rlt (concat "d:\\\\cygwin64\\\\bin\\\\" name ".exe"))))
((file-executable-p (setq rlt (concat "e:\\\\cygwin64\\\\bin\\\\" name ".exe"))))
(t (setq rlt nil))))
(if rlt rlt name)))
So my question is why not using executable-find
to find the program? it works actually.(I've added "f:/cygwin64/bin"
to exec-path
).
try some big project like linux kernel source
Is it possible to add an optional, custom callback for cases when no tag is found? For me, this typically happens when I try to look up a local variable and it that case I would find it most useful to simply use swiper or something in the current file.
as title
If grep
is triggered as fallback of find-tag
, the result should also be sorted using string-distance
.
as title.
In this case, we need some Emacs API list files recursively and feed the file list into etags
.
search in whole file once, if possible use ag or grep, how much time
in case working on different branch of same project
It would be nice to have a command that lists all symbols in the current buffer, for a nice overview of what's going on in the current buffer.
Hi, I use emacs with your configure
when I use counsel-etags-find-tag-at-point
function
got error :Wrong type argument: markerp, nil
and the error detail is
ctags: invalid option -- 'e'
Try 'ctags --help' for a complete list of options.
On a linux machine where I used counsel-etags before, I suddenly get the following error when starting a tags search for the first time, before the TAGS file has been created.
counsel-etags-scan-dir called => /home/beni/workspace/projects/sprout/
counsel-etags-get-scan-command called => find-program=/usr/bin/find ctags-program=/usr/bin/ctags cmd=/usr/bin/find . ( -iwholename "/.vscode" -or -iwholename "/tools" -or -iwholename "/test" -or -iwholename "/extern" -or -iwholename "/doc" -or -iwholename "/deps" -or -iwholename "/data" -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 ".log" -not -name "tags" -not -name "TAGS" -not -name ".tgz" -not -name ".gz" -not -name ".xz" -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 ".so" -not -name ".o" -not -name ".a" -not -name ".ifso" -not -name ".tbd" -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 | /usr/bin/ctags -e --options="/home/beni/.ctags" -L -" -not -name ".elc" -not -name ".pyc" -print | /usr/bin/ctags -e --options="/home/beni/.ctags" -L -
counsel-etags-scan-dir-internal called => src-dir=/home/beni/workspace/projects/sprout/ find-program=/usr/bin/find ctags-program=/usr/bin/ctags default-directory=/home/beni/workspace/projects/sprout/ cmd=/usr/bin/find . ( -iwholename "/.vscode" -or -iwholename "/tools" -or -iwholename "/test" -or -iwholename "/extern" -or -iwholename "/doc" -or -iwholename "/deps" -or -iwholename "/data" -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 ".log" -not -name "tags" -not -name "TAGS" -not -name ".tgz" -not -name ".gz" -not -name ".xz" -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 ".so" -not -name ".o" -not -name ".a" -not -name ".ifso" -not -name ".tbd" -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 "
/usr/bin/find . ( -iwholename "/.vscode" -or -iwholename "/tools" -or -iwholename "/test" -or -iwholename "/extern" -or -iwholename "/doc" -or -iwholename "/deps" -or -iwholename "/data" -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 ".log" -not -name "tags" -not -name "TAGS" -not -name ".tgz" -not -name ".gz" -not -name ".xz" -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 ".so" -not -name ".o" -not -name ".a" -not -name ".ifso" -not -name ".tbd" -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 | /usr/bin/ctags -e --options="/home/beni/.ctags" -L - at /home/beni/workspace/projects/sprout/
counsel-etags-find-tag-api called => info nil nil
Failed to create tags file.
use counsel-etags-find-tags, I can find the result desplayed in buffer, but when I select one row and enter "Enter" key, I can't jump to the target file position, I get error:
Use M-x make-directory RET RET to create the directory and its parents
counsel-etags-open-file-api: Search failed: "hello"
tags-table-list
(if there is one more tag file, have to use full path)tag-file-name
Hi, Mr. Chen, I try this package today on Emacs and it's great! But when I want to customize tag program ,for example, set counsel-etags-tags-program
variable to "etags" and it can not create tag file using counsel-etags-scan-code
after that.
Another question, I use it on MSYS2, not set tag program, it can not find installed ctags program, show Please install Ctags before run this program!
. I can not find where is going wrong.
Last question, if I create TAGS file in a specify folder not under current project folder using CLI, How to use this TAGS according counsel-etags. I try to use Emacs visit-tags-table
but also call ctags scan code
under current project folder.
Thanks!
see https://www.reddit.com/r/emacs/comments/7t66ey/does_etags_support_groups/
The thing is, tag file created for Emacs (check ctags -e
option) doesn't contain group information.
so two solutions:
$HOME/.ctags
and filter the candidateIn counsel-etags-add-tags-file-to-history:
counsel-etags.el:520:26:Error: `add-to-list' can't use lexical var `rlt'; use
`push' or `cl-pushnew'
counsel-etags.el:582:1:Warning: Lexical argument shadows the dynamic variable
find-program
counsel-etags.el:713:1:Warning: Unused lexical variable `rlt'
In GNU Emacs 27.0.50 (build 2, x86_64-w64-mingw32)
of 2019-10-31 built on ...
Repository revision: e65be8cc5b623385ebe31aa0a1089e0de2b075b5
Repository branch: master
Windowing system distributor 'Microsoft Corp.', version 10.0.18362
System Description: Microsoft Windows 10 Enterprise (v10.0.1903.18362.418)
as title.
useful when you want to check a function call with multi-line.
It's also better to support wgrep.
Or at least we need double check it before we jump
I found simplify the regex to grepping tags file could speed up the lookup when developing company-ctags
. how to test it?
Using your find at point etags command, the Emacs C-coded primitive (uses C DEFUN macro), call-process-region is not found when searched for from the cdl.el Lisp file. Regular find-tag fine. It takes over 4 seconds to not find this tag and then just give me a list of possible completion matches.
Also, after running this query, no TAGS file is written to the root project directory or anywhere else I can find.
I do like your concept, though.
Bob
different regular expression could extract same item. so duplicate does exist.
company-ctags has same problem
Hello,
I've just started using this nice package but I've just stumbled on an indexing issue
Maybe it has nothing to do with this package, but you can see in the screenshot that a path vendor/friendsofsymfony/user-bundle is misspelled (fridsofsymfony/...). And the files can't be opened when hitting enter on the candidate.
EDIT
OS : archlinux
Emacs 25.3
counsel-etags 20171111.608
project using git
One idea to solve this would be to reuse any last TAGS file used from another location or to set a default file or file-list as regular find-tag does.
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
file-name-as-directory(nil)
counsel-etags-project-root()
counsel-etags-tags-file-must-exist()
counsel-etags-find-tag-at-point()
funcall-interactively(counsel-etags-find-tag-at-point)
call-interactively(counsel-etags-find-tag-at-point record nil)
command-execute(counsel-etags-find-tag-at-point record)
execute-extended-command(nil "counsel-etags-find-tag-at-point" "counsel-etags-find-tag-")
funcall-interactively(execute-extended-command nil "counsel-etags-find-tag-at-point" "counsel-etags-find-tag-")
call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command)
Win7 x64, Emacs-26.1-x86_64
ctags --version
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
Compiled: Jul 9 2009, 17:05:35
Addresses: [email protected], http://ctags.sourceforge.net
Optional compiled features: +win32, +regex, +internal-sort
use M-x counsel-etags-scan-code and then select my vs project directory(.sln's dir), got a message:
Failed to create tags file.
d:\cygwin64\bin>find.exe --version
find (GNU findutils) 4.6.0
Packaged by Cygwin (4.6.0-1)
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Eric B. Decker, James Youngman, and Kevin Dalley.
Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) CB
O(level=2)
I add a message code in counsel-etags-async-shell-command:
(message (concat "command:" command))
(defun counsel-etags-async-shell-command (command tags-file)
"Execute string COMMAND and create TAGS-FILE asynchronously."
(let* ((directory default-directory)
;; Run the shell command without any interrupt or extra information
(buffer (generate-new-buffer "*Etags Generating Command*"))
(display-buffer-alist '(("Etags Generating Command" display-buffer-no-window))))
(with-current-buffer buffer
(setq buffer-read-only nil)
(let* ((inhibit-read-only t) proc)
(erase-buffer))
(display-buffer buffer '(nil (allow-no-window . t)))
(setq default-directory directory)
(setq proc (start-process "Shell" buffer shell-file-name
shell-command-switch command))
(message (concat "command:" command)) ;;add this line
(set-process-sentinel proc `(lambda (process signal)
(let* ((status (process-status process)))
(when (memq status '(exit signal))
(cond
((string= (substring signal 0 -1) "finished")
(let* ((cmd (car (cdr (cdr (process-command process))))))
(if counsel-etags-debug (message "`%s` executed." cmd))
;; reload tags-file
(when (and ,tags-file (file-exists-p ,tags-file))
(message "Tags file %s was created." ,tags-file)
(visit-tags-table ,tags-file t))))
(t
(message "Failed to create tags file.")))))))
;; Use the comint filter for proper handling of carriage motion
;; (see `comint-inhibit-carriage-motion'),.
(set-process-filter proc 'comint-output-filter))))
try again counsel-etags-scan-code, got message:
d:\cygwin64\bin\find.exe . ( -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 +512k -not -name ".exp" -not -name ".sln" -not -name ".make" -not -name ".htm" -not -name ".vcxproj" -not -name ".vcproj" -not -name ".user" -not -name ".filters" -not -name ".pdb" -not -name ".md" -not -name ".tlog" -not -name ".qrc" -not -name ".rc" -not -name "moc_.cpp" -not -name ".ui" -not -name "ui_.h" -not -name ".json" -not -name ".log" -not -name "tags" -not -name "TAGS" -not -name ".tgz" -not -name ".gz" -not -name ".xz" -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 ".so" -not -name ".o" -not -name ".a" -not -name ".ifso" -not -name ".tbd" -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 -
error in process filter: recursive-edit: Wrong type argument: markerp, nil
then i copy this to dos, got message:
ctags.exe: out of memory
/usr/bin/find: 'standard output'
/usr/bin/find: write error
If remove -e arg in dos command, generate a tags file success. dir:
2019/01/19 15:30 3,781,719 tags
If i use toggle-debug-on-error, got Backtrace:
Debugger entered--Lisp error: (wrong-type-argument markerp nil)
comint-output-filter(# "ctags: out of memory\n/usr/bin/find: 'standard output'\n/usr/bin/find: write error\n")
比如一个命名: aaa_bbb_ccc|
,|
表示光标位置,本来 backward-word (M-b) 后光标位置为:aaa_bbb_|ccc
,在调用了 counsel-etags-find-tag-at-point 后,光标位置直接跳过了中间的"_",变成|aaa_bbb_ccc
At first, I use counsel-etags-scan-code at ~/.emacs.d/, of course it generate a TAGS file, but for some reason, there is some variables like kill-emacs-query-functions which is declared in file /usr/local/share/emacs/25.3/lisp/files.el.gz, I use counsel-etags-find-tag-at-point but cannot find the right position, so, I guess I should counset-etags-scan-code at /usr/local/share/emacs/25.3/lisp/ also, now, I don't know how to merge these two TAGS file into one, is there any tricky for this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.