[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/dired-git-info d8b777d 31/33: Cleanup
From: |
Clemens Radermacher |
Subject: |
[elpa] scratch/dired-git-info d8b777d 31/33: Cleanup |
Date: |
Sun, 17 Feb 2019 13:03:32 -0500 (EST) |
branch: scratch/dired-git-info
commit d8b777d9290070cbd7875bf0d82eb5ffd60598cd
Author: Clemens Radermacher <address@hidden>
Commit: Clemens Radermacher <address@hidden>
Cleanup
---
README.org | 6 ++---
dired-git-info.el | 77 +++++++++++++++++++++++++++----------------------------
2 files changed, 41 insertions(+), 42 deletions(-)
diff --git a/README.org b/README.org
index 9f2386c..6dbbff5 100644
--- a/README.org
+++ b/README.org
@@ -1,7 +1,7 @@
* Description
-This Emacs packages provides a command to show git information inside the
-dired buffer:
+This Emacs packages provides a minor mode which shows git information inside
+the dired buffer:
[[./images/screenshot2.png]]
@@ -15,7 +15,7 @@ For manual installation, clone the repository and call:
* Config
-Bind the minor mode command in direds mode map:
+Bind the minor mode command in dired:
#+BEGIN_SRC elisp
(with-eval-after-load 'dired
diff --git a/dired-git-info.el b/dired-git-info.el
index 40b0de9..7ae2a89 100644
--- a/dired-git-info.el
+++ b/dired-git-info.el
@@ -23,8 +23,8 @@
;;; Commentary:
;;
-;; Command to show last commit message and date (info shown is configurable)
-;; of git project files in dired.
+;; Minor mode which shows last commit message and date (info shown is
+;; configurable) for git project files in dired.
;;
;;; Code:
@@ -178,43 +178,42 @@ info format and defaults to `dgi-commit-message-format'."
(define-minor-mode dired-git-info-mode
"Toggle git message info in current dired buffer."
:lighter " dgi"
- (cond (dired-git-info-mode
- (unless (derived-mode-p 'dired-mode)
- (user-error "Not in a dired buffer"))
- (unless (locate-dominating-file "." ".git")
- (user-error "Not inside a git repository"))
- (let* ((files (dgi--save-marked
- (dired-unmark-all-marks)
- (dired-toggle-marks)
- (dired-get-marked-files)))
- (minspc (1+ (apply #'max (dgi--get-dired-files-length
files))))
- (messages (dgi--get-commit-messages files)))
- (save-excursion
- (dolist (file files)
- (let ((msg (pop messages)))
- (when msg
- (dired-goto-file file)
- (let ((spc (make-string
- (- minspc (dgi--get-dired-file-length file))
- ?\s)))
- (goto-char (line-end-position))
- (let ((ov (make-overlay (point) (1+ (point))))
- (ovs (concat spc
- (propertize
- msg 'face 'dgi-commit-message-face)
- "\n")))
- (push ov dgi--commit-ovs)
- ;; I don't use after-string because I didn't get it to
work
- ;; in combination with hl-line-mode overlay
- (overlay-put ov 'display ovs)
- ;; hl line mode should have priority
- (overlay-put ov 'priority -60)))))))
- (when dgi-auto-hide-details-p
- (unless dired-hide-details-mode
- (setq dgi--restore-no-details t)
- (dired-hide-details-mode 1)))))
- (t
- (dgi--cleanup))))
+ (if (not dired-git-info-mode)
+ (dgi--cleanup)
+ (unless (derived-mode-p 'dired-mode)
+ (user-error "Not in a dired buffer"))
+ (unless (locate-dominating-file "." ".git")
+ (user-error "Not inside a git repository"))
+ (let* ((files (dgi--save-marked
+ (dired-unmark-all-marks)
+ (dired-toggle-marks)
+ (dired-get-marked-files)))
+ (minspc (1+ (apply #'max (dgi--get-dired-files-length files))))
+ (messages (dgi--get-commit-messages files)))
+ (save-excursion
+ (dolist (file files)
+ (let ((msg (pop messages)))
+ (when msg
+ (dired-goto-file file)
+ (let ((spc (make-string
+ (- minspc (dgi--get-dired-file-length file))
+ ?\s)))
+ (goto-char (line-end-position))
+ (let ((ov (make-overlay (point) (1+ (point))))
+ (ovs (concat spc
+ (propertize
+ msg 'face 'dgi-commit-message-face)
+ "\n")))
+ (push ov dgi--commit-ovs)
+ ;; I don't use after-string because I didn't get it to work
+ ;; in combination with hl-line-mode overlay
+ (overlay-put ov 'display ovs)
+ ;; hl line mode should have priority
+ (overlay-put ov 'priority -60)))))))
+ (when dgi-auto-hide-details-p
+ (unless dired-hide-details-mode
+ (setq dgi--restore-no-details t)
+ (dired-hide-details-mode 1))))))
(provide 'dired-git-info)
- [elpa] scratch/dired-git-info f539ba5 08/33: Align message parts of commit messages, (continued)
- [elpa] scratch/dired-git-info f539ba5 08/33: Align message parts of commit messages, Clemens Radermacher, 2019/02/17
- [elpa] scratch/dired-git-info 8afe378 09/33: Update docstring for message format, Clemens Radermacher, 2019/02/17
- [elpa] scratch/dired-git-info f9f8ab5 17/33: Cleanup, Clemens Radermacher, 2019/02/17
- [elpa] scratch/dired-git-info 0f7625c 14/33: Make overlays buffer local, to allow multiple dired buffers, Clemens Radermacher, 2019/02/17
- [elpa] scratch/dired-git-info aa8248a 21/33: Use temp buffer, Clemens Radermacher, 2019/02/17
- [elpa] scratch/dired-git-info c8e3b2e 13/33: Add docstrings, Clemens Radermacher, 2019/02/17
- [elpa] scratch/dired-git-info 95688b3 20/33: Add group, keywords and make options customizeable, Clemens Radermacher, 2019/02/17
- [elpa] scratch/dired-git-info 4f6d0ca 24/33: Boolean vars shouldn't have a -p suffix, Clemens Radermacher, 2019/02/17
- [elpa] scratch/dired-git-info 6115ae1 03/33: Fix package name in comment, Clemens Radermacher, 2019/02/17
- [elpa] scratch/dired-git-info 740e1cf 27/33: Fix copyright, Clemens Radermacher, 2019/02/17
- [elpa] scratch/dired-git-info d8b777d 31/33: Cleanup,
Clemens Radermacher <=