Skip to content

Instantly share code, notes, and snippets.

@signalpillar
Created January 1, 2015 19:13
Show Gist options
  • Select an option

  • Save signalpillar/49fe83b16644de5fff7d to your computer and use it in GitHub Desktop.

Select an option

Save signalpillar/49fe83b16644de5fff7d to your computer and use it in GitHub Desktop.
(defun rebuild-python-tags ()
"Rebuild TAGS for the current projectile project and chosen venv.
Dependencies: projectile, elpy, etags (shell command)."
(interactive)
(call-interactively 'pyvenv-workon)
(let ((python-files-locations (list (projectile-project-root) pyvenv-virtual-env))
(output-file-path (concat (projectile-project-root) "TAGS")))
(message (format "Remove initial TAGS file: %s" output-file-path))
(shell-command (format "rm %s| true" output-file-path))
(loop for base-dir in python-files-locations collect
(let ((cmd (format
"find %s -type f -name '*.py' | xargs etags --append --language=python --output=%s"
base-dir output-file-path)))
(message cmd)
(shell-command cmd)))
(message "Regenerated %s!" output-file-path)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment