This repository was archived by the owner on Oct 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgit-gutter-plus-refresh-on-magit-commit.el
More file actions
67 lines (59 loc) · 2.58 KB
/
git-gutter-plus-refresh-on-magit-commit.el
File metadata and controls
67 lines (59 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
;;; git-gutter-plus-refresh-on-magit-commit.el --- Refresh git-gutter+ on open-buffers after interactive magit-commit -*- lexical-binding: t; -*-
;;
;;; Copyright (C) 2018 Free Software Foundation, Inc.
;;
;; Author: Eric Crosson <eric.s.crosson@utexas.com>
;; Version: 1.0.2
;; Keywords: convenience
;; URL: https://github.com/EricCrosson/git-gutter-plus-refresh-on-magit-commit
;; Package-Requires: ((emacs "24") (projectile "1.0.0") (magit "2.1.0") (git-gutter+ "0.4"))
;;
;; This file is not a part of GNU Emacs.
;;
;;
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;;
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;
;;
;;; Commentary:
;;
;; This package provides a hack to refresh git-gutter+ in open
;; project-buffers after an interactive commit via magit.
;;
;; This behavior appears to have been supported by git-gutter+ at some
;; time, but the project has not seen active development in some time and it is possible
;; that a more-recent version of magit broke this functionality.
;;
;; As such, this code does not belong here but rather pushed upstream.
;; It is my intent to push this code upstream after some additional
;; optimizations are derived for performance.
;;
;; Thanks for your understanding, patience and help making it so!
;;; Code:
;;;###autoload
(defun git-gutter+-refresh-all-saved-buffers ()
"Refresh git-gutter+ on open project-buffers.
This function is called automatically by `git-commit-post-finish-hook'."
(interactive)
(let ((project-files (projectile-current-project-files)))
(dolist (file-to-refresh project-files)
(let ((buffer (get-file-buffer (concat (projectile-project-root) file-to-refresh))))
(when buffer
(message "Refreshing git-gutter+ in buffer '%s'" buffer)
(with-current-buffer buffer
(git-gutter+-refresh)))))))
(add-hook 'git-commit-post-finish-hook 'git-gutter+-refresh-all-saved-buffers)
(provide 'git-gutter-plus-refresh-on-magit-commit)
;;; git-gutter-plus-refresh-on-magit-commit.el ends here