From 5c9e8924fddf2bb8803f5fe650eff883fee4f652 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Thu, 31 Oct 2019 17:10:51 +0100 Subject: [PATCH] update git-timemachine --- .../git-timemachine-pkg.el | 2 - .../git-timemachine-autoloads.el | 12 ++--- .../git-timemachine-pkg.el | 2 + .../git-timemachine.el | 54 +++++++++++++------ 4 files changed, 43 insertions(+), 27 deletions(-) delete mode 100644 elpa/git-timemachine-20181204.1546/git-timemachine-pkg.el rename elpa/{git-timemachine-20181204.1546 => git-timemachine-20190730.849}/git-timemachine-autoloads.el (66%) create mode 100644 elpa/git-timemachine-20190730.849/git-timemachine-pkg.el rename elpa/{git-timemachine-20181204.1546 => git-timemachine-20190730.849}/git-timemachine.el (90%) diff --git a/elpa/git-timemachine-20181204.1546/git-timemachine-pkg.el b/elpa/git-timemachine-20181204.1546/git-timemachine-pkg.el deleted file mode 100644 index 8a4e1e0b..00000000 --- a/elpa/git-timemachine-20181204.1546/git-timemachine-pkg.el +++ /dev/null @@ -1,2 +0,0 @@ -;;; -*- no-byte-compile: t -*- -(define-package "git-timemachine" "20181204.1546" "Walk through git revisions of a file" '((emacs "24.3")) :commit "3a4a7f11af613090122d1d4bb8823eaeed93398f" :keywords '("git") :authors '(("Peter Stiernström" . "peter@stiernstrom.se")) :maintainer '("Peter Stiernström" . "peter@stiernstrom.se") :url "https://gitlab.com/pidu/git-timemachine") diff --git a/elpa/git-timemachine-20181204.1546/git-timemachine-autoloads.el b/elpa/git-timemachine-20190730.849/git-timemachine-autoloads.el similarity index 66% rename from elpa/git-timemachine-20181204.1546/git-timemachine-autoloads.el rename to elpa/git-timemachine-20190730.849/git-timemachine-autoloads.el index 0dce9972..eb4ad7b8 100644 --- a/elpa/git-timemachine-20181204.1546/git-timemachine-autoloads.el +++ b/elpa/git-timemachine-20190730.849/git-timemachine-autoloads.el @@ -1,13 +1,10 @@ ;;; git-timemachine-autoloads.el --- automatically extracted autoloads ;; ;;; Code: - -(add-to-list 'load-path (directory-file-name - (or (file-name-directory #$) (car load-path)))) - +(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path)))) -;;;### (autoloads nil "git-timemachine" "git-timemachine.el" (0 0 -;;;;;; 0 0)) +;;;### (autoloads nil "git-timemachine" "git-timemachine.el" (23994 +;;;;;; 46479 777399 176000)) ;;; Generated autoloads from git-timemachine.el (autoload 'git-timemachine-toggle "git-timemachine" "\ @@ -25,14 +22,11 @@ Enable git timemachine for current buffer, switching to GIT-BRANCH. \(fn GIT-BRANCH)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "git-timemachine" '("git-timemachine-"))) - ;;;*** ;; Local Variables: ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t -;; coding: utf-8 ;; End: ;;; git-timemachine-autoloads.el ends here diff --git a/elpa/git-timemachine-20190730.849/git-timemachine-pkg.el b/elpa/git-timemachine-20190730.849/git-timemachine-pkg.el new file mode 100644 index 00000000..697b3e7d --- /dev/null +++ b/elpa/git-timemachine-20190730.849/git-timemachine-pkg.el @@ -0,0 +1,2 @@ +;;; -*- no-byte-compile: t -*- +(define-package "git-timemachine" "20190730.849" "Walk through git revisions of a file" '((emacs "24.3") (transient "0.1.0")) :commit "391eb61050de321101e631fcf373fc70ec6e7700" :keywords '("vc") :authors '(("Peter Stiernström" . "peter@stiernstrom.se")) :maintainer '("Peter Stiernström" . "peter@stiernstrom.se") :url "https://gitlab.com/pidu/git-timemachine") diff --git a/elpa/git-timemachine-20181204.1546/git-timemachine.el b/elpa/git-timemachine-20190730.849/git-timemachine.el similarity index 90% rename from elpa/git-timemachine-20181204.1546/git-timemachine.el rename to elpa/git-timemachine-20190730.849/git-timemachine.el index 56ae06ac..196de283 100644 --- a/elpa/git-timemachine-20181204.1546/git-timemachine.el +++ b/elpa/git-timemachine-20190730.849/git-timemachine.el @@ -3,11 +3,11 @@ ;; Copyright (C) 2014 Peter Stiernström ;; Author: Peter Stiernström -;; Version: 4.8 -;; Package-Version: 20181204.1546 +;; Version: 4.11 +;; Package-Version: 20190730.849 ;; URL: https://gitlab.com/pidu/git-timemachine -;; Keywords: git -;; Package-Requires: ((emacs "24.3")) +;; Keywords: vc +;; Package-Requires: ((emacs "24.3") (transient "0.1.0")) ;; This file is not part of GNU Emacs @@ -33,6 +33,7 @@ (require 'vc-git) (require 'cl-lib) +(require 'transient) (defcustom git-timemachine-abbreviation-length 12 "Number of chars from the full sha1 hash to use for abbreviation." @@ -238,7 +239,13 @@ When passed a GIT-BRANCH, lists revisions from that branch." (setq git-timemachine-revision revision) (goto-char current-position) (when git-timemachine-show-minibuffer-details - (git-timemachine--show-minibuffer-details revision))))) + (git-timemachine--show-minibuffer-details revision)) + (git-timemachine--erm-workaround)))) + +(defun git-timemachine--erm-workaround () + "Workaround for enhanced ruby mode not detecting revision change." + (when (eq major-mode 'enh-ruby-mode) + (ignore-errors (erm-reset-buffer)))) (defun git-timemachine--show-minibuffer-details (revision) "Show details for REVISION in minibuffer." @@ -251,7 +258,9 @@ When passed a GIT-BRANCH, lists revisions from that branch." (propertize sha-or-subject 'face 'git-timemachine-minibuffer-detail-face) date-full date-relative))) (defun git-timemachine--find-new-current-line (curr-revision new-revision current-line) - "Return the new current line after a revision jump." + "Return the new current line after a revision jump. + +Given CURR-REVISION and NEW-REVISION determine if we need to updated CURRENT-LINE." (let* ((revisions (reverse (git-timemachine--revisions))) (current-commit (car curr-revision)) (curr-rev-number (+ (or (cl-position curr-revision revisions) 0) 1)) @@ -284,15 +293,13 @@ When passed a GIT-BRANCH, lists revisions from that branch." new-line)))) (defun git-timemachine--get-cursor-position () - "Return the cursor visual line number with respect to the -current window first line" + "Return the cursor visual line number with respect to the current window first line." (let* ((win-point-min (save-excursion (move-to-window-line 0) (point))) (cur-pos (count-screen-lines win-point-min (point)))) cur-pos)) (defun git-timemachine--set-cursor-position (POS) - "Set the cursor position to the POS visual line with -respect to the window first line" + "Set the cursor position to the POS visual line with respect to the window first line." (recenter POS)) (defun git-timemachine-abbreviate (revision) @@ -309,7 +316,7 @@ respect to the window first line" (switch-to-buffer parent-buffer nil t))))) (defun git-timemachine-blame () - "Call magit-blame on current revision." + "Call ‘magit-blame’ on current revision." (interactive) (if (fboundp 'magit-blame) (let ((magit-buffer-revision (car git-timemachine-revision))) @@ -334,12 +341,26 @@ respect to the window first line" "Show commit for current revision." (interactive) (let ((rev (car git-timemachine-revision))) - (if (fboundp 'magit-revision-mode) - (progn - (with-temp-buffer - (save-excursion (magit-mode-setup #'magit-revision-mode rev nil nil nil)))) + (if (fboundp 'magit-show-commit) + (magit-show-commit rev) (message "You need to install magit to show commit")))) +(define-transient-command git-timemachine-help () + "Show online help." + ["Navigate" + [("p" "show previous revision" git-timemachine-show-previous-revision) + ("n" "show next revision" git-timemachine-show-next-revision) + ("g" "show nth revision" git-timemachine-show-nth-revision) + ("t" "show fuzzy revision" git-timemachine-show-revision-fuzzy)]] + ["Kill current revision" + [("w" "kill abbreviated revision" git-timemachine-kill-abbreviated-revision) + ("W" "kill revision" git-timemachine-kill-revision)]] + ["Misc" + [("b" "blame current revision" git-timemachine-blame) + ("c" "show commit" git-timemachine-show-commit) + ("?" "show help" git-timemachine-help) + ("q" "quit" git-timemachine-quit)]]) + (define-minor-mode git-timemachine-mode "Git Timemachine, feel the wings of history." :init-value nil @@ -353,7 +374,8 @@ respect to the window first line" ("w" . git-timemachine-kill-abbreviated-revision) ("W" . git-timemachine-kill-revision) ("b" . git-timemachine-blame) - ("c" . git-timemachine-show-commit)) + ("c" . git-timemachine-show-commit) + ("?" . git-timemachine-help)) :group 'git-timemachine) (defun git-timemachine-validate (file) -- 2.47.3