I have create this little helper to easy jump to my last used git projects, I using magit-status-internal
to open a status buffer and I set magit-display-buffer-function
so that the status is open in a full
frame, that works but I don't want the change to affect other magit calls should I just set magit-display-buffer-function
to its previous value after the call to magit-status-internal or is there a better way to archive that.
(defun git-repository-p (d)
(file-exists-p (concat d "/.git/config")))
(defun find-git-repository (d)
(if (equal (file-name-directory (directory-file-name d)) d)
nil
(if (git-repository-p d)
d
(find-git-repository (file-name-directory (directory-file-name d))))))
(defvar recentf-list)
(defun counsel-recentp ()
(interactive)
(require 'recentf)
(recentf-mode)
(ivy-read "Recentp: " (delq nil (delete-dups (mapcar #'find-git-repository recentf-list)))
:action (lambda (f)
(with-ivy-window
(setq magit-display-buffer-function 'magit-display-buffer-fullframe-status-v1)
(magit-status-internal f)))
:caller 'counsel-recentp))