[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/add-vdiff 8a3dff3 254/258: vdiff-magit: Add vdiff-magit-s
From: |
Justin Burkett |
Subject: |
[elpa] scratch/add-vdiff 8a3dff3 254/258: vdiff-magit: Add vdiff-magit-stage-is-2way |
Date: |
Wed, 17 May 2017 08:14:03 -0400 (EDT) |
branch: scratch/add-vdiff
commit 8a3dff304e71c6e13a5ff9451e4e7a13b72b18f7
Author: Justin Burkett <address@hidden>
Commit: Justin Burkett <address@hidden>
vdiff-magit: Add vdiff-magit-stage-is-2way
New option to make vdiff-magit-stage use two buffers (file and index)
instead of
three.
Fixes #15
---
vdiff-magit.el | 78 ++++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 51 insertions(+), 27 deletions(-)
diff --git a/vdiff-magit.el b/vdiff-magit.el
index 5743f17..10316ff 100644
--- a/vdiff-magit.el
+++ b/vdiff-magit.el
@@ -85,6 +85,12 @@ merges."
:group 'vdiff-magit
:type 'boolean)
+(defcustom vdiff-magit-stage-is-2way nil
+ "If non-nil `vdiff-magit-stage' will only show two buffers, the
+file and the index with the HEAD omitted."
+ :group 'vdiff-magit
+ :type 'boolean)
+
;; (defvar magit-ediff-previous-winconf nil)
;;;###autoload (autoload 'vdiff-magit-popup "vdiff-magit" nil t)
@@ -129,34 +135,52 @@ FILE has to be relative to the top directory of the
repository."
(magit-tracked-files) nil nil nil
(magit-current-file))))
(magit-with-toplevel
- (let* ((bufC (get-file-buffer file))
- (fileBufC (or bufC (find-file-noselect file)))
+ (let* ((buf-a (or (magit-get-revision-buffer "HEAD" file)
+ (magit-find-file-noselect "HEAD" file)))
+ (buf-b (with-current-buffer (magit-find-file-index-noselect file t)
+ (setq buffer-read-only nil)
+ (current-buffer)))
+ (buf-c (get-file-buffer file))
+ (file-buf-c (or buf-c (find-file-noselect file)))
(coding-system-for-read
- (with-current-buffer fileBufC buffer-file-coding-system)))
- (vdiff-buffers3
- (or (magit-get-revision-buffer "HEAD" file)
- (magit-find-file-noselect "HEAD" file))
- (with-current-buffer (magit-find-file-index-noselect file t)
- (setq buffer-read-only nil)
- (current-buffer))
- fileBufC
- `(lambda (buf-a buf-b buf-c)
- (when (and (buffer-live-p buf-b)
- (buffer-modified-p buf-b))
- (with-current-buffer buf-b
- (magit-update-index))
- (kill-buffer buf-b))
- (when (and (buffer-live-p buf-c)
- (buffer-modified-p buf-c))
- (with-current-buffer buf-c
- (when (y-or-n-p
- (format "Save file %s? " buffer-file-name))
- (save-buffer))))
- ;; kill buf-c if it wasn't open originally
- (unless ,bufC (kill-buffer buf-c))
- (when (buffer-live-p buf-a)
- (kill-buffer buf-a)))
- t nil))))
+ (with-current-buffer file-buf-c buffer-file-coding-system)))
+ (if vdiff-magit-stage-is-2way
+ (vdiff-buffers
+ buf-b file-buf-c nil
+ `(lambda (buf-b buf-c)
+ (when (and (buffer-live-p buf-b)
+ (buffer-modified-p buf-b))
+ (with-current-buffer buf-b
+ (magit-update-index))
+ (kill-buffer buf-b))
+ (when (and (buffer-live-p buf-c)
+ (buffer-modified-p buf-c))
+ (with-current-buffer buf-c
+ (when (y-or-n-p
+ (format "Save file %s? " buffer-file-name))
+ (save-buffer))))
+ ;; kill buf-c if it wasn't open originally
+ (unless ,buf-c (kill-buffer buf-c)))
+ t nil)
+ (vdiff-buffers3
+ buf-a buf-b file-buf-c
+ `(lambda (buf-a buf-b buf-c)
+ (when (and (buffer-live-p buf-b)
+ (buffer-modified-p buf-b))
+ (with-current-buffer buf-b
+ (magit-update-index))
+ (kill-buffer buf-b))
+ (when (and (buffer-live-p buf-c)
+ (buffer-modified-p buf-c))
+ (with-current-buffer buf-c
+ (when (y-or-n-p
+ (format "Save file %s? " buffer-file-name))
+ (save-buffer))))
+ ;; kill buf-c if it wasn't open originally
+ (unless ,buf-c (kill-buffer buf-c))
+ (when (buffer-live-p buf-a)
+ (kill-buffer buf-a)))
+ t nil)))))
;; ;;;###autoload
(defun vdiff-magit-compare (revA revB fileA fileB)
- [elpa] scratch/add-vdiff 697bb79 060/258: Prefer last element of multiple in line map, (continued)
- [elpa] scratch/add-vdiff 697bb79 060/258: Prefer last element of multiple in line map, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 3207365 064/258: Satisfy compiler, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 8b6cb54 218/258: vdiff-magit: Port resolve, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 617265b 238/258: vdiff-magit: Remove unused magit-ediff code, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 6f89757 231/258: vdiff-magit: Resurrect resolve, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 0f8dd15 239/258: vdiff: Improve a couple of docstrings, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff d8cfb8f 243/258: vdiff: Don't use scroll-lock-mode programmatically, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff bc5a9a8 242/258: vdiff-magit: Remove unnecessary local bindings, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff c32fe46 251/258: vdiff: Fix compiler warnings, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 875b0d5 252/258: README: Improve vdiff-magit-popup, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 8a3dff3 254/258: vdiff-magit: Add vdiff-magit-stage-is-2way,
Justin Burkett <=
- [elpa] scratch/add-vdiff 3a32c4e 255/258: README: Update, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff d4883de 256/258: vdiff-magit: Remove use of camel case names for consistency, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 819ea4b 258/258: Add 'packages/vdiff/' from commit 'f11c7c2eeef33a0b75fe4e025818e7e672c57397', Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 14abb75 078/258: Allow jumping to subtraction overlays, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff a15b0e5 084/258: Move point before closing fold, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 425d50b 085/258: Add vdiff-close-other-folds, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 6516112 075/258: Minor formatting, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 968047f 093/258: Change wording in a docstring, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff ad0e8c3 091/258: Make mirrored-commands private and rename, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 309e912 108/258: Refresh automatically on idle after change, Justin Burkett, 2017/05/17