This project is obsolete. You could consider using counsel-etags instead. counsel-etags
is more powerful and easier to setup.
Create TAGS by combining Find and Ctags on Windows/Linux/OSX.
- Enough tools provided. You can set up any project in 1 minute
- The TAGS file created is portable. You can use it anywhere
- Easy to manage. All your projects settings is in your “.emacs”
- Powerful and versatile. Power of Find/Ctags/Lisp is at your hand
Place find-and-ctags.el somewhere (say ~/.emacs/lisp), add below code into “.emacs”:
(add-to-list 'load-path "~/.emacs.d/lisp/")
(require 'find-and-ctags)
Here is sample setup for project named “MYPROJ”:
(defun my-setup-develop-environment ()
(interactive)
(if (find-and-ctags-current-path-match-pattern-p "/MYPROJ")
(visit-tags-table (find-and-ctags-generate-tags "~/workspace/MYPROJ" ; project directory
'(("-not -size +64k" "--exclude=*.min.js") ; (find-opts ctags-opts)
;; you may add more find-opts ctags-opts pair HERE to run find&ctags again to APPEND to same TAGS file
;; ctags-opts must contain "-a" to append
;; (find-opts "-a")
))
t)))
(add-hook 'prog-mode-hook 'my-setup-develop-environment) ; prog-mode require emacs24+
(add-hook 'lua-mode-hook 'my-setup-develop-environment) ; lua-mode does NOT inherit from prog-mode
;; OPTIONAL
(add-hook 'after-save-hook 'find-and-ctags-auto-update-tags)
In above setup, TAGS is updated automatically every 5 minutes. But you can alway manually update the TAGS by M-x find-and-ctags-update-all-tags-force
.
find-and-ctags-run-ctags-if-needed
actually only execute the below command line in shell:
find . -type f -not -name 'TAGS' find-opts | ctags -e ctags-opts -L -
So you can insert extra command chain into find-opts.
For example, if you assign find-opts to ” | grep ‘test.*’”, the actual command to execute will be:
find . -type f -not -name 'TAGS' | grep 'test.*' | ctags -e ctags-opts -L -
Use API find-and-ctags-get-hostname
;; I do Javascript/HTML/Java in office and C++ at home.
;; My home PC hostname is like `AU0247589'
(if (string-match "^HOMEPC.*" (find-and-ctags-get-hostname))
(setq my-default-ctags-options "--I IMPLEMENT_ABSTRACT_CLASS"))
(setq find-and-ctags-auto-update-tags-interval 300) ; 300 seconds
Google “filetype:ctags site:github.com”. Here is mine.
You may need configure environment variable “HOME” on Windows because ctags looks for “%HOME%/.ctags” by default.
Check https://github.com/redguardtoo/find-and-ctags.
Copyright (C) 2015 Chen Bin
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.