Don't descend below top level Git directory When finding files in Emacs, make the ‘default-directory’ the directory in which ‘.git’ resides. This is useful when building a project requires you to be in the top level directory of the repository.
1 files changed, 8 insertions(+), 0 deletions(-) M pkgs/emacs/.emacs.d/init.el
M pkgs/emacs/.emacs.d/init.el => pkgs/emacs/.emacs.d/init.el +8 -0
@@ 43,6 43,14 @@ (shell-command "setxkbmap -option ctrl:nocaps") (defun greg/cd-toplevel () (interactive) (letrec ((cmd "git rev-parse --show-toplevel") (dir (string-remove-suffix "\n" (shell-command-to-string cmd)))) (when (file-exists-p dir) (cd dir)))) (add-hook 'find-file-hook #'greg/cd-toplevel) (use-package eww :config (setq browse-url-browser-function #'eww) :bind ("C-c e" . #'eww))