emacs/08ctags.el
Maciej Szlosarczyk d3c2c17ff9
Improve ctags and company configuration
Set ctags command based on major mode
Set different company backends based on major mode
Completely abandon robe in favour of ctags for Ruby
Set up Erlang configuration
2019-04-08 11:23:36 +03:00

30 lines
1,010 B
EmacsLisp

;; Do not mix ctags between folders
(setq tags-add-tables nil)
;; Sentinel function for capturing ctags
(defun ctags-process-callback (process event)
"Show status of asynchronous ctags-process after it finishes."
(cond
((string-equal event "finished\n")
(message "Creating tag files...completed")
(kill-buffer (get-buffer "*ctags*"))
(visit-tags-table (format "%sTAGS" (projectile-project-root))))
(t
(message "Creating tags file...failed")
(pop-to-buffer (get-buffer "*ctags*"))
)))
(setq ctags-refresh-command
(format "ctags -e -R -f %sTAGS %s."
(projectile-project-root) (projectile-project-root)))
(defun refresh-ctags ()
"Refresh ctags according to currently set command."
(interactive)
(message "Starting ctags process")
(start-process-shell-command "ctags" "*ctags*" ctags-refresh-command)
(set-process-sentinel (get-process "ctags") 'ctags-process-callback))
;; Ctags bindings
(define-key prog-mode-map (kbd "C-c E") 'refresh-ctags)