 ;; Don't warn when TAGS files are large
 (setq large-file-warning-threshold nil)
 
+;; List all directories from which you want to read the TAGS files
+(setq tags-table-list '("~/.emacs.d"))
+
+(if (boundp 'setup-sos-loaded)
+    (add-to-list 'tags-table-list project-root t))
 
 (defun build-ctags ()
   (interactive)
-  (message "building .emacs.d tags")
-  (shell-command (concat "ctags -Re -f " user-emacs-directory "/TAGS " user-emacs-directory "/"))
-  (when (boundp 'setup-sos-loaded)
-    (message "building project tags")
-    (shell-command (concat "ctags -Re -f " project-root "TAGS " project-root)))
-  (update-ctags)
+  (loop for dir in tags-table-list do
+        (message (concat "building tags in " dir))
+        (shell-command (concat "ctags -Re -f " dir "/TAGS " dir)))
   (message "tags built successfully"))
-
-;; Source: https://www.gnu.org/software/emacs/manual/html_node/emacs/Select-Tags-Table.html#Select-Tags-Table
-;; You cannot set both tags-file-name (that's what visit-tags-table does) and
-;; tags-table-list
-(defun update-ctags ()
-  (interactive)
-  (setq tags-file-name 'nil)
-  ;; List all directories from which you want to read the TAGS files
-  (if (boundp 'setup-sos-loaded)
-      (setq tags-table-list
-            `("~/.emacs.d"
-              ,project-root))
-    (setq tags-table-list
-          `("~/.emacs.d")))
-  (message "Updated tags-table-list."))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Time-stamp: <2014-03-08 16:13:14 kmodi>

;; ctags, etags



(setq setup-ctags-loaded t)
(provide 'setup-ctags)


;; NOTES

;; (1) Emacs reread the TAGS file during every tag find operation.
