Skip to content

Commit

Permalink
Added git-timemachine-toggle per request #27.
Browse files Browse the repository at this point in the history
And bumped version.
  • Loading branch information
pidu committed Mar 31, 2015
1 parent b3ae821 commit 058711c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion git-timemachine.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Copyright (C) 2014 Peter Stiernström

;; Author: Peter Stiernström <[email protected]>
;; Version: 2.1
;; Version: 2.2
;; URL: https://github.com/pidu/git-timemachine
;; Keywords: git

Expand Down Expand Up @@ -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."
Expand Down

0 comments on commit 058711c

Please sign in to comment.