[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/dired-git-info 64901c7 11/33: Show error if not in a repo
From: |
Clemens Radermacher |
Subject: |
[elpa] scratch/dired-git-info 64901c7 11/33: Show error if not in a repo |
Date: |
Sun, 17 Feb 2019 13:03:29 -0500 (EST) |
branch: scratch/dired-git-info
commit 64901c7eb2876c06f399dcd3df88d745de058bd1
Author: Clemens Radermacher <address@hidden>
Commit: Clemens Radermacher <address@hidden>
Show error if not in a repo
---
dired-git-info.el | 36 +++++++++++++++++++-----------------
1 file changed, 19 insertions(+), 17 deletions(-)
diff --git a/dired-git-info.el b/dired-git-info.el
index 4c5bf32..5b801d1 100644
--- a/dired-git-info.el
+++ b/dired-git-info.el
@@ -257,7 +257,8 @@ git-log PRETTY FORMATS):
FILE default to current dired file. GITF determines the commit
info format and defaults to `dgi-commit-message-format'."
- (when (locate-dominating-file "." ".git")
+ (if (not (locate-dominating-file "." ".git"))
+ (user-error "Not inside a git repo")
(let* ((file (or file (dired-get-file-for-visit)))
(lfile (and file
;; get the actual displayed name, to make it work with
@@ -271,7 +272,7 @@ info format and defaults to `dgi-commit-message-format'."
"git" "log" "-1"
(concat "--pretty="
(or gitf dgi-commit-message-format))
- lfile)))
+ lfile)))
(when (and msg (not (string= "" msg)))
(substring msg
;; skip newline
@@ -281,15 +282,15 @@ info format and defaults to `dgi-commit-message-format'."
"Execute BODY and restore marks afterwards."
`(let ((marked (save-excursion
(goto-char (point-min))
- (dired-get-marked-files))))
+ (dired-get-marked-files)))
+ (inhibit-message t))
(save-excursion
(unwind-protect
(progn ,@body)
- (let ((inhibit-message t))
- (dired-unmark-all-marks)
+ (dired-unmark-all-marks)
(dolist (file marked)
(dired-goto-file file)
- (dired-mark 1)))))))
+ (dired-mark 1))))))
(defun dgi--cleanup ()
(dolist (ov dgi--commit-ovs)
@@ -316,17 +317,18 @@ info format and defaults to `dgi-commit-message-format'."
(dolist (file files (nreverse messages))
(push (dgi--get-commit-info file)
messages)))
- (with-current-buffer (get-buffer-create " *temp*")
- (erase-buffer)
- (dolist (message messages)
- (insert (or message "") "\n"))
- (align-regexp (point-min)
- (point-max)
- "\\(\\s-*\\)\t" nil nil t)
- (goto-char (point-min))
- (while (search-forward "\t" nil t)
- (replace-match " "))
- (split-string (buffer-string) "\n"))))
+ (with-current-buffer (get-buffer-create " *dired-git-info*")
+ (let ((inhibit-read-only nil))
+ (erase-buffer)
+ (dolist (message messages)
+ (insert (or message "") "\n"))
+ (align-regexp (point-min)
+ (point-max)
+ "\\(\\s-*\\)\t" nil nil t)
+ (goto-char (point-min))
+ (while (search-forward "\t" nil t)
+ (replace-match " "))
+ (split-string (buffer-string) "\n")))))
;;;###autoload
- [elpa] branch scratch/dired-git-info created (now cd60dd4), Clemens Radermacher, 2019/02/17
- [elpa] scratch/dired-git-info fb1b475 02/33: Rename internal symbols accord. to elisp conventions, Clemens Radermacher, 2019/02/17
- [elpa] scratch/dired-git-info 19d9570 04/33: Fix macro name, Clemens Radermacher, 2019/02/17
- [elpa] scratch/dired-git-info 64901c7 11/33: Show error if not in a repo,
Clemens Radermacher <=
- [elpa] scratch/dired-git-info 2374729 06/33: Update config instructions, Clemens Radermacher, 2019/02/17
- [elpa] scratch/dired-git-info 03c1711 19/33: Fixes according to checkdoc, Clemens Radermacher, 2019/02/17
- [elpa] scratch/dired-git-info 2d57f89 12/33: Check for non existing files, Clemens Radermacher, 2019/02/17
- [elpa] scratch/dired-git-info e4090fa 01/33: Initial commit, Clemens Radermacher, 2019/02/17
- [elpa] scratch/dired-git-info 23b3d1e 18/33: Improve auto hide details, Clemens Radermacher, 2019/02/17
- [elpa] scratch/dired-git-info f7b5920 26/33: Improve dgi--get-commit-messages, Clemens Radermacher, 2019/02/17
- [elpa] scratch/dired-git-info 2e986ce 25/33: Allow command to run for dired derived modes, as well, Clemens Radermacher, 2019/02/17
- [elpa] scratch/dired-git-info 11a6cce 05/33: Update install instructions, Clemens Radermacher, 2019/02/17
- [elpa] scratch/dired-git-info 7803b82 16/33: Only mention some common options for message format docstring, Clemens Radermacher, 2019/02/17
- [elpa] scratch/dired-git-info f2117c8 28/33: Add .gitignore, Clemens Radermacher, 2019/02/17