diff options
author | Tom Willemsen | 2012-10-17 23:46:31 +0200 |
---|---|---|
committer | Tom Willemsen | 2012-10-17 23:46:31 +0200 |
commit | 944001ce94ed57b3fc84d6f7b2c83bf0c101f3fa (patch) | |
tree | 95017e69723d1002bcebe75f6eb9a8561569030a | |
parent | 8e7188860207ca03e16693a730a175372e8da899 (diff) | |
download | gitto-944001ce94ed57b3fc84d6f7b2c83bf0c101f3fa.tar.gz gitto-944001ce94ed57b3fc84d6f7b2c83bf0c101f3fa.zip |
Add unregister command to emacs interface
* emacs/gitto.el (gitto-registered-p): New function.
(gitto-unregister): New command
(gitto-register): Add docstring.
-rw-r--r-- | emacs/gitto.el | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/emacs/gitto.el b/emacs/gitto.el index 996ba7f..cddb2ac 100644 --- a/emacs/gitto.el +++ b/emacs/gitto.el @@ -40,12 +40,29 @@ :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 |