Add unregister command to emacs interface

* emacs/gitto.el (gitto-registered-p): New function.
  (gitto-unregister): New command
  (gitto-register): Add docstring.
This commit is contained in:
Tom Willemsen 2012-10-17 23:46:31 +02:00
parent 8e71888602
commit 944001ce94

View file

@ -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