diff --git a/README.md b/README.md index 1ec3349..9f3235c 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,9 @@ Installation alternatives: ## Usage -Visit a git-controlled file and issue `M-x git-timemachine` (or -bind it to a keybinding of your choice). +Visit a git-controlled file and issue `M-x git-timemachine` (or bind +it to a keybinding of your choice). If you just need to toggle the +time machine you can use `M-x git-timemachine-toggle`. Use the following keys to navigate historic version of the file - `p` Visit previous historic version diff --git a/git-timemachine.el b/git-timemachine.el index a5c8040..12b8e10 100755 --- a/git-timemachine.el +++ b/git-timemachine.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2014 Peter Stiernström ;; Author: Peter Stiernström -;; Version: 2.1 +;; Version: 2.2 ;; URL: https://github.com/pidu/git-timemachine ;; Keywords: git @@ -161,6 +161,14 @@ Call with the value of 'buffer-file-name." (unless (vc-git-registered file) (error "This file is not git tracked"))) +;;;###autoload +(defun git-timemachine-toggle () + "Toggle git timemachine mode" + (interactive) + (if (bound-and-true-p git-timemachine-mode) + (git-timemachine-quit) + (git-timemachine))) + ;;;###autoload (defun git-timemachine () "Enable git timemachine for file of current buffer."