This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun con-cat/get-python-path (root-in-project) | |
"Return a list of parts of the path to a Python file or object. | |
root-in-project is the optional path to a directory inside the project that the path should be relative to, | |
e.g. 'src' if your project is in ~/myproject and your Python files are in ~/myproject/src" | |
(unless (and (projectile-project-root) buffer-file-name (string= "py" (file-name-extension buffer-file-name))) | |
(user-error "Buffer isn't visiting a Python file in a Projectile project.")) | |
(let* | |
;; Get the path of the file relative to projectile-project-root and root-in-project | |
((file-path (file-relative-name buffer-file-name (expand-file-name root-in-project (projectile-project-root)))) |