counsel-etags
counsel-etags copied to clipboard
counsel-etags did not auto update TAG file.
This is my counsel-etags config. counsel-etags have updated to latest.
(add-to-list 'load-path "~/.spacemacs.d/site-lisp/etags/")
(require 'counsel-etags)
(define-key evil-normal-state-map (kbd ", g d") 'counsel-etags-find-tag-at-point)
(define-key evil-normal-state-map (kbd ", g t") 'counsel-etags-grep)
(define-key evil-visual-state-map (kbd ", g t") 'counsel-etags-grep)
;; 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 180)
(eval-after-load 'counsel-etags
'(progn
;; counsel-etags-ignore-directories does NOT support wildcast
(add-to-list 'counsel-etags-ignore-directories "build")
(add-to-list 'counsel-etags-ignore-directories "build_clang")
;; counsel-etags-ignore-filenames supports wildcast
(add-to-list 'counsel-etags-ignore-filenames "TAGS")
(add-to-list 'counsel-etags-ignore-filenames "*.json")))
;; Setup auto-update
(add-hook 'prog-mode-hook
(lambda ()
(add-hook 'after-save-hook
'counsel-etags-virtual-update-tags 'append 'local)))
(add-hook 'after-save-hook 'counsel-etags-virtual-update-tags)
When I update a C file and autosaved, use ,g d
to navigate, it still jump to origin position, did not jump to the new position;
But after I force updated the TAG file, it can navigate normally.
Please see below gif :
As the gif shows, the memblock_reserved_size
function was originally at line 1544
, then I added some blank lines before the function and saved it. Use , g d
, it still jumped to 1544
, however the function is at line 1550
now.
I tested the latest version. It's working.
Below code is enough,
(add-hook 'prog-mode-hook
(lambda ()
(add-hook 'after-save-hook
'counsel-etags-virtual-update-tags 'append 'local)))
Change counsel-etags-update-interval
to a smaller number.
Hi @redguardtoo I have updated my ini config
(add-to-list 'load-path "~/.spacemacs.d/site-lisp/etags/")
(require 'counsel-etags)
(define-key evil-normal-state-map (kbd ", g d") 'counsel-etags-find-tag-at-point)
(define-key evil-normal-state-map (kbd ", g t") 'counsel-etags-grep)
(define-key evil-visual-state-map (kbd ", g t") 'counsel-etags-grep)
;; 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 1)
(eval-after-load 'counsel-etags
'(progn
;; counsel-etags-ignore-directories does NOT support wildcast
(add-to-list 'counsel-etags-ignore-directories "build")
(add-to-list 'counsel-etags-ignore-directories "build_clang")
;; counsel-etags-ignore-filenames supports wildcast
(add-to-list 'counsel-etags-ignore-filenames "TAGS")
(add-to-list 'counsel-etags-ignore-filenames "*.json")))
;; Setup auto-update
(add-hook 'prog-mode-hook
(lambda ()
(add-hook 'after-save-hook
'counsel-etags-virtual-update-tags 'append 'local)))
;; (add-hook 'after-save-hook 'counsel-etags-virtual-update-tags)
and set counsel-etags-update-interval
to 1 sec. But still it is not update automaticlly. Is there any log can help to find the problem ?
(setq counsel-etags-debug t)
. Make sure you have ctags installed and create tags file at least once in project root.
Hi @redguardtoo Yes, I have installed ctags
ctags --version
Universal Ctags 0.0.0(b7439756), Copyright (C) 2015 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
Compiled: Aug 12 2020, 16:01:04
URL: https://ctags.io/
Optional compiled features: +wildcards, +regex, +iconv, +option-directory, +packcc
and TAGS was scaned and created at the first time.
After I set (setq counsel-etags-debug t)
and change a file and save it, after the interval time I did not see any counsel-etags log in Message buffer.
Have you tested with a minimum project? See readme
@redguardtoo I have just tested the toy project in readme, unfortunately, it did not auto update TAG.
Tomorrow install the latest counsel-etags and turn of debug flag. I need see the debug output.
I also need see the value of after-save-hook
.
Hi, @redguardtoo
I have updated the latest counsel-etags.
please see the log
As the pic shows, the fn
func was original at line 7.After I change the file, the func
should be line 10. But it still jump to Line 7
Please ignore the error log, that' ycmd log(it could be conflict with counsel-etags)?
There is no message in update tags in ...
. So tags file is not re-generated.
Insert (setq counsel-etags-update-interval 3)
into init.el
and try to reproduce the issue.
@redguardtoo
After I Insert (setq counsel-etags-update-interval 3)
(before was 1 sec) and wrote the file and saved it
After a while, there were no more logs..(even the counsel-etags-virtual-update-tag log)
and it still jump to line 7, which should be line 10.
BTW emacs version
➜ proj1 emacs --version
GNU Emacs 26.3
Copyright (C) 2019 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
OS Ubuntu18.04 LTS
Try my emacs.d
.