[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit d035386e96 6/9: magit-ediff-buffers: Support me
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit d035386e96 6/9: magit-ediff-buffers: Support merge jobs |
Date: |
Mon, 16 May 2022 16:58:17 -0400 (EDT) |
branch: elpa/git-commit
commit d035386e960e0f3967096855d2a4e390cf2c8511
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
magit-ediff-buffers: Support merge jobs
---
lisp/magit-ediff.el | 39 +++++++++++++++++++++++++++++++++++----
1 file changed, 35 insertions(+), 4 deletions(-)
diff --git a/lisp/magit-ediff.el b/lisp/magit-ediff.el
index 8fb98c4082..a3bf6c477b 100644
--- a/lisp/magit-ediff.el
+++ b/lisp/magit-ediff.el
@@ -123,7 +123,23 @@ recommend you do not further complicate that by enabling
this.")
("r" "Show range" magit-ediff-compare)
("z" "Show stash" magit-ediff-show-stash)]])
-(defmacro magit-ediff-buffers (a b &optional c setup quit)
+(defmacro magit-ediff-buffers (a b &optional c setup quit file)
+ "Run Ediff on two or three buffers.
+This is a wrapper around `ediff-buffers-internal'.
+
+A, B and C have the form (GET-BUFFER CREATE-BUFFER). It
+GET-BUFFER returns a non-nil, then that buffer is used and
+it is not killed when exiting Ediff. Otherwise CREATE-BUFFER
+must return a buffer and that is killed when exiting Ediff.
+
+If non-nil, SETUP must be a function. It is called without
+arguments after Ediff is done setting up buffers.
+
+If non-nil, QUIT must be a function. It is added to
+`ediff-quit-hook' and is called without arguments.
+
+If FILE is non-nil, then perform a merge. The merge result
+is put in FILE."
(let (get make kill (char ?A))
(dolist (spec (list a b c))
(if (not spec)
@@ -145,8 +161,12 @@ recommend you do not further complicate that by enabling
this.")
,m)
make)
(push `(unless ,b
- (ediff-kill-buffer-carefully
- ,(intern (format "ediff-buffer-%c" char))))
+ ;; For merge jobs Ediff switches buffer names around.
+ ;; See (if ediff-merge-job ...) in `ediff-setup'.
+ (let ((var ,(if (and file (= char ?C))
+ 'ediff-ancestor-buffer
+ (intern (format "ediff-buffer-%c" char)))))
+ (ediff-kill-buffer-carefully var)))
kill))
(cl-incf char))))
(setq get (nreverse get))
@@ -154,18 +174,29 @@ recommend you do not further complicate that by enabling
this.")
(setq kill (nreverse kill))
`(magit-with-toplevel
(let ((conf (current-window-configuration))
+ (file ,file)
,@get)
(ediff-buffers-internal
,@make
(list ,@(and setup (list setup))
(lambda ()
+ ;; We do not want to kill buffers that existed before
+ ;; Ediff was invoked, so we cannot use Ediff's default
+ ;; quit functions. Ediff splits quitting across two
+ ;; hooks for merge jobs but we only ever use one.
+ (setq-local ediff-quit-merge-hook nil)
(setq-local ediff-quit-hook
(list ,@(and quit (list quit))
(lambda ()
,@kill
(let ((magit-ediff-previous-winconf
conf))
(run-hooks
'magit-ediff-quit-hook)))))))
- ,(if c 'ediff-buffers3 'ediff-buffers))))))
+ (pcase (list ,(and c t) (and file t))
+ ('(nil nil) 'ediff-buffers)
+ ('(nil t) 'ediff-merge-buffers)
+ ('(t nil) 'ediff-buffers3)
+ ('(t t) 'ediff-merge-buffers-with-ancestor))
+ file)))))
;;;###autoload
(defun magit-ediff-resolve-rest (file)
- [nongnu] elpa/git-commit updated (421105ef4f -> 5a7519fd3d), ELPA Syncer, 2022/05/16
- [nongnu] elpa/git-commit 1e2b473f20 3/9: magit-ediff-resolve: Rename to magit-ediff-resolve-rest, ELPA Syncer, 2022/05/16
- [nongnu] elpa/git-commit d035386e96 6/9: magit-ediff-buffers: Support merge jobs,
ELPA Syncer <=
- [nongnu] elpa/git-commit 5a7519fd3d 9/9: magit-ediff-dwim-resolve-function: New option, ELPA Syncer, 2022/05/16
- [nongnu] elpa/git-commit ce45c43f9d 2/9: magit-ediff-resolve: Move definition, ELPA Syncer, 2022/05/16
- [nongnu] elpa/git-commit efb09e8d57 1/9: magit-renamed-files: Minor tweaks, ELPA Syncer, 2022/05/16
- [nongnu] elpa/git-commit db2e9546f8 5/9: magit-ediff-buffers: Change argument order, ELPA Syncer, 2022/05/16
- [nongnu] elpa/git-commit 46685b1c76 7/9: magit-ediff-resolve-all: New command, ELPA Syncer, 2022/05/16
- [nongnu] elpa/git-commit 6fc4bacdee 8/9: magit-ediff-resolve-{all, rest}: Use file at point, ELPA Syncer, 2022/05/16
- [nongnu] elpa/git-commit e2e90f7b0c 4/9: magit-ediff-buffers: Cosmetics and new comments, ELPA Syncer, 2022/05/16