Browse Source

Fix project root find function

master
Riyyi 4 years ago
parent
commit
e2c1e562ca
  1. 17
      .config/emacs/config.org

17
.config/emacs/config.org

@ -238,8 +238,7 @@ Install and configure packages.
(use-package consult (use-package consult
:after selectrum :after selectrum
:config :config
(autoload 'projectile-project-root "projectile") (setq consult-project-root-function #'dot/find-project-root))
(setq consult-project-root-function #'projectile-project-root))
(use-package avy (use-package avy
:defer t) :defer t)
@ -1309,7 +1308,7 @@ Vim equivalence: >gv"
(defun neotree-toggle-in-project-root () (defun neotree-toggle-in-project-root ()
"Toggle Neotree in project root." "Toggle Neotree in project root."
(interactive) (interactive)
(let ((default-directory (projectile-project-root))) (let ((default-directory (dot/find-project-root)))
(call-interactively #'neotree-toggle))) (call-interactively #'neotree-toggle)))
#+END_SRC #+END_SRC
@ -1335,16 +1334,24 @@ If point is on:
*** Projectile Functions *** Projectile Functions
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun dot/find-project-root ()
"Return root of the project, determined by `.git/' and `.projectile',
`default-directory' otherwise."
(let ((search-directory (projectile-project-root)))
(if search-directory
search-directory
default-directory)))
(defun find-file-in-project-root () (defun find-file-in-project-root ()
"Find file in project root." "Find file in project root."
(interactive) (interactive)
(let ((default-directory (projectile-project-root))) (let ((default-directory (dot/find-project-root)))
(call-interactively 'find-file))) (call-interactively 'find-file)))
(defun compile-latex () (defun compile-latex ()
"Compile LaTeX project." "Compile LaTeX project."
(interactive) (interactive)
(let ((default-directory (projectile-project-root))) (let ((default-directory (dot/find-project-root)))
(projectile-save-project-buffers) (projectile-save-project-buffers)
(shell-command "make"))) (shell-command "make")))
#+END_SRC #+END_SRC

Loading…
Cancel
Save