From 944001ce94ed57b3fc84d6f7b2c83bf0c101f3fa Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Wed, 17 Oct 2012 23:46:31 +0200 Subject: Add unregister command to emacs interface * emacs/gitto.el (gitto-registered-p): New function. (gitto-unregister): New command (gitto-register): Add docstring. --- emacs/gitto.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/emacs/gitto.el b/emacs/gitto.el index 996ba7f..cddb2ac 100644 --- a/emacs/gitto.el +++ b/emacs/gitto.el @@ -39,13 +39,30 @@ :group 'gitto :type 'string) +;;;###autoload +(defun gitto-registered-p (dir) + "Check if DIR is a registered repository." + (not (string-match-p "not registered" + (shell-command-to-string + (concat gitto-program " -c " dir))))) + ;;;###autoload (defun gitto-register (dir) + "Register DIR with gitto." (interactive (list (locate-dominating-file (buffer-file-name) ".git"))) (unless dir (error "Not a git repository.")) (shell-command (concat gitto-program " -r " dir))) +;;;###autoload +(defun gitto-unregister (dir) + "Unregister DIR with gitto." + (interactive (list (locate-dominating-file (buffer-file-name) ".git"))) + (unless (and dir (gitto-registered-p dir)) + (error "Not a registered git repository.")) + + (shell-command (concat gitto-program " -R " dir))) + (provide 'gitto) ;;; gitto.el ends here -- cgit v1.2.3-54-g00ecf