From unknown Wed Jun 18 00:21:17 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#25493 <25493@debbugs.gnu.org> To: bug#25493 <25493@debbugs.gnu.org> Subject: Status: 26.0.50; ediff merge should (optionally) show ancestor in fourth window Reply-To: bug#25493 <25493@debbugs.gnu.org> Date: Wed, 18 Jun 2025 07:21:17 +0000 retitle 25493 26.0.50; ediff merge should (optionally) show ancestor in fou= rth window reassign 25493 emacs submitter 25493 Philipp Stephani severity 25493 wishlist thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 20 06:18:07 2017 Received: (at submit) by debbugs.gnu.org; 20 Jan 2017 11:18:07 +0000 Received: from localhost ([127.0.0.1]:36058 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cUXCp-0008WK-3w for submit@debbugs.gnu.org; Fri, 20 Jan 2017 06:18:07 -0500 Received: from eggs.gnu.org ([208.118.235.92]:34975) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cUXCn-0008Vq-DW for submit@debbugs.gnu.org; Fri, 20 Jan 2017 06:18:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cUXCg-0008NB-Ra for submit@debbugs.gnu.org; Fri, 20 Jan 2017 06:18:00 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=BAYES_50, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:38564) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cUXCg-0008N2-OB for submit@debbugs.gnu.org; Fri, 20 Jan 2017 06:17:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54178) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUXCb-0001Yw-U8 for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2017 06:17:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cUXCa-0008KP-Id for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2017 06:17:53 -0500 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]:38182) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cUXCa-0008IF-Av for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2017 06:17:52 -0500 Received: by mail-wm0-x235.google.com with SMTP id r144so38351167wme.1 for ; Fri, 20 Jan 2017 03:17:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=evIXEGIoiCsjxh4w89+ssRbGLf8SqgHz6V1WOVECFAg=; b=ji3AuR7fBPmn6q5S+h115rcSD9pCqNROE4OxpB/t+XLV64hUXMKwnEcsOOn5DpkFKT cuYAiyUay9/5/r5iPDT4LxGdnr+HcA8e3WfH8g1kBybw4VmOGnI7U1HYGFeqMj84bD2W Hcute9d/FN9RdfG9K7YID6HBtp6O4qOAdrd/w9LpFNDb06rsexX/rMi0srrHjJ4JRdPP eaQif3HBSdupv2qsrfITt8jv0iwRaokWFOuPmBddaVQyNS6AUytnFTnICq2g04aZA3so KDrFaVRXcSXvra5lWn0GzjSy008kmEZIPDgDpt1uKNdK1QFp19WsrE4IwnIXeJUe1H+A 69HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=evIXEGIoiCsjxh4w89+ssRbGLf8SqgHz6V1WOVECFAg=; b=MIa5tg9MkVZGhApPBhmUraIIdxi8oUXEltUmYfNdLwK2lddlY4MftGOWrebXiczpX1 MSYrcPxPeTWDq5BbcrPa4uZQTCE3u64pxZI0Urh/+xjoy6D+NYT86mhiZYQtMz4ERrMK ogjSuKj3NagSTqDz1M33SIngfITAZpP6YrpGjBx06GNT0B6s+nUFtcAyfefLMRw+WVdK BdD7lt4eo33dXEuKeEWarMOf5dVfj4YJktJjYu/5M/Twn4xDqe8zOnv3nglKfw9ACdp2 2FP5Ioyp/LZNEo38VNpre1r5CjJwb4fCed+NSP4n6FjHFOybcyaC/qs06AOUA6J+rTSg s4Fw== X-Gm-Message-State: AIkVDXKUIA9juFNe3zePndqQJ3HNH5Xlzd7KT6B8n5eymgE0XhyW4Jt48Aeq4q54Y6dGhA== X-Received: by 10.223.173.181 with SMTP id w50mr11312388wrc.177.1484911068927; Fri, 20 Jan 2017 03:17:48 -0800 (PST) Received: from a.muc.corp.google.com ([2a00:79e0:15:4:2854:82f2:ffa5:e57c]) by smtp.gmail.com with ESMTPSA id g197sm5406295wmd.15.2017.01.20.03.17.47 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 20 Jan 2017 03:17:47 -0800 (PST) From: Philipp Stephani To: bug-gnu-emacs@gnu.org Subject: 26.0.50; ediff merge should (optionally) show ancestor in fourth window Date: Fri, 20 Jan 2017 12:17:46 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -3.8 (---) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.8 (---) It would be very useful if ediff merge could optionally display the ancestor in a fourth window, like vimdiff or meld. See https://lists.gnu.org/archive/html/emacs-devel/2017-01/msg00204.html. In GNU Emacs 26.0.50.40 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8) of 2017-01-19 built on localhost Repository revision: 8c0fcaf66733f0538a3f024f383cb34a3c93d73c Windowing system distributor 'The X.Org Foundation', version 11.0.11501000 System Description: Ubuntu 14.04 LTS Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Source file =E2=80=98/usr/local/google/home/phst/ThirdParty/Emacs/lisp/emac= s-lisp/derived.el=E2=80=99 newer than byte-compiled file Configured using: 'configure --with-modules --enable-checking --enable-check-lisp-object-type 'CFLAGS=3D-ggdb3 -O0'' Configured features: XPM JPEG TIFF GIF PNG SOUND GSETTINGS NOTIFY GNUTLS FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message subr-x puny seq byte-opt gv bytecomp byte-compile cl-extra help-mode cconv cl-loaddefs pcase cl-lib dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote inotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 97616 6566) (symbols 48 20221 1) (miscs 40 331 156) (strings 32 17989 4269) (string-bytes 1 592161) (vectors 16 14072) (vector-slots 8 471896 4520) (floats 8 181 46) (intervals 56 206 0) (buffers 976 12) (heap 1024 31236 1025)) --=20 Google Germany GmbH Erika-Mann-Stra=C3=9Fe 33 80636 M=C3=BCnchen Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Gesch=C3=A4ftsf=C3=BChrer: Matthew Scott Sucherman, Paul Terence Manicle Diese E-Mail ist vertraulich. Wenn Sie nicht der richtige Adressat sind, leiten Sie diese bitte nicht weiter, informieren Sie den Absender und l=C3= =B6schen Sie die E-Mail und alle Anh=C3=A4nge. Vielen Dank. This e-mail is confidential. If you are not the right addressee please do = not forward it, please inform the sender, and please erase this e-mail including any attachments. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 19 05:47:50 2017 Received: (at 25493) by debbugs.gnu.org; 19 Feb 2017 10:47:50 +0000 Received: from localhost ([127.0.0.1]:45608 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cfP1w-0003Vr-Ej for submit@debbugs.gnu.org; Sun, 19 Feb 2017 05:47:50 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:35657) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cfP1s-0003Vc-Gq for 25493@debbugs.gnu.org; Sun, 19 Feb 2017 05:47:46 -0500 Received: by mail-pf0-f193.google.com with SMTP id 68so7496670pfx.2 for <25493@debbugs.gnu.org>; Sun, 19 Feb 2017 02:47:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=qq9svwCQV0imT6NXC5BLkbhb4Qzo1RtZD5aww4iFRUA=; b=f2cRW/FtgMVLVzevG/gPf3H7drllNAlftB+J5tjdBnGdgVggL4eG4Sm6G0yHPEoshY QJnVkGm1moKF8pCAMaCV4zqa1RkKbxqvfvPJoKDF7wyVslZdTlSuviNLwZwwBQqN34aT u4ywEz0lVQ4MdX+qAe8mlNyHvS+KYXWjGA9oz7Bf2I6M1qf//XXubho8LcYXjiF4/eNX p1OIxqlE/Wqjtggxoltk9E955qEpvF4faMlcm73IpG3b+ulxLVKfzDQdUHODUUt3XiUx EbM6SYo7CL/S7JSP8UP2JZgM5GiyWds8KS6Nk8lLibKsC84XJrww3sMhBmip0sD/Ksro FpgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=qq9svwCQV0imT6NXC5BLkbhb4Qzo1RtZD5aww4iFRUA=; b=tZcXsVkRZAHT2x8PT01Zjhv+7YPZuVlZmDaTDCQ3DdhNwt3gYOxPDgEReeVGckrs8t nq137YOSmP57M+q72W3OrujoaHPWeFDPx57AolwYhNkZ/7eDa0H42bxLN0seCgpHq6s4 hO8fXFcvAa2O9zsLVYt/I1Jpn91YEAEdSZCN58pVkz3jPGeq2V/wOrMFpP3y1nIbbpW9 mNWW8p30TxwhvvRBXkrMbL9+kY4Eldmta18L2ZHXjfWRlOObyUsnibncjv/gCOF6Q9aB XCgwI71qWjX9eCtp/S84O4YiQl1H5gh4NKpEvmg8WQhbS8SmBdktcd1QTFOMv7uDVZRn 1eSQ== X-Gm-Message-State: AMke39ksTzTbe8MPFO0lOyGjeU3QP8hXSxupyzuolE6cMigE37LG16/koGO8GIF8tLuBTg== X-Received: by 10.98.81.6 with SMTP id f6mr19254974pfb.180.1487501257953; Sun, 19 Feb 2017 02:47:37 -0800 (PST) Received: from calancha-pc (104.81.147.124.dy.bbexcite.jp. [124.147.81.104]) by smtp.gmail.com with ESMTPSA id w75sm700836pfi.50.2017.02.19.02.47.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 19 Feb 2017 02:47:37 -0800 (PST) From: Tino Calancha To: Philipp Stephani Subject: Re: bug#25493: 26.0.50; ediff merge should (optionally) show ancestor in fourth window References: Date: Sun, 19 Feb 2017 19:47:32 +0900 In-Reply-To: (Philipp Stephani's message of "Fri, 20 Jan 2017 12:17:46 +0100") Message-ID: <874lzqe9tn.fsf@calancha-pc> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.8 (--) X-Debbugs-Envelope-To: 25493 Cc: 25493@debbugs.gnu.org, tino.calancha@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.8 (--) Philipp Stephani writes: > It would be very useful if ediff merge could optionally display the > ancestor in a fourth window, like vimdiff or meld. See > https://lists.gnu.org/archive/html/emacs-devel/2017-01/msg00204.html. Following patch, by default, display the ancestor buffer and auto refine it in 3way merges. This feature can be disabled by customizing a new option. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PATCH BEGINS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >From d1d0ef67e9d0a03ee5f60d56d13658f1a3d3a80a Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Sun, 19 Feb 2017 19:15:04 +0900 Subject: [PATCH 1/3] Show ancestor buffer in 3way merges Add an option to control if the ancestor buffer must be shown in 3way merges (Bug#25493). Add an option to control whether if show or ignore diffs with ancestor that are equal in buffers A and B. * lisp/vc/ediff-init.el (ediff-show-ancestor) (ediff-hide-equal-diffs-with-ancestor): New options. (ediff--restore-options-on-exit-alist): New defvar. (ediff-get-value-according-to-buffer-type): Add clause for the ancestor. * lisp/vc/ediff-wind.el (ediff-window-Ancestor): New defvar. (ediff-setup-windows-plain-merge, ediff-setup-windows-multiframe-merge): Display ancestor buffer when ediff-show-ancestor is non-nil. (ediff-keep-window-config): Expect ancestor window in ediff-window-config-saved. * lisp/vc/ediff-util.el (ediff-setup-control-buffer): ediff-window-config-saved contains ancestor window. (ediff-setup-keymap): New bindings for merge jobs: bind ediff-toggle-show-ancestor to '\'; bind ediff-toggle-hide-equal-diffs-with-ancestor to '$%'. (ediff-update-diffs): Compute new diffs using ancestor buffer. (ediff--check-ancestor-exists): New defsubst extracted from ediff-show-ancestor. (ediff-swap-buffers): Take in account the ancestor. (ediff-toggle-show-ancestor): New command; toggle ediff-show-ancestor. (ediff-toggle-hide-equal-diffs-with-ancestor): New command; toggle ediff-hide-equal-diffs-with-ancestor. (ediff--restore-options-on-exit): Restore on exit option values changed in previous toggles. * lisp/vc/ediff-help.el (ediff-long-help-message-merge): List the new toggles. --- lisp/vc/ediff-help.el | 2 + lisp/vc/ediff-init.el | 19 ++++++ lisp/vc/ediff-util.el | 162 ++++++++++++++++++++++++++++++++++++-------------- lisp/vc/ediff-wind.el | 83 ++++++++++++++++++++++---- 4 files changed, 210 insertions(+), 56 deletions(-) diff --git a/lisp/vc/ediff-help.el b/lisp/vc/ediff-help.el index 3292b4d939..89645d2f3b 100644 --- a/lisp/vc/ediff-help.el +++ b/lisp/vc/ediff-help.el @@ -115,6 +115,8 @@ ediff-long-help-message-merge ~ -swap variants | s -shrink window C | / -show ancestor buff | $$ -show clashes only | & -merge w/new default | $* -skip changed regions | + | $% -all ancestor diffs | + | \\ -show/hide ancestor | " "Help message for merge sessions. Normally, not a user option. See `ediff-help-message' for details.") diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el index 0235926fbe..66a2a0f527 100644 --- a/lisp/vc/ediff-init.el +++ b/lisp/vc/ediff-init.el @@ -134,6 +134,7 @@ ediff-get-value-according-to-buffer-type `(cond ((eq ,buf-type 'A) (nth 0 ,list)) ((eq ,buf-type 'B) (nth 1 ,list)) ((eq ,buf-type 'C) (nth 2 ,list)) + ((eq ,buf-type 'Ancestor) (nth 3 ,list)) )) (defmacro ediff-char-to-buftype (arg) @@ -1355,6 +1356,24 @@ ediff-make-buffers-readonly-at-startup ;; if nil, this silences some messages (defvar ediff-verbose-p t) +(defcustom ediff-show-ancestor t +"If non-nil, show ancestor buffer in 3way merges and refine it." + :type 'boolean + :group 'ediff-merge + :version "26.1") + +(defcustom ediff-hide-equal-diffs-with-ancestor t + "If non-nil, hide diffs with ancestor that are equal in buffers A and B." + :type 'boolean + :group 'ediff-merge + :version "26.1") + +;; Store original values of options changed with +;; `ediff-toggle-show-ancestor' or +;; `ediff-toggle-hide-equal-diffs-with-ancestor'. It's an alist +;; (VAR . VALUE). +(ediff-defvar-local ediff--restore-options-on-exit-alist nil "") + (defcustom ediff-autostore-merges 'group-jobs-only "Save the results of merge jobs automatically. With value nil, don't save automatically. With value t, always diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el index f81397950d..25dd2988bb 100644 --- a/lisp/vc/ediff-util.el +++ b/lisp/vc/ediff-util.el @@ -179,6 +179,7 @@ ediff-setup-keymap (cond (ediff-merge-job ;; Will barf if no ancestor (define-key ediff-mode-map "/" 'ediff-show-ancestor) + (define-key ediff-mode-map "\\" 'ediff-toggle-show-ancestor) ;; In merging, we allow only A->C and B->C copying. (define-key ediff-mode-map "a" 'ediff-copy-A-to-C) (define-key ediff-mode-map "b" 'ediff-copy-B-to-C) @@ -187,6 +188,7 @@ ediff-setup-keymap (define-key ediff-mode-map "+" 'ediff-combine-diffs) (define-key ediff-mode-map "$" nil) (define-key ediff-mode-map "$$" 'ediff-toggle-show-clashes-only) + (define-key ediff-mode-map "$%" 'ediff-toggle-hide-equal-diffs-with-ancestor) (define-key ediff-mode-map "$*" 'ediff-toggle-skip-changed-regions) (define-key ediff-mode-map "&" 'ediff-re-merge)) (ediff-3way-comparison-job @@ -553,11 +555,12 @@ ediff-setup-control-buffer (ediff-refresh-mode-lines) (setq ediff-control-window (selected-window)) (setq ediff-window-config-saved - (format "%S%S%S%S%S%S%S" + (format "%S%S%S%S%S%S%S%S" ediff-control-window ediff-window-A ediff-window-B ediff-window-C + ediff-window-Ancestor ediff-split-window-function (ediff-multiframe-setup-p) ediff-wide-display-p)) @@ -600,12 +603,6 @@ ediff-update-diffs if necessary." (interactive) (ediff-barf-if-not-control-buffer) - (if (and (ediff-buffer-live-p ediff-ancestor-buffer) - (not - (y-or-n-p - "Ancestor buffer will not be used. Recompute diffs anyway? "))) - (error "Recomputation of differences canceled")) - (let ((point-A (ediff-with-current-buffer ediff-buffer-A (point))) ;;(point-B (ediff-with-current-buffer ediff-buffer-B (point))) (tmp-buffer (get-buffer-create ediff-tmp-buffer)) @@ -614,14 +611,17 @@ ediff-update-diffs ;; (null ediff-buffer-C) is no problem, as we later check if ;; ediff-buffer-C is alive (buf-C-file-name (buffer-file-name ediff-buffer-C)) + (buf-ancestor-file-name (buffer-file-name ediff-ancestor-buffer)) (overl-A (ediff-get-value-according-to-buffer-type 'A ediff-narrow-bounds)) (overl-B (ediff-get-value-according-to-buffer-type 'B ediff-narrow-bounds)) (overl-C (ediff-get-value-according-to-buffer-type 'C ediff-narrow-bounds)) - beg-A end-A beg-B end-B beg-C end-C - file-A file-B file-C) + (overl-Ancestor (ediff-get-value-according-to-buffer-type + 'Ancestor ediff-narrow-bounds)) + beg-A end-A beg-B end-B beg-C end-C beg-Ancestor end-Ancestor + file-A file-B file-C file-Ancestor) (if (stringp buf-A-file-name) (setq buf-A-file-name (file-name-nondirectory buf-A-file-name))) @@ -629,15 +629,19 @@ ediff-update-diffs (setq buf-B-file-name (file-name-nondirectory buf-B-file-name))) (if (stringp buf-C-file-name) (setq buf-C-file-name (file-name-nondirectory buf-C-file-name))) + (if (stringp buf-ancestor-file-name) + (setq buf-ancestor-file-name (file-name-nondirectory buf-ancestor-file-name))) (ediff-unselect-and-select-difference -1) (setq beg-A (ediff-overlay-start overl-A) beg-B (ediff-overlay-start overl-B) beg-C (ediff-overlay-start overl-C) + beg-Ancestor (ediff-overlay-start overl-Ancestor) end-A (ediff-overlay-end overl-A) end-B (ediff-overlay-end overl-B) - end-C (ediff-overlay-end overl-C)) + end-C (ediff-overlay-end overl-C) + end-Ancestor (ediff-overlay-end overl-Ancestor)) (if ediff-word-mode (progn @@ -645,51 +649,37 @@ ediff-update-diffs (setq file-A (ediff-make-temp-file tmp-buffer "regA")) (ediff-wordify beg-B end-B ediff-buffer-B tmp-buffer) (setq file-B (ediff-make-temp-file tmp-buffer "regB")) - (if ediff-3way-job - (progn - (ediff-wordify beg-C end-C ediff-buffer-C tmp-buffer) - (setq file-C (ediff-make-temp-file tmp-buffer "regC")))) + (when ediff-3way-job + (ediff-wordify beg-C end-C ediff-buffer-C tmp-buffer) + (setq file-C (ediff-make-temp-file tmp-buffer "regC"))) + (when ediff-merge-with-ancestor-job + (ediff-wordify beg-Ancestor end-Ancestor ediff-ancestor-buffer tmp-buffer) + (setq file-Ancestor (ediff-make-temp-file tmp-buffer "regAncestor"))) ) ;; not word-mode (setq file-A (ediff-make-temp-file ediff-buffer-A buf-A-file-name)) (setq file-B (ediff-make-temp-file ediff-buffer-B buf-B-file-name)) (if ediff-3way-job (setq file-C (ediff-make-temp-file ediff-buffer-C buf-C-file-name))) + (when ediff-merge-with-ancestor-job + (setq file-Ancestor + (ediff-make-temp-file + ediff-ancestor-buffer + buf-ancestor-file-name))) ) - (ediff-clear-diff-vector 'ediff-difference-vector-A 'fine-diffs-also) (ediff-clear-diff-vector 'ediff-difference-vector-B 'fine-diffs-also) (ediff-clear-diff-vector 'ediff-difference-vector-C 'fine-diffs-also) (ediff-clear-diff-vector 'ediff-difference-vector-Ancestor 'fine-diffs-also) - ;; let them garbage collect. we can't use the ancestor after recomputing - ;; the diffs. - (setq ediff-difference-vector-Ancestor nil - ediff-ancestor-buffer nil - ediff-state-of-merge nil) - (setq ediff-killed-diffs-alist nil) ; invalidate saved killed diff regions - - ;; In case of merge job, fool it into thinking that it is just doing - ;; comparison - (let ((ediff-setup-diff-regions-function ediff-setup-diff-regions-function) - (ediff-3way-comparison-job ediff-3way-comparison-job) - (ediff-merge-job ediff-merge-job) - (ediff-merge-with-ancestor-job ediff-merge-with-ancestor-job) - (ediff-job-name ediff-job-name)) - (if ediff-merge-job - (setq ediff-setup-diff-regions-function 'ediff-setup-diff-regions3 - ediff-3way-comparison-job t - ediff-merge-job nil - ediff-merge-with-ancestor-job nil - ediff-job-name 'ediff-files3)) - (funcall ediff-setup-diff-regions-function file-A file-B file-C)) - + (funcall ediff-setup-diff-regions-function file-A file-B + (if ediff-merge-with-ancestor-job file-Ancestor file-C)) (setq ediff-number-of-differences (length ediff-difference-vector-A)) (delete-file file-A) (delete-file file-B) - (if file-C - (delete-file file-C)) + (and file-C (delete-file file-C)) + (and file-Ancestor (delete-file file-Ancestor)) (if ediff-3way-job (ediff-set-state-of-all-diffs-in-all-buffers ediff-control-buffer)) @@ -737,14 +727,16 @@ ediff-revert-buffers-then-recompute-diffs ;; optional NO-REHIGHLIGHT says to not rehighlight buffers (defun ediff-recenter (&optional no-rehighlight) "Bring the highlighted region of all buffers being compared into view. -Reestablish the default three-window display." +Reestablish the default window display." (interactive) (ediff-barf-if-not-control-buffer) (let (buffer-read-only) (if (and (ediff-buffer-live-p ediff-buffer-A) (ediff-buffer-live-p ediff-buffer-B) (or (not ediff-3way-job) - (ediff-buffer-live-p ediff-buffer-C))) + (ediff-buffer-live-p ediff-buffer-C)) + (or (not ediff-merge-with-ancestor-job) + (ediff-buffer-live-p ediff-ancestor-buffer))) (ediff-setup-windows ediff-buffer-A ediff-buffer-B ediff-buffer-C ediff-control-buffer) (or (eq this-command 'ediff-quit) @@ -963,19 +955,92 @@ ediff-toggle-autorefine (setq ediff-auto-refine 'nix)) )) +(defsubst ediff--check-ancestor-exists () + (or (ediff-buffer-live-p ediff-ancestor-buffer) + (if ediff-merge-with-ancestor-job + (error "Lost connection to ancestor buffer. This shouldn't happen. \ +Please report this bug to bug-gnu-emacs@gnu.org") + (error "Not merging with ancestor")))) + (defun ediff-show-ancestor () "Show the ancestor buffer in a suitable window." (interactive) (ediff-recenter) - (or (ediff-buffer-live-p ediff-ancestor-buffer) - (if ediff-merge-with-ancestor-job - (error "Lost connection to ancestor buffer...sorry") - (error "Not merging with ancestor"))) + (ediff--check-ancestor-exists) (let (wind) (cond ((setq wind (ediff-get-visible-buffer-window ediff-ancestor-buffer)) (raise-frame (window-frame wind))) (t (set-window-buffer ediff-window-C ediff-ancestor-buffer))))) +;; Restore on exit the original values for options changed with +;; `ediff-toggle-show-ancestor' or `ediff-toggle-hide-equal-diffs-with-ancestor'. +(defun ediff--restore-options-on-exit () + (when ediff--restore-options-on-exit-alist + (mapc (lambda (x) + (let ((var (car x)) + (value (cdr x))) + (message "Restoring %S to %S..." var value) + (set var value))) + ediff--restore-options-on-exit-alist) + (remove-hook 'ediff-quit-hook #'ediff--restore-options-on-exit))) + +(defun ediff-toggle-show-ancestor () + "Toggle to show/hide the ancestor buffer." + (interactive) + (ediff--check-ancestor-exists) + (let ((alist ediff--restore-options-on-exit-alist)) + ;; Save original value if not yet, and add hook to restore it on exit. + (unless (assq 'ediff-show-ancestor alist) + (push (cons 'ediff-show-ancestor ediff-show-ancestor) + alist) + (add-hook 'ediff-quit-hook #'ediff--restore-options-on-exit)) + (setq ediff-show-ancestor (not ediff-show-ancestor)) + ;; If equal than orig, then nothing to restore on exit. + (when (eq ediff-show-ancestor + (alist-get 'ediff-show-ancestor alist)) + (assq-delete-all 'ediff-show-ancestor alist) + (unless alist + (remove-hook 'ediff-quit-hook #'ediff--restore-options-on-exit))) + (if (not ediff-show-ancestor) + (progn + (delete-window ediff-window-Ancestor) + (ediff-recenter) + (message "Ancestor buffer is hidden")) + (let (wind) + (cond ((setq wind (ediff-get-visible-buffer-window ediff-ancestor-buffer)) + (raise-frame (window-frame wind))) + (t (set-window-buffer ediff-window-C ediff-ancestor-buffer)))) + (ediff-recenter) + (message "Showing ancestor buffer")) + (setq ediff--restore-options-on-exit-alist alist))) + +(defun ediff-toggle-hide-equal-diffs-with-ancestor () + "Toggle `ediff-hide-equal-diffs-with-ancestor'." + (interactive) + (let ((alist ediff--restore-options-on-exit-alist)) + ;; Save original value if not yet, and add hook to restore it on exit. + (unless (assq 'ediff-hide-equal-diffs-with-ancestor + alist) + (push (cons 'ediff-hide-equal-diffs-with-ancestor + ediff-hide-equal-diffs-with-ancestor) + alist) + (add-hook 'ediff-quit-hook #'ediff--restore-options-on-exit)) + (setq ediff-hide-equal-diffs-with-ancestor + (not ediff-hide-equal-diffs-with-ancestor)) + ;; If equal than orig, then nothing to restore on exit. + (when (eq ediff-hide-equal-diffs-with-ancestor + (alist-get 'ediff-hide-equal-diffs-with-ancestor + alist)) + (assq-delete-all 'ediff-hide-equal-diffs-with-ancestor + alist) + (unless alist + (remove-hook 'ediff-quit-hook #'ediff--restore-options-on-exit))) + (ediff-update-diffs) + (if (not ediff-hide-equal-diffs-with-ancestor) + (message "Showing all diffs with ancestor") + (message "Ignoring diffs with ancestor when they are equal in buffers A and B")) + (setq ediff--restore-options-on-exit-alist alist))) + (defun ediff-make-or-kill-fine-diffs (arg) "Compute fine diffs. With negative prefix arg, kill fine diffs. In both cases, operates on the current difference region." @@ -1232,7 +1297,12 @@ ediff-swap-buffers (list (nth 2 ediff-narrow-bounds) (nth 0 ediff-narrow-bounds) (nth 1 ediff-narrow-bounds))) - (ediff-3way-job + (ediff-merge-with-ancestor-job + (list (nth 1 ediff-narrow-bounds) + (nth 0 ediff-narrow-bounds) + (nth 2 ediff-narrow-bounds) + (nth 3 ediff-narrow-bounds))) + (ediff-3way-job (list (nth 1 ediff-narrow-bounds) (nth 0 ediff-narrow-bounds) (nth 2 ediff-narrow-bounds))) diff --git a/lisp/vc/ediff-wind.el b/lisp/vc/ediff-wind.el index cd10288643..560dc470a5 100644 --- a/lisp/vc/ediff-wind.el +++ b/lisp/vc/ediff-wind.el @@ -115,6 +115,8 @@ ediff-window-setup-function (ediff-defvar-local ediff-window-B nil "") ;; Official window for buffer C (ediff-defvar-local ediff-window-C nil "") +;; Official window for buffer Ancestor +(ediff-defvar-local ediff-window-Ancestor nil "") ;; Ediff's window configuration. ;; Used to minimize the need to rearrange windows. (ediff-defvar-local ediff-window-config-saved "" "") @@ -363,9 +365,13 @@ ediff-setup-windows-plain-merge ;; skip dedicated and unsplittable frames (ediff-destroy-control-frame control-buffer) (let ((window-min-height 1) + (with-Ancestor-p (ediff-with-current-buffer control-buffer + ediff-merge-with-ancestor-job)) split-window-function merge-window-share merge-window-lines - wind-A wind-B wind-C) + (buf-Ancestor (ediff-with-current-buffer control-buffer + ediff-ancestor-buffer)) + wind-A wind-B wind-C wind-Ancestor) (ediff-with-current-buffer control-buffer (setq merge-window-share ediff-merge-window-share ;; this lets us have local versions of ediff-split-window-function @@ -394,6 +400,14 @@ ediff-setup-windows-plain-merge (setq wind-C (selected-window)) (switch-to-buffer buf-C) + (when (and ediff-show-ancestor with-Ancestor-p) + (select-window wind-C) + (funcall split-window-function) + (when (eq (selected-window) wind-C) + (other-window 1)) + (switch-to-buffer buf-Ancestor) + (setq wind-Ancestor (selected-window))) + (select-window wind-A) (funcall split-window-function) @@ -405,7 +419,8 @@ ediff-setup-windows-plain-merge (ediff-with-current-buffer control-buffer (setq ediff-window-A wind-A ediff-window-B wind-B - ediff-window-C wind-C)) + ediff-window-C wind-C + ediff-window-Ancestor wind-Ancestor)) (ediff-select-lowest-window) (ediff-setup-control-buffer control-buffer) @@ -516,9 +531,13 @@ ediff-setup-windows-multiframe-merge (wind-A (ediff-get-visible-buffer-window buf-A)) (wind-B (ediff-get-visible-buffer-window buf-B)) (wind-C (ediff-get-visible-buffer-window buf-C)) + (buf-Ancestor (ediff-with-current-buffer control-buf + ediff-ancestor-buffer)) + (wind-Ancestor (ediff-get-visible-buffer-window buf-Ancestor)) (frame-A (if wind-A (window-frame wind-A))) (frame-B (if wind-B (window-frame wind-B))) (frame-C (if wind-C (window-frame wind-C))) + (frame-Ancestor (if wind-Ancestor (window-frame wind-Ancestor))) ;; on wide display, do things in one frame (force-one-frame (ediff-with-current-buffer control-buf ediff-wide-display-p)) @@ -549,7 +568,10 @@ ediff-setup-windows-multiframe-merge (merge-window-share (ediff-with-current-buffer control-buf ediff-merge-window-share)) merge-window-lines - designated-minibuffer-frame + designated-minibuffer-frame ; ediff-merge-with-ancestor-job + (with-Ancestor-p (ediff-with-current-buffer control-buf + ediff-merge-with-ancestor-job)) + (done-Ancestor (not with-Ancestor-p)) done-A done-B done-C) ;; buf-A on its own @@ -585,6 +607,19 @@ ediff-setup-windows-multiframe-merge (setq wind-C (selected-window)) (setq done-C t))) + ;; buf-Ancestor on its own + (if (and ediff-show-ancestor + with-Ancestor-p + (window-live-p wind-Ancestor) + (ediff-window-ok-for-display wind-Ancestor) + (null use-same-frame)) ; buf Ancestor on its own + (progn + ;; buffer buf-Ancestor is seen in live wind-Ancestor + (select-window wind-Ancestor) + (delete-other-windows) + (setq wind-Ancestor (selected-window)) + (setq done-Ancestor t))) + (if (and use-same-frame-for-AB ; implies wind A and B are suitable (window-live-p wind-A)) (progn @@ -606,6 +641,7 @@ ediff-setup-windows-multiframe-merge (let ((window-min-height 1)) (if (and (eq frame-A frame-B) (eq frame-B frame-C) + (eq frame-C frame-Ancestor) (frame-live-p frame-A)) (select-frame frame-A) ;; avoid dedicated and non-splittable windows @@ -623,6 +659,14 @@ ediff-setup-windows-multiframe-merge (setq wind-C (selected-window)) (switch-to-buffer buf-C) + (when (and ediff-show-ancestor with-Ancestor-p) + (select-window wind-C) + (funcall split-window-function) + (if (eq (selected-window) wind-C) + (other-window 1)) + (switch-to-buffer buf-Ancestor) + (setq wind-Ancestor (selected-window))) + (select-window wind-A) (funcall split-window-function) @@ -633,8 +677,8 @@ ediff-setup-windows-multiframe-merge (setq done-A t done-B t - done-C t) - )) + done-C t + done-Ancestor t))) (or done-A ; Buf A to be set in its own frame, ;;; or it was set before because use-same-frame = 1 @@ -668,10 +712,22 @@ ediff-setup-windows-multiframe-merge (setq wind-C (selected-window)) )) + (or done-Ancestor ; Buf Ancestor to be set in its own frame, + (not ediff-show-ancestor) + ;;; or it was set before because use-same-frame = 1 + (progn + ;; Buf-Ancestor was not set up yet as it wasn't visible + ;; and use-same-frame = nil + (select-window orig-wind) + (delete-other-windows) + (switch-to-buffer buf-Ancestor) + (setq wind-Ancestor (selected-window)))) + (ediff-with-current-buffer control-buf (setq ediff-window-A wind-A ediff-window-B wind-B - ediff-window-C wind-C) + ediff-window-C wind-C + ediff-window-Ancestor wind-Ancestor) (setq frame-A (window-frame ediff-window-A) designated-minibuffer-frame (window-frame (minibuffer-window frame-A)))) @@ -679,7 +735,6 @@ ediff-setup-windows-multiframe-merge (ediff-setup-control-frame control-buf designated-minibuffer-frame) )) - ;; Window setup for all comparison jobs, including 3way comparisons (defun ediff-setup-windows-multiframe-compare (buf-A buf-B buf-C control-buf) ;;; Algorithm: @@ -1295,7 +1350,9 @@ ediff-keep-window-config (let ((ctl-wind ediff-control-window) (A-wind ediff-window-A) (B-wind ediff-window-B) - (C-wind ediff-window-C)) + (C-wind ediff-window-C) + (ancestor-job ediff-merge-with-ancestor-job) + (Ancestor-wind ediff-window-Ancestor)) (and (ediff-window-visible-p A-wind) @@ -1303,13 +1360,19 @@ ediff-keep-window-config ;; if buffer C is defined then take it into account (or (not ediff-3way-job) (ediff-window-visible-p C-wind)) + (or (not ancestor-job) + (not ediff-show-ancestor) + (ediff-window-visible-p Ancestor-wind)) (eq (window-buffer A-wind) ediff-buffer-A) (eq (window-buffer B-wind) ediff-buffer-B) (or (not ediff-3way-job) (eq (window-buffer C-wind) ediff-buffer-C)) + (or (not ancestor-job) + (not ediff-show-ancestor) + (eq (window-buffer Ancestor-wind) ediff-ancestor-buffer)) (string= ediff-window-config-saved - (format "%S%S%S%S%S%S%S" - ctl-wind A-wind B-wind C-wind + (format "%S%S%S%S%S%S%S%S" + ctl-wind A-wind B-wind C-wind Ancestor-wind ediff-split-window-function (ediff-multiframe-setup-p) ediff-wide-display-p))))))) -- 2.11.0 >From 2a1bc9b77c20153e2a1454bc1d20eb734ef41d15 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Sun, 19 Feb 2017 19:15:09 +0900 Subject: [PATCH 2/3] Auto refine ancestor buffer in 3way merges * lisp/vc/ediff-diff.el (ediff-convert-diffs-to-overlays): Prefer 'when' instead of 'if' here. (ediff-make-fine-diffs, ediff-set-fine-diff-properties) (ediff-set-fine-overlays-in-one-buffer) (ediff-extract-diffs3, ediff-set-diff-overlays-in-one-buffer): Consider ancestor buffer as well. (ediff--set-right-faces): New defun. * lisp/vc/ediff-init.el (ediff-state-of-merge): Update comment with new state-of-merge 'A=B. (ediff-fine-diff-face-Ancestor-A, ediff-fine-diff-face-Ancestor-B) (ediff-fine-diff-face-AB, ediff-temp-file-Ancestor): New defvars. (ediff-fine-diff-Ancestor-A, ediff-fine-diff-Ancestor-B) (ediff-fine-diff-AB): New faces. Add echo help for the new faces. (ediff-clear-fine-differences): Clear ancestor diffs as well. * lisp/vc/ediff-util.el (ediff-delete-temp-files): Delete ancestor temporary file as well. * doc/misc/ediff.texi (Quick Help Commands) (Merging and diff3): Update manual. ; * etc/NEWS: Add entry for the new features. --- doc/misc/ediff.texi | 55 +++++++-- etc/NEWS | 8 ++ lisp/vc/ediff-diff.el | 332 ++++++++++++++++++++++++++++++-------------------- lisp/vc/ediff-init.el | 62 +++++++++- lisp/vc/ediff-util.el | 14 +-- 5 files changed, 315 insertions(+), 156 deletions(-) diff --git a/doc/misc/ediff.texi b/doc/misc/ediff.texi index 19b7adbd66..2b3144f888 100644 --- a/doc/misc/ediff.texi +++ b/doc/misc/ediff.texi @@ -99,7 +99,8 @@ Introduction another (and recover old differences if you change your mind). Another powerful feature is the ability to merge a pair of files into a -third buffer. Merging with an ancestor file is also supported. +third buffer. Merging with an ancestor file, (a.k.a. 3way merges) +is also supported. Furthermore, Ediff is equipped with directory-level capabilities that allow the user to conveniently launch browsing or merging sessions on groups of files in two (or three) different directories. @@ -810,6 +811,15 @@ Quick Help Commands of the variants clashes with the ancestor but the other variant agrees with it. Typing @kbd{$$} again undoes this setting. +@item $% +@kindex $% +When performing a 3way merge, any differences with the ancestor identical in +both files, A and B are discarded. Use this command in the control buffer +if you want to see those differences as well. Typing @kbd{$%} again +undoes this setting. +To enable this feature permanently, you might wish to customize the variable +@code{ediff-hide-equal-diffs-with-ancestor}. + @item $* @kindex $* When merging files with large number of differences, it is sometimes @@ -828,7 +838,15 @@ Quick Help Commands @item / @kindex / -Displays the ancestor file during merges. +Displays the ancestor file during merges in the current difference. + +@item \ +@kindex \ +@vindex ediff-show-ancestor +Displays the ancestor file during merges for all differences. +You can enable permanently this setting customizing the variable +@code{ediff-show-ancestor}. + @item & @kindex & In some situations, such as when one of the files agrees with the ancestor file @@ -1638,9 +1656,11 @@ Highlighting Difference Regions @item ediff-current-diff-face-A @itemx ediff-current-diff-face-B @itemx ediff-current-diff-face-C +@itemx ediff-current-diff-face-Ancestor @vindex ediff-current-diff-face-A @vindex ediff-current-diff-face-B @vindex ediff-current-diff-face-C +@vindex ediff-current-diff-face-Ancestor Ediff uses these faces to highlight current differences on devices where Emacs can display faces. These and subsequently described faces can be set either in @file{.emacs} or in @file{.Xdefaults}. The X resource for Ediff @@ -1648,12 +1668,20 @@ Highlighting Difference Regions the information on how to set X resources. @item ediff-fine-diff-face-A @itemx ediff-fine-diff-face-B +@itemx ediff-fine-diff-face-AB @itemx ediff-fine-diff-face-C +@itemx ediff-fine-diff-face-Ancestor +@itemx ediff-fine-diff-face-Ancestor-A +@itemx ediff-fine-diff-face-Ancestor-B @vindex ediff-fine-diff-face-A @vindex ediff-fine-diff-face-B +@vindex ediff-fine-diff-face-AB @vindex ediff-fine-diff-face-C +@vindex ediff-fine-diff-face-Ancestor +@vindex ediff-fine-diff-face-Ancestor-A +@vindex ediff-fine-diff-face-Ancestor-B Ediff uses these faces to show the fine differences between the current -differences regions in buffers A, B, and C, respectively. +differences regions in buffers A, B, and C or Ancestor respectively. @item ediff-even-diff-face-A @itemx ediff-even-diff-face-B @@ -2048,16 +2076,17 @@ Merging and diff3 regions in buffers A or B are non-empty, this means that text was modified. Otherwise, the original text was deleted. -Although the ancestor buffer is normally invisible, Ediff maintains -difference regions there and advances the current difference region -accordingly. All highlighting of difference regions is provided in the -ancestor buffer, except for the fine differences. Therefore, if desired, the -user can put the ancestor buffer in a separate frame and watch it -there. However, on a TTY, only one frame can be visible at any given time, -and Ediff doesn't support any single-frame window configuration where all -buffers, including the ancestor buffer, would be visible. However, the -ancestor buffer can be displayed by typing @kbd{/} to the control -window. (Type @kbd{C-l} to hide it again.) +@vindex ediff-hide-equal-diffs-with-ancestor +The ancestor buffer is normally visible. All highlighting of difference +regions is provided on it, including the fine differences. +By default, differences with the ancestor identical in the other two +buffers are discarded. +The option @code{ediff-hide-equal-diffs-with-ancestor} controls +whether if those differences must be shown or not. This option can be +temporary disabled by typing @kbd{$%} to the control buffer. +For those differences the state-of-difference indicator is @samp{A=B}. +If desired, the ancestor buffer can be hidden by typing @kbd{\} to +the control buffer. Note that the state-of-difference indicators @samp{=diff(A)} and @samp{=diff(B)} above are not redundant, even in the presence of a diff --git a/etc/NEWS b/etc/NEWS index 143e4655de..39940f0507 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -357,6 +357,14 @@ words where first character is upper rather than title case, e.g., * Changes in Specialized Modes and Packages in Emacs 26.1 +** Ediff + ++++ +*** The ancestor buffer is shown and refined by default in 3way merges. +Two new options ediff-show-ancestor and +ediff-hide-equal-diffs-with-ancestor and two new toggles +ediff-toggle-show-ancestor, ediff-toggle-hide-equal-diffs-with-ancestor. + ** TeX: Add luatex and xetex as alternatives to pdftex ** Electric-Buffer-menu diff --git a/lisp/vc/ediff-diff.el b/lisp/vc/ediff-diff.el index 37f22340d7..2e3bdc1475 100644 --- a/lisp/vc/ediff-diff.el +++ b/lisp/vc/ediff-diff.el @@ -509,8 +509,8 @@ ediff-convert-diffs-to-overlays (ediff-set-diff-overlays-in-one-buffer 'B diff-list) (if ediff-3way-job (ediff-set-diff-overlays-in-one-buffer 'C diff-list)) - (if ediff-merge-with-ancestor-job - (ediff-set-diff-overlays-in-one-buffer 'Ancestor diff-list)) + (when ediff-merge-with-ancestor-job + (ediff-set-diff-overlays-in-one-buffer 'Ancestor diff-list)) ;; set up vector showing the status of merge regions (if ediff-merge-job (setq ediff-state-of-merge @@ -613,6 +613,45 @@ ediff-set-diff-overlays-in-one-buffer (vconcat diff-overlay-list)) )) + +;; Highlight with the same face overlays from different buffers +;; with identical content. +(defun ediff--set-right-faces (n) + (let ((ov-a (ediff-get-fine-diff-vector n 'A)) + (ov-b (ediff-get-fine-diff-vector n 'B)) + (ov-anc (ediff-get-fine-diff-vector n 'Ancestor)) + (buf-A ediff-buffer-A) + (buf-B ediff-buffer-B) + (buf-anc ediff-ancestor-buffer)) + (cl-flet ((set-faces-fn (overlays1 overlays2 buffer1 buffer2 face &optional setall) + (cl-mapc + (lambda (ov1 ov2) + (cl-flet ((fn (ov buf) + (with-current-buffer buf + (buffer-substring (ediff-overlay-start ov) + (ediff-overlay-end ov))))) + (when (string= (fn ov1 buffer1) (fn ov2 buffer2)) + (when setall + (ediff-overlay-put ov1 'ediff-old-face face) + (ediff-overlay-put ov1 'face face)) + (ediff-overlay-put ov2 'ediff-old-face face) + (ediff-overlay-put ov2 'face face)))) + overlays1 overlays2))) + ;; Fine diffs common to A and B. + (set-faces-fn ov-a ov-b buf-A buf-B ediff-fine-diff-face-AB 'setall) + ;; Fine diffs common to A and Ancestor. + (set-faces-fn ov-a ov-anc buf-A buf-anc ediff-fine-diff-face-Ancestor-A) + ;; Fine diffs common to B and Ancestor. + (set-faces-fn ov-b ov-anc buf-B buf-anc ediff-fine-diff-face-Ancestor-B) + ;; Set `ediff-fine-diff-Ancestor' for fine diffs just present in Ancestor buffer. + (mapc (lambda (ov) + (unless (memq (ediff-overlay-get ov 'face) + `(,ediff-fine-diff-face-Ancestor-A + ,ediff-fine-diff-face-Ancestor-B)) + (ediff-overlay-put ov 'ediff-old-face ediff-fine-diff-face-Ancestor) + (ediff-overlay-put ov 'face ediff-fine-diff-face-Ancestor))) + ov-anc)))) + ;; `n' is the diff region to work on. Default is ediff-current-difference. ;; if `flag' is 'noforce then make fine-diffs only if this region's fine ;; diffs have not been computed before. @@ -634,12 +673,17 @@ ediff-make-fine-diffs (file-A ediff-temp-file-A) (file-B ediff-temp-file-B) (file-C ediff-temp-file-C) + (file-Ancestor ediff-temp-file-Ancestor) (empty-A (ediff-empty-diff-region-p n 'A)) (empty-B (ediff-empty-diff-region-p n 'B)) (empty-C (ediff-empty-diff-region-p n 'C)) + (empty-Ancestor (and ediff-merge-with-ancestor-job + (ediff-empty-diff-region-p n 'Ancestor))) (whitespace-A (ediff-whitespace-diff-region-p n 'A)) (whitespace-B (ediff-whitespace-diff-region-p n 'B)) (whitespace-C (ediff-whitespace-diff-region-p n 'C)) + (whitespace-Ancestor (and ediff-merge-with-ancestor-job + (ediff-whitespace-diff-region-p n 'Ancestor))) cumulative-fine-diff-length) (cond ;; If one of the regions is empty (or 2 in 3way comparison) @@ -727,10 +771,22 @@ ediff-make-fine-diffs (ediff-make-temp-file tmp-buffer "fineDiffC" file-C)))) - ;; save temp file names. + (when ediff-merge-with-ancestor-job + (ediff-wordify + (ediff-get-diff-posn 'Ancestor 'beg n) + (ediff-get-diff-posn 'Ancestor 'end n) + ediff-ancestor-buffer + tmp-buffer + ediff-control-buffer) + (setq file-Ancestor + (ediff-make-temp-file + tmp-buffer "fineDiffAncestor" file-Ancestor))) + + ;; save temp file names. (setq ediff-temp-file-A file-A ediff-temp-file-B file-B - ediff-temp-file-C file-C) + ediff-temp-file-C file-C + ediff-temp-file-Ancestor file-Ancestor) ;; set the new vector of fine diffs, if none exists (cond ((and ediff-3way-job whitespace-A) @@ -738,10 +794,13 @@ ediff-make-fine-diffs ((and ediff-3way-job whitespace-B) (ediff-setup-fine-diff-regions file-A nil file-C n)) ((and ediff-3way-job - ;; In merge-jobs, whitespace-C is t, since - ;; ediff-empty-diff-region-p returns t in this case - whitespace-C) - (ediff-setup-fine-diff-regions file-A file-B nil n)) + ;; In merge-jobs, whitespace-C is t, since + ;; ediff-empty-diff-region-p returns t in this case + whitespace-C) + (if (or (not ediff-merge-with-ancestor-job) + (not ediff-show-ancestor)) + (ediff-setup-fine-diff-regions file-A file-B nil n) + (ediff-setup-fine-diff-regions file-A file-B file-Ancestor n))) (t (ediff-setup-fine-diff-regions file-A file-B file-C n))) @@ -779,6 +838,9 @@ ediff-make-fine-diffs ) ) ; end cond (ediff-set-fine-diff-properties n) + (when (and ediff-merge-with-ancestor-job + ediff-show-ancestor) + (ediff--set-right-faces n)) ))) ;; Interface to ediff-make-fine-diffs. Checks for auto-refine limit, etc. @@ -812,7 +874,11 @@ ediff-set-fine-diff-properties (ediff-set-fine-diff-properties-in-one-buffer 'A n default) (ediff-set-fine-diff-properties-in-one-buffer 'B n default) (if ediff-3way-job - (ediff-set-fine-diff-properties-in-one-buffer 'C n default))))) + (ediff-set-fine-diff-properties-in-one-buffer 'C n default)) + (when (and ediff-merge-with-ancestor-job + ediff-show-ancestor) + (ediff-set-fine-diff-properties-in-one-buffer 'Ancestor n default)) +))) (defun ediff-set-fine-diff-properties-in-one-buffer (buf-type n &optional default) @@ -900,9 +966,11 @@ ediff-set-fine-overlays-in-one-buffer (defun ediff-convert-fine-diffs-to-overlays (diff-list region-num) (ediff-set-fine-overlays-in-one-buffer 'A diff-list region-num) (ediff-set-fine-overlays-in-one-buffer 'B diff-list region-num) - (if ediff-3way-job - (ediff-set-fine-overlays-in-one-buffer 'C diff-list region-num) - )) + (when ediff-3way-job + (ediff-set-fine-overlays-in-one-buffer 'C diff-list region-num) + (when (and ediff-merge-with-ancestor-job + ediff-show-ancestor) + (ediff-set-fine-overlays-in-one-buffer 'Ancestor diff-list region-num)))) ;; Stolen from emerge.el @@ -955,9 +1023,7 @@ ediff-extract-diffs3 (c-prev 1) (c-prev-pt nil) (anc-prev 1) - diff-list shift-A shift-B shift-C - ) - + diff-list shift-A shift-B shift-C) ;; diff list contains word numbers or points, depending on word-mode (setq diff-list (cons (if word-mode 'words 'points) diff-list)) @@ -989,125 +1055,123 @@ ediff-extract-diffs3 (goto-char (point-min)) (while (re-search-forward ediff-match-diff3-line nil t) ;; leave point after matched line - (beginning-of-line 2) - (let ((agreement (buffer-substring (match-beginning 1) (match-end 1)))) - ;; if the files A and B are the same and not 3way-comparison, - ;; ignore the difference - (if (or three-way-comp (not (string-equal agreement "3"))) - (let* ((a-begin (car (ediff-get-diff3-group "1"))) - (a-end (nth 1 (ediff-get-diff3-group "1"))) - (b-begin (car (ediff-get-diff3-group "2"))) - (b-end (nth 1 (ediff-get-diff3-group "2"))) - (c-or-anc-begin (car (ediff-get-diff3-group "3"))) - (c-or-anc-end (nth 1 (ediff-get-diff3-group "3"))) - (state-of-merge - (cond ((string-equal agreement "1") 'prefer-A) - ((string-equal agreement "2") 'prefer-B) - (t ediff-default-variant))) - (state-of-diff-merge - (if (memq state-of-merge '(default-A prefer-A)) 'B 'A)) - (state-of-diff-comparison - (cond ((string-equal agreement "1") 'A) - ((string-equal agreement "2") 'B) - ((string-equal agreement "3") 'C))) - state-of-ancestor - c-begin c-end - a-begin-pt a-end-pt - b-begin-pt b-end-pt - c-begin-pt c-end-pt - anc-begin-pt anc-end-pt) - - (setq state-of-ancestor - (= c-or-anc-begin c-or-anc-end)) - - (cond (three-way-comp - (setq c-begin c-or-anc-begin - c-end c-or-anc-end)) - ((eq ediff-default-variant 'default-B) - (setq c-begin b-begin - c-end b-end)) - (t - (setq c-begin a-begin - c-end a-end))) - - ;; compute main diff vector - (if word-mode - ;; make diff-list contain word numbers - (setq diff-list - (nconc diff-list - (list (vector - (- a-begin a-prev) (- a-end a-begin) - (- b-begin b-prev) (- b-end b-begin) - (- c-begin c-prev) (- c-end c-begin) - nil nil ; dummy ancestor - nil ; state of diff - nil ; state of merge - nil ; state of ancestor - ))) - a-prev a-end - b-prev b-end - c-prev c-end) - ;; else convert lines to points - (ediff-with-current-buffer A-buffer - (goto-char (or a-prev-pt shift-A (point-min))) - (forward-line (- a-begin a-prev)) - (setq a-begin-pt (point)) - (forward-line (- a-end a-begin)) - (setq a-end-pt (point) - a-prev a-end - a-prev-pt a-end-pt)) - (ediff-with-current-buffer B-buffer - (goto-char (or b-prev-pt shift-B (point-min))) - (forward-line (- b-begin b-prev)) - (setq b-begin-pt (point)) - (forward-line (- b-end b-begin)) - (setq b-end-pt (point) - b-prev b-end - b-prev-pt b-end-pt)) - (ediff-with-current-buffer C-buffer - (goto-char (or c-prev-pt shift-C (point-min))) - (forward-line (- c-begin c-prev)) - (setq c-begin-pt (point)) - (forward-line (- c-end c-begin)) - (setq c-end-pt (point) - c-prev c-end - c-prev-pt c-end-pt)) - (if (ediff-buffer-live-p anc-buffer) - (ediff-with-current-buffer anc-buffer - (forward-line (- c-or-anc-begin anc-prev)) - (setq anc-begin-pt (point)) - (forward-line (- c-or-anc-end c-or-anc-begin)) - (setq anc-end-pt (point) - anc-prev c-or-anc-end))) - (setq diff-list - (nconc - diff-list - ;; if comparing with ancestor, then there also is a - ;; state-of-difference marker - (if three-way-comp - (list (vector - a-begin-pt a-end-pt - b-begin-pt b-end-pt - c-begin-pt c-end-pt - nil nil ; ancestor begin/end - state-of-diff-comparison - nil ; state of merge - nil ; state of ancestor - )) - (list (vector a-begin-pt a-end-pt - b-begin-pt b-end-pt - c-begin-pt c-end-pt - anc-begin-pt anc-end-pt - state-of-diff-merge - state-of-merge - state-of-ancestor - ))) - ))) - )) - - ))) ; end ediff-with-current-buffer - diff-list - )) + (beginning-of-line 2) + (let ((agreement (buffer-substring (match-beginning 1) (match-end 1)))) + ;; Show diffs even if A and B are the same when + ;; ediff-hide-equal-diffs-with-ancestor is nil. + (unless (and (string-equal agreement "3") + ediff-hide-equal-diffs-with-ancestor) + (let* ((a-begin (car (ediff-get-diff3-group "1"))) + (a-end (nth 1 (ediff-get-diff3-group "1"))) + (b-begin (car (ediff-get-diff3-group "2"))) + (b-end (nth 1 (ediff-get-diff3-group "2"))) + (c-or-anc-begin (car (ediff-get-diff3-group "3"))) + (c-or-anc-end (nth 1 (ediff-get-diff3-group "3"))) + (state-of-merge + (cond ((string-equal agreement "1") 'prefer-A) + ((string-equal agreement "2") 'prefer-B) + ((string-equal agreement "3") 'A=B) + (t ediff-default-variant))) + (state-of-diff-merge + (if (memq state-of-merge '(default-A prefer-A)) 'B 'A)) + (state-of-diff-comparison + (cond ((string-equal agreement "1") 'A) + ((string-equal agreement "2") 'B) + ((string-equal agreement "3") 'C))) + state-of-ancestor + c-begin c-end + a-begin-pt a-end-pt + b-begin-pt b-end-pt + c-begin-pt c-end-pt + anc-begin-pt anc-end-pt) + + (setq state-of-ancestor + (= c-or-anc-begin c-or-anc-end)) + + (cond (three-way-comp + (setq c-begin c-or-anc-begin + c-end c-or-anc-end)) + ((eq ediff-default-variant 'default-B) + (setq c-begin b-begin + c-end b-end)) + (t + (setq c-begin a-begin + c-end a-end))) + + ;; compute main diff vector + (if word-mode + ;; make diff-list contain word numbers + (setq diff-list + (nconc diff-list + (list (vector + (- a-begin a-prev) (- a-end a-begin) + (- b-begin b-prev) (- b-end b-begin) + (- c-begin c-prev) (- c-end c-begin) + nil nil ; dummy ancestor + nil ; state of diff + nil ; state of merge + nil ; state of ancestor + ))) + a-prev a-end + b-prev b-end + c-prev c-end) + ;; else convert lines to points + (ediff-with-current-buffer A-buffer + (goto-char (or a-prev-pt shift-A (point-min))) + (forward-line (- a-begin a-prev)) + (setq a-begin-pt (point)) + (forward-line (- a-end a-begin)) + (setq a-end-pt (point) + a-prev a-end + a-prev-pt a-end-pt)) + (ediff-with-current-buffer B-buffer + (goto-char (or b-prev-pt shift-B (point-min))) + (forward-line (- b-begin b-prev)) + (setq b-begin-pt (point)) + (forward-line (- b-end b-begin)) + (setq b-end-pt (point) + b-prev b-end + b-prev-pt b-end-pt)) + (ediff-with-current-buffer C-buffer + (goto-char (or c-prev-pt shift-C (point-min))) + (forward-line (- c-begin c-prev)) + (setq c-begin-pt (point)) + (forward-line (- c-end c-begin)) + (setq c-end-pt (point) + c-prev c-end + c-prev-pt c-end-pt)) + (if (ediff-buffer-live-p anc-buffer) + (ediff-with-current-buffer anc-buffer + (forward-line (- c-or-anc-begin anc-prev)) + (setq anc-begin-pt (point)) + (forward-line (- c-or-anc-end c-or-anc-begin)) + (setq anc-end-pt (point) + anc-prev c-or-anc-end))) + (setq diff-list + (nconc + diff-list + ;; if comparing with ancestor, then there also is a + ;; state-of-difference marker + (if three-way-comp + (list (vector + a-begin-pt a-end-pt + b-begin-pt b-end-pt + c-begin-pt c-end-pt + nil nil ; ancestor begin/end + state-of-diff-comparison + nil; state of merge + nil ; state of ancestor + )) + (list (vector a-begin-pt a-end-pt + b-begin-pt b-end-pt + c-begin-pt c-end-pt + anc-begin-pt anc-end-pt + state-of-diff-merge + state-of-merge + state-of-ancestor + )))))))) + ))) ; end ediff-with-current-buffer + diff-list)) ;; Generate the difference vector and overlays for three files ;; File-C is either the third file to compare (in case of 3-way comparison) diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el index 66a2a0f527..7e5291db5b 100644 --- a/lisp/vc/ediff-init.el +++ b/lisp/vc/ediff-init.el @@ -665,7 +665,7 @@ ediff-protected-variables ;; [ status status status ...] ;; Each status: [state-of-merge state-of-ancestor] -;; state-of-merge is default-A, default-B, prefer-A, or prefer-B. It +;; state-of-merge is default-A, default-B, prefer-A, prefer-B or A=B. It ;; indicates the way a diff region was created in buffer C. ;; state-of-ancestor says if the corresponding region in ancestor buffer is ;; empty. @@ -1067,6 +1067,52 @@ ediff-fine-diff-Ancestor At present, this face is not used and no fine differences are computed for the ancestor buffer." :group 'ediff-highlighting) + +(defface ediff-fine-diff-Ancestor-A + '((t (:inherit ediff-fine-diff-A))) + "Face for highlighting refinement parts in Ancestor buffer due to buffer A." + :group 'ediff-highlighting + :version "26.1") + +;; An internal variable. Ediff takes the face from here. When unhighlighting, +;; this variable is set to nil, then again to the appropriate face. +(defvar ediff-fine-diff-face-Ancestor-A 'ediff-fine-diff-Ancestor-A + "Face for highlighting the fine differences in buffer Ancestor comming from buffer A. +DO NOT CHANGE this variable. Instead, use the customization +widget to customize the actual face object `ediff-fine-diff-Ancestor-A' +this variable represents.") +(ediff-hide-face ediff-fine-diff-face-Ancestor-A) + +(defface ediff-fine-diff-Ancestor-B + '((t (:inherit ediff-fine-diff-B))) + "Face for highlighting refinement parts in Ancestor buffer due to buffer B." + :group 'ediff-highlighting + :version "26.1") + +;; An internal variable. Ediff takes the face from here. When unhighlighting, +;; this variable is set to nil, then again to the appropriate face. +(defvar ediff-fine-diff-face-Ancestor-B 'ediff-fine-diff-Ancestor-B + "Face for highlighting the fine differences in buffer Ancestor comming from buffer B. +DO NOT CHANGE this variable. Instead, use the customization +widget to customize the actual face object `ediff-fine-diff-Ancestor-B' +this variable represents.") +(ediff-hide-face ediff-fine-diff-face-Ancestor-B) + +(defface ediff-fine-diff-AB + '((t (:inherit match))) + "Face for highlighting refinement parts common to buffers A and B." + :group 'ediff-highlighting + :version "26.1") + +;; An internal variable. Ediff takes the face from here. When unhighlighting, +;; this variable is set to nil, then again to the appropriate face. +(defvar ediff-fine-diff-face-AB 'ediff-fine-diff-AB + "Face for highlighting the fine differences common to buffers A and B. +DO NOT CHANGE this variable. Instead, use the customization +widget to customize the actual face object `ediff-fine-diff-AB' +this variable represents.") +(ediff-hide-face ediff-fine-diff-face-AB) + ;; An internal variable. Ediff takes the face from here. When unhighlighting, ;; this variable is set to nil, then again to the appropriate face. (defvar ediff-fine-diff-face-Ancestor 'ediff-fine-diff-Ancestor @@ -1324,6 +1370,12 @@ ediff-fine-diff-face-alist "A `refinement' of the current difference region") (put ediff-fine-diff-face-Ancestor 'ediff-help-echo "A `refinement' of the current difference region") +(put ediff-fine-diff-face-Ancestor-A 'ediff-help-echo + "Parts of `refinement' of the current difference region due to buffer A") +(put ediff-fine-diff-face-Ancestor-B 'ediff-help-echo + "Parts of `refinement' of the current difference region due to buffer B") +(put ediff-fine-diff-face-AB 'ediff-help-echo + "Parts of `refinement' of the current difference common to buffes A and B") (add-hook 'ediff-quit-hook 'ediff-cleanup-mess) (add-hook 'ediff-suspend-hook 'ediff-default-suspend-function) @@ -1438,6 +1490,8 @@ ediff-H-glyph (ediff-defvar-local ediff-temp-file-B nil "") ;; Temporary file used for refining difference regions in buffer C. (ediff-defvar-local ediff-temp-file-C nil "") +;; Temporary file used for refining difference regions in buffer Ancestor. +(ediff-defvar-local ediff-temp-file-Ancestor nil "") (defun ediff-file-remote-p (file-name) @@ -1520,7 +1574,11 @@ ediff-clear-fine-differences (ediff-clear-fine-differences-in-one-buffer n 'A) (ediff-clear-fine-differences-in-one-buffer n 'B) (if ediff-3way-job - (ediff-clear-fine-differences-in-one-buffer n 'C))) + (ediff-clear-fine-differences-in-one-buffer n 'C)) + (when (and ediff-merge-with-ancestor-job + ediff-show-ancestor) + (ediff-clear-fine-differences-in-one-buffer n 'Ancestor)) + ) (defsubst ediff-mouse-event-p (event) diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el index 25dd2988bb..fb3d85b758 100644 --- a/lisp/vc/ediff-util.el +++ b/lisp/vc/ediff-util.el @@ -2617,13 +2617,13 @@ ediff-good-frame-under-mouse (defun ediff-delete-temp-files () - (if (and (stringp ediff-temp-file-A) (file-exists-p ediff-temp-file-A)) - (delete-file ediff-temp-file-A)) - (if (and (stringp ediff-temp-file-B) (file-exists-p ediff-temp-file-B)) - (delete-file ediff-temp-file-B)) - (if (and (stringp ediff-temp-file-C) (file-exists-p ediff-temp-file-C)) - (delete-file ediff-temp-file-C))) - + (mapc (lambda (x) + (when (and (stringp x) (file-exists-p x)) + (delete-file x))) + (list ediff-temp-file-A + ediff-temp-file-B + ediff-temp-file-C + ediff-temp-file-Ancestor))) ;; Kill control buffer, other auxiliary Ediff buffers. ;; Leave one of the frames split between buffers A/B/C -- 2.11.0 >From 50b874fc64d8303ce7be71026e76fd28e5b1a91e Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Sun, 19 Feb 2017 19:15:16 +0900 Subject: [PATCH 3/3] diff-mode: Improve default faces for buffer ancestor * lisp/vc/ediff-init.el (ediff-current-diff-Ancestor) (ediff-fine-diff-Ancestor): Use defaults consistent with faces for 'ediff-buffer-A' and 'ediff-buffer-B'. --- lisp/vc/ediff-init.el | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el index 7e5291db5b..6b5bdca347 100644 --- a/lisp/vc/ediff-init.el +++ b/lisp/vc/ediff-init.el @@ -943,13 +943,17 @@ ediff-current-diff-face-C (defface ediff-current-diff-Ancestor (if (featurep 'emacs) - '((((class color) (min-colors 88)) - (:background "VioletRed")) - (((class color) (min-colors 16)) - (:foreground "Black" :background "VioletRed")) - (((class color)) - (:foreground "black" :background "magenta3")) - (t (:inverse-video t))) + '((((class color) (min-colors 88) (background light)) + :background "#cfdeee") + (((class color) (min-colors 88) (background dark)) + :background "#004151") + (((class color) (min-colors 16) (background light)) + :background "#cfdeee") + (((class color) (min-colors 16) (background dark)) + :background "#004151") + (((class color)) + (:foreground "black" :background "magenta3")) + (t (:inverse-video t))) '((((type tty)) (:foreground "black" :background "magenta3")) (((class color)) (:foreground "Black" :background "VioletRed")) (t (:inverse-video t)))) @@ -1053,13 +1057,17 @@ ediff-fine-diff-face-C (defface ediff-fine-diff-Ancestor (if (featurep 'emacs) - '((((class color) (min-colors 88)) - (:background "Green")) - (((class color) (min-colors 16)) - (:foreground "Black" :background "Green")) - (((class color)) - (:foreground "red3" :background "green")) - (t (:underline t :stipple "gray3"))) + '((((class color) (min-colors 88) (background light)) + :background "#00c5c0") + (((class color) (min-colors 88) (background dark)) + :background "#009591") + (((class color) (min-colors 16) (background light)) + :background "#00c5c0") + (((class color) (min-colors 16) (background dark)) + :background "#009591") + (((class color)) + (:foreground "red3" :background "green")) + (t (:underline t :stipple "gray3"))) '((((type tty)) (:foreground "red3" :background "green")) (((class color)) (:foreground "Black" :background "Green")) (t (:underline t :stipple "gray3")))) -- 2.11.0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PATCH ENDS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; In GNU Emacs 26.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.7) of 2017-02-19 Repository revision: 938426d1ca0930b859c3e37b26513f5d74761284 From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 26 06:35:17 2017 Received: (at 25493) by debbugs.gnu.org; 26 Feb 2017 11:35:17 +0000 Received: from localhost ([127.0.0.1]:56310 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1chx6j-00025B-84 for submit@debbugs.gnu.org; Sun, 26 Feb 2017 06:35:17 -0500 Received: from sinyavsky.aurox.ch ([37.35.109.145]:51355) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1chx6h-00024x-Gr for 25493@debbugs.gnu.org; Sun, 26 Feb 2017 06:35:16 -0500 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id 7DB072237A for <25493@debbugs.gnu.org>; Sun, 26 Feb 2017 11:32:03 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= content-type:content-type:mime-version:message-id:in-reply-to :date:date:references:subject:subject:to:from:from; s=dkim; t= 1488108722; x=1488972723; bh=0FIhdRDC1BOH78w0hpLwzsdtDw2SPkejYIr bTJ+XY0c=; b=LBCV8w+GG9vOGR0V0W4FIbk99/EMciKx+ThkpTbymjtAsGTwXjK MVM4WpQFjMeauuG+EZagONGmAEJT7ddxY3vO3NAnnPAzDlls1sWQ/9tH4PL5PXpb 7zMqhAwkU84+9FZFBnrjsaGdp/5SyWqCrSlPzN6yNJCTgwrLFslFwBBw= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id MEvSuZhLcDDc for <25493@debbugs.gnu.org>; Sun, 26 Feb 2017 11:32:02 +0000 (UTC) Received: from gray (54.4.4.85.dynamic.wline.res.cust.swisscom.ch [85.4.4.54]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id 6265022367; Sun, 26 Feb 2017 11:32:00 +0000 (UTC) From: charles@aurox.ch (Charles A. Roelli) To: Tino Calancha Subject: Re: bug#25493: 26.0.50; ediff merge should (optionally) show ancestor in fourth window References: <874lzqe9tn.fsf@calancha-pc> Date: Sun, 26 Feb 2017 12:35:06 +0100 In-Reply-To: <874lzqe9tn.fsf@calancha-pc> (Tino Calancha's message of "Sun, 19 Feb 2017 19:47:32 +0900") Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 25493 Cc: Philipp Stephani , 25493@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Wow, well done. Has this been committed yet? From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 22:55:39 2017 Received: (at 25493) by debbugs.gnu.org; 28 Feb 2017 03:55:39 +0000 Received: from localhost ([127.0.0.1]:58900 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciYt1-0000tR-42 for submit@debbugs.gnu.org; Mon, 27 Feb 2017 22:55:39 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:33344) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciYsz-0000tE-75 for 25493@debbugs.gnu.org; Mon, 27 Feb 2017 22:55:37 -0500 Received: by mail-pf0-f194.google.com with SMTP id p185so72246pfb.0 for <25493@debbugs.gnu.org>; Mon, 27 Feb 2017 19:55:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=T9C0OWRwUoeG5iUXJDBoGPXgW5lsFRf5ikXfEZBJJ4c=; b=fU4Ix/5F2y7vO3uZAFKhpjG+jOxaC/knAcSdB1z5tW19yf2u/F81w7K+8HDo2DjTPG UheNLQnazvh6JgGUrJGL4DEJscTFcRtb6HlxVNyKws6uwAeHP2wN2biUJGAM1biApFqz GESsgBEUf57a8E7CM5hHeE+0DxHU7tFc4GgW3kQ9JT5VfvEym0FFg3my8PATJg7h5MsM E/fKkiaT8lTq2esfvSGLgnRo1GdgRMrgITyi+mawuwzqcNLRuJH1Inbeejq1wnWHBUgR 2UU+6eGJJCONQekIOPUUsF3E8NDDwRkYvCvqDd0Oo/241wBuVGjln98xqrM2NzF0a1rd 5jkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=T9C0OWRwUoeG5iUXJDBoGPXgW5lsFRf5ikXfEZBJJ4c=; b=RXddlqpqEUcEP71ubUaon0A3d4sTBIldQPSolbkkl9LPVN8Q5nv6yBKxblbkB1TStp OJIid8duaMCng8R7/kpA7GpA7s1BA45dXoKZ8vP8OzbD9iw4my2pJlg1sQA1RspfXkIX J6IeejGUk6YTdaoDiRbBtNiNHLRUB5+GYydXZSGjFnuXB+/qgfavw/gmnDEOBP8EWtoK L0utTgrSuZYJUkQWOvMsOZ4Yq3Gmih05YDl7k2Ve9KvIUi/R+Erno8629csGhI8tNY70 /h6KonabNv8FV1FGZzRcScMO1YRywaibuYWa37HzO61eO3CtjKiALOomJYh3Lg1fUKwq k0rw== X-Gm-Message-State: AMke39nDgJ8zd++OrV7//VGC+I0sxZaRtlv4tSbVeOSZ/tWnHVy1FXtFhJED2GrBI43jgQ== X-Received: by 10.99.178.67 with SMTP id t3mr242777pgo.83.1488254131203; Mon, 27 Feb 2017 19:55:31 -0800 (PST) Received: from calancha-pc (104.81.147.124.dy.bbexcite.jp. [124.147.81.104]) by smtp.gmail.com with ESMTPSA id y201sm559661pfb.16.2017.02.27.19.55.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Feb 2017 19:55:30 -0800 (PST) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Tue, 28 Feb 2017 12:55:27 +0900 (JST) X-X-Sender: calancha@calancha-pc To: "Charles A. Roelli" Subject: Re: bug#25493: 26.0.50; ediff merge should (optionally) show ancestor in fourth window In-Reply-To: Message-ID: References: <874lzqe9tn.fsf@calancha-pc> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 25493 Cc: Philipp Stephani , 25493@debbugs.gnu.org, Tino Calancha X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) On Sun, 26 Feb 2017, Charles A. Roelli wrote: > Wow, well done. Has this been committed yet? No yet. I am waiting for aproval. People must be busy preparing the Emacs 25.2 release. If we don't get feedback in a while we can ask for opinion in its emacs-devel thread: https://lists.gnu.org/archive/html/emacs-devel/2017-01/msg00375.html From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 27 23:41:53 2017 Received: (at 25493) by debbugs.gnu.org; 28 Feb 2017 04:41:53 +0000 Received: from localhost ([127.0.0.1]:58921 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciZbl-0001xf-Gh for submit@debbugs.gnu.org; Mon, 27 Feb 2017 23:41:53 -0500 Received: from mail-io0-f196.google.com ([209.85.223.196]:36620) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciZbk-0001xS-9F for 25493@debbugs.gnu.org; Mon, 27 Feb 2017 23:41:52 -0500 Received: by mail-io0-f196.google.com with SMTP id w10so392118iod.3 for <25493@debbugs.gnu.org>; Mon, 27 Feb 2017 20:41:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=EocxorSeR+zyiRf70cCSIooeA3kz9JbaISaYfd6DHzs=; b=ie0hUetvhcysy9W0yQF4Q5cUFITlYSgxwd3kL/aUeorYVeXO/4J6g81Yq2h2eJIoI1 Ofuy3Gbmv0NnUH9s4qgn4X0PfsScd8z3EZIkWg1sNxGJtayJqrhoE7/44kuf3AC2Sxgl QO1I96Qr30D4o6Wa4UgfUetyIr1eXikbuu09CGFl1dyfFo8ayFMjWs/jCEG2LuwHi7GS Tylnkhrn+LQ6YLAj7VjFc+gkVi2FWiEoGWvBYq2JSTTG9+ZQxrBcPnzoc0v0EYhPfrec DQBoVb1IIOTcxhMX8JDnxI1FcmczvEwp9iy+F4FeotOr6jhXOr75CvhMXGzN3AOW02VV jw+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=EocxorSeR+zyiRf70cCSIooeA3kz9JbaISaYfd6DHzs=; b=D07WfOlZQBEFZTce2nslNDI8K03d0sGMk4Z7Ds7tr9/+U1QJ6B3JShWGFSSfBJvrrK N54jwv/oJ32UrbOgjYsbZwa5T8RcPPmJXM+dgiP38VnjLx89Gz49rDXrm0oJhzigeNkD LHb7jIXCTT1UmGkUHLetvQZ/hk80n48lllsGeE5OIExFTqP55P7Vp9oI7dgBSk7rft5D t9FqnfD3RdkQljuR1GXELtuySaBdPk9FqJIeEXZfhTLFoIKD0SjXUwUBru8FsAFv/mtn EWWZrwxCHcGmYWELPzFppGUm9KktY0e03GFM6dpGUpDnKeR8+P4Kj0aJj/F3kljSyoKl hMPQ== X-Gm-Message-State: AMke39nSlYM1JcYbhVSEvgbjNyEdCuSF/0gD+asSS09AncQXBuxxU7SV2wnOYkOl7AqpVw== X-Received: by 10.107.63.196 with SMTP id m187mr750182ioa.149.1488256906771; Mon, 27 Feb 2017 20:41:46 -0800 (PST) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id d5sm6136389itd.3.2017.02.27.20.41.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Feb 2017 20:41:46 -0800 (PST) From: npostavs@users.sourceforge.net To: Tino Calancha Subject: Re: bug#25493: 26.0.50; ediff merge should (optionally) show ancestor in fourth window References: <874lzqe9tn.fsf@calancha-pc> Date: Mon, 27 Feb 2017 23:42:58 -0500 In-Reply-To: (Tino Calancha's message of "Tue, 28 Feb 2017 12:55:27 +0900 (JST)") Message-ID: <871sujdiy5.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 25493 Cc: Philipp Stephani , "Charles A. Roelli" , 25493@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) Tino Calancha writes: > On Sun, 26 Feb 2017, Charles A. Roelli wrote: > >> Wow, well done. Has this been committed yet? > No yet. I am waiting for aproval. > People must be busy preparing the Emacs 25.2 release. It's a big patch, I haven't had time to digest the whole thing yet, but I'm wondering about why do we need both "\ show/hide ancestor" and "/ -show ancestor buff"? ~ -swap variants | s -shrink window C | / -show ancestor buff | $$ -show clashes only | & -merge w/new default | $* -skip changed regions | + | $% -all ancestor diffs | + | \\ -show/hide ancestor | From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 28 01:40:10 2017 Received: (at 25493) by debbugs.gnu.org; 28 Feb 2017 06:40:10 +0000 Received: from localhost ([127.0.0.1]:58966 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cibSE-0006Z3-GN for submit@debbugs.gnu.org; Tue, 28 Feb 2017 01:40:10 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:33643) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cibSA-0006YS-Hr for 25493@debbugs.gnu.org; Tue, 28 Feb 2017 01:40:08 -0500 Received: by mail-pg0-f67.google.com with SMTP id x17so527382pgi.0 for <25493@debbugs.gnu.org>; Mon, 27 Feb 2017 22:40:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=nbZ7SJlLPf12vMdsjVanjp/qkrM23qB+HHTiBYdZK+8=; b=goTeNP7EWvieZJiwrsouqbfyESzoiiaMYR73GemlPGAuKFkjyM5ax9s+HF5BVSILfc 5IO7oogT2mc1LXywglB0dhJ0UOXWEl5AuwYim4shsbQ1VMRrNRHc6pHiTmfWg3j7zlcE thBvGiMkJT5MITNl3jxA2UjwHeXzjqu1XfMW5JFd9Zc6PadkGNq4atovKVUzciHOO4rR Rpl8a5aAAEtx9groBQY3SOvDBTLr3ghnDRoRXFW9fs6E6eULmXw3+bUtemIuHTbM4cPI Z4i0hsaszuXRAlET/E1ljrNHNp1BDhEBHfs8VxrxVzbGYM/nxlXOzrq8Gd8al0qD8K1g YmhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=nbZ7SJlLPf12vMdsjVanjp/qkrM23qB+HHTiBYdZK+8=; b=eZDASDL9K8QnSR8SA5w1Nq6O4FBr+dQ1KTDr4Mk1IHgsHj/NkXtJIfbtT/m3acpRQq G3f1y+u7GSnWAvYE3iPjy0TlllgXL8LTt6yXUjPV97mfKOUvOhePFpxaBopJ1uTYWcxj RrYhqW2LRQC70+hTp43k4agSUL1HsuCDJM1uWwWGjcdR7GcpgbQZPR9UGZhvK+6hRRJY 0ZlylZCOhwXzHGVTJAmE6zH0OXyqkEK01MkKhdhamtfpd1BrJvGuhjxYBeKfJ5VUW3n6 z93JNqlgCST85zBYd9qEbsH20lNLP0M2P4fcwNohyfckFq8zPrp7Fcdz7Rp0jot+URHM e/wg== X-Gm-Message-State: AMke39lBJnMbgfOUY1tQ64aW28NC8+9q/G5TwqDbSEebYCdIWVCs14IG8FRn5h24gV0m5g== X-Received: by 10.99.36.7 with SMTP id k7mr840358pgk.201.1488264000873; Mon, 27 Feb 2017 22:40:00 -0800 (PST) Received: from calancha-pc (104.81.147.124.dy.bbexcite.jp. [124.147.81.104]) by smtp.gmail.com with ESMTPSA id l3sm1638984pgn.10.2017.02.27.22.39.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Feb 2017 22:40:00 -0800 (PST) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Tue, 28 Feb 2017 15:39:57 +0900 (JST) X-X-Sender: calancha@calancha-pc To: npostavs@users.sourceforge.net Subject: Re: bug#25493: 26.0.50; ediff merge should (optionally) show ancestor in fourth window In-Reply-To: <871sujdiy5.fsf@users.sourceforge.net> Message-ID: References: <874lzqe9tn.fsf@calancha-pc> <871sujdiy5.fsf@users.sourceforge.net> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 25493 Cc: Philipp Stephani , "Charles A. Roelli" , 25493@debbugs.gnu.org, Tino Calancha X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) On Mon, 27 Feb 2017, npostavs@users.sourceforge.net wrote: > Tino Calancha writes: > >> On Sun, 26 Feb 2017, Charles A. Roelli wrote: >> >>> Wow, well done. Has this been committed yet? >> No yet. I am waiting for aproval. >> People must be busy preparing the Emacs 25.2 release. > > It's a big patch, I haven't had time to digest the whole thing yet, Thanks for look on it. Please, take your time. > I'm wondering about why do we need both "\ show/hide ancestor" and "/ > -show ancestor buff"? > > ~ -swap variants | s -shrink window C | / -show ancestor buff > | $$ -show clashes only | & -merge w/new default > | $* -skip changed regions | > + | $% -all ancestor diffs | > + | \\ -show/hide ancestor | Yeah, it's weird. I though about that. Probably we just need the toggle show/hide; we might use for it the original key binding for show ancestor. In first iteration i wanted just to provide the new feature and let people suggest if something must be drop/supersed. From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 04 18:05:43 2017 Received: (at 25493) by debbugs.gnu.org; 4 Mar 2017 23:05:43 +0000 Received: from localhost ([127.0.0.1]:40367 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ckIkB-0003TT-9S for submit@debbugs.gnu.org; Sat, 04 Mar 2017 18:05:43 -0500 Received: from mail-io0-f195.google.com ([209.85.223.195]:35532) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ckIk9-0003TD-Bp for 25493@debbugs.gnu.org; Sat, 04 Mar 2017 18:05:41 -0500 Received: by mail-io0-f195.google.com with SMTP id f103so10325521ioi.2 for <25493@debbugs.gnu.org>; Sat, 04 Mar 2017 15:05:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=ToRjI681lF56ZabAS1bjGmKvRtg/7Mg+S9NCgoWzPHQ=; b=J05Wb5/Fuuip7vH9/gJY37O/2r8MIugptGTLWoOYk2ABKp30q2KVd3wz82AbjZ0ZHi S/XD/fCoXwzyYngNJvKaxzS2z7kWLJdIIrJ3gWyQzT1NwM8jPFh7/OcMOHsbbToRM2Gz BWhy2PehhZC3JOkaTzzJP+6dMDgr0fOitLIKDCwPdxdc8GuFbzFdej1wKKasSICEzmfT pSFINFzQD4WorbInQ1JbNowNR8s+cVftVvm4i1ZkbUjSDYCZNGi2263oiqPY1qB4LQly 1DFD/woBf2ejiJVSWkmf+cjmosbNu9CFadHgBU2XldebjZmOXPK3fNlDV7g1r1yCpQF0 L9pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=ToRjI681lF56ZabAS1bjGmKvRtg/7Mg+S9NCgoWzPHQ=; b=dqdDwzap5uwZ597AtzJu2n6mc//WqLo6IuFp7NMSW14jgfkcgt/NhZJw/I8K1r9BiU wvcPG3/u6mfja4g3iKrXOxiox056qURUnekFwjrKEFRlOozJitGeLbusLL4FgjxgxU7Z gBqkkYLb7Aas+V9XY9DYMjSvsZv5LI6KBoYyZ766IshmHWAf+ja+mFjAj5fK06SQJnaM o18Ve4Hm2SdJLE8kgazukDU4WLGx2KIoNGZRhjS6sAwepVSAWRU/DlehPXQG0BW11O2c KhXIdRpA5aVE0KyekeEsEOUQcg3GD2g4SJ35X5F+G3RPGxx/PB3PweXKCiVxlR20pA4w 331g== X-Gm-Message-State: AMke39mzIjxseM5pA69flRSm5/CJotNhtYPAAowu/PkerKAxhZUJnrUrDhbLULWxAz1ecw== X-Received: by 10.107.24.197 with SMTP id 188mr9838660ioy.151.1488668735849; Sat, 04 Mar 2017 15:05:35 -0800 (PST) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id j14sm3747610itd.0.2017.03.04.15.05.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 04 Mar 2017 15:05:35 -0800 (PST) From: npostavs@users.sourceforge.net To: Tino Calancha Subject: Re: bug#25493: 26.0.50; ediff merge should (optionally) show ancestor in fourth window References: <874lzqe9tn.fsf@calancha-pc> Date: Sat, 04 Mar 2017 18:06:50 -0500 In-Reply-To: <874lzqe9tn.fsf@calancha-pc> (Tino Calancha's message of "Sun, 19 Feb 2017 19:47:32 +0900") Message-ID: <87fuisabg5.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 25493 Cc: Philipp Stephani , 25493@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) Tino Calancha writes: > Philipp Stephani writes: > >> It would be very useful if ediff merge could optionally display the >> ancestor in a fourth window, like vimdiff or meld. See >> https://lists.gnu.org/archive/html/emacs-devel/2017-01/msg00204.html. > > Following patch, by default, display the ancestor buffer and auto refine > it in 3way merges. > This feature can be disabled by customizing a new option. Could you perhaps explain more in the commit messages about how the patch works, at a high level? It's long enough that I get lost while reading it. As a user, I noticed that `ediff-scroll-vertically' doesn't scroll the ancestor buffer. Also, I want diff refining in buffer A and B against the ancestor, not each other. This might be more of an addtional feature request that doesn't necessarily need to addressed in your patch though. > Subject: [PATCH 1/3] Show ancestor buffer in 3way merges > > Add an option to control if the ancestor buffer must > be shown in 3way merges (Bug#25493). > Add an option to control whether if show or ignore diffs with ^^ s/if/to/ I think? > > +(defsubst ediff--check-ancestor-exists () I don't think there is reason for this to be a defsubst over a defun. > + > +(defun ediff-toggle-show-ancestor () > + (when (eq ediff-show-ancestor > + (alist-get 'ediff-show-ancestor alist)) > + (assq-delete-all 'ediff-show-ancestor alist) I think this should be (setq alist (assq-delete-all ...)) or equivalently (cl-callf assq-delete-all alist 'ediff-show-ancestor) > +(defun ediff-toggle-hide-equal-diffs-with-ancestor () > + (when (eq ediff-hide-equal-diffs-with-ancestor > + (alist-get 'ediff-hide-equal-diffs-with-ancestor > + alist)) > + (assq-delete-all 'ediff-hide-equal-diffs-with-ancestor > + alist) Again here. From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 06 09:06:57 2017 Received: (at 25493) by debbugs.gnu.org; 6 Mar 2017 14:06:57 +0000 Received: from localhost ([127.0.0.1]:41907 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cktHs-0004Ar-IH for submit@debbugs.gnu.org; Mon, 06 Mar 2017 09:06:57 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:35286) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cktHq-0004Ab-Da for 25493@debbugs.gnu.org; Mon, 06 Mar 2017 09:06:55 -0500 Received: by mail-pf0-f194.google.com with SMTP id 67so13334241pfg.2 for <25493@debbugs.gnu.org>; Mon, 06 Mar 2017 06:06:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=OAmhSaex4kxhT9px88+9/qpSsoETMTxlM7P2LRCVB18=; b=BU+oJcrDwroEBsXHa6aevh2AwfgoYcLU2BmWqrDfgMtC27M//jt3yFUZIel1Ef+ZM6 w8J3fCLJa+f4euD7iWGNvt9vFfFnrPhWwTS8uGnaFBOfp/v5D1cVNtCQ5tJp02CAAItk 7bVKm4KMsPnp9+h/vnv0YP3Blhzc6DwBcbzdmVbsu2h0U+3ckJrJXqqfoouR50EhZk+D UU60W6ss9ni0yusg1wlGHhfkMbVh373U5HfnFOobIj9CUhkDucp8EUqK9JvWnSjGVnxt SCw0zsbx1PuPUC464vCQj9GvpDzKYdt3isXerqs6RiVFZfrCU2gfFfUJZjAho9NIdOls lBFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=OAmhSaex4kxhT9px88+9/qpSsoETMTxlM7P2LRCVB18=; b=taURkk1355MecG4YPsvp8W4ty3/UTUwlhho7NjEl7lgrLx5uih6PYCLt2JtYoxLCa1 4acAwJENxFST9QwOojaxW3b8lWpURf0jFZOJIiaGT3IPJELxQwe2kK1OjPy0/GTRBvGI sDGE/hLmRu5y8RhyO2QY1jVC4Ny1cXozQinh4iD+mMr7wRdGP9QRYa0A6RLog7bNNdrg 0P4uiX5OI61M+ODhpJhZa2TPtKSptNf2O1KDP1KsXwfrUO9gYqtMo9pe1TXe5uv+jBSy Fo6HRlUPnhCWfVCZo1CbRrqBQBXZ18pfLO+MCTqNuW84I94eqFP2Al8uuiW+eRJ5LxoM /1fg== X-Gm-Message-State: AMke39kObUgrTQ4d4PDtCHQRWANi2w9k1yy86jHpW3ANJoR8FyawSTgJO13IMo0VP6sDAA== X-Received: by 10.99.37.199 with SMTP id l190mr20438127pgl.86.1488809208479; Mon, 06 Mar 2017 06:06:48 -0800 (PST) Received: from calancha-pc (128.126.156.220.dy.bbexcite.jp. [220.156.126.128]) by smtp.gmail.com with ESMTPSA id z27sm39984936pfg.38.2017.03.06.06.06.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Mar 2017 06:06:47 -0800 (PST) From: Tino Calancha To: npostavs@users.sourceforge.net Subject: Re: bug#25493: 26.0.50; ediff merge should (optionally) show ancestor in fourth window References: <874lzqe9tn.fsf@calancha-pc> <87fuisabg5.fsf@users.sourceforge.net> Date: Mon, 06 Mar 2017 23:06:44 +0900 In-Reply-To: <87fuisabg5.fsf@users.sourceforge.net> (npostavs's message of "Sat, 04 Mar 2017 18:06:50 -0500") Message-ID: <87innmh53f.fsf@calancha-pc> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 25493 Cc: Philipp Stephani , 25493@debbugs.gnu.org, tino.calancha@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) npostavs@users.sourceforge.net writes: Thanks again for looking on this. I must admit the previous patch was terrible. > Could you perhaps explain more in the commit messages about how the > patch works, at a high level? It's long enough that I get lost while > reading it. OK. I have simplified the patch a lot. I have restricted to the problem in hands: to show the buffer ancestor in 3way merges. The refinement of this buffer must keep in the TODO list (see below). > As a user, I noticed that `ediff-scroll-vertically' doesn't scroll the > ancestor buffer. Good catch! Fixed in the new patch. > Also, I want diff refining in buffer A and B against the ancestor, not > each other. This might be more of an addtional feature request that > doesn't necessarily need to addressed in your patch though. It sounds like a nice idea. We should open a new bug report once we finish this one: there we can implement those refinements with the ancestor. --8<-----------------------------cut here---------------start------------->8--- >From e86a53982794f421c393cd2d6f935cd4bb666852 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Mon, 6 Mar 2017 13:24:07 +0900 Subject: [PATCH 1/2] diff-mode: Improve default faces for buffer ancestor * lisp/vc/ediff-init.el (ediff-current-diff-Ancestor) (ediff-fine-diff-Ancestor): Use defaults consistent with faces for 'ediff-buffer-A' and 'ediff-buffer-B'. --- lisp/vc/ediff-init.el | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el index 0235926fbe..535fdbfc90 100644 --- a/lisp/vc/ediff-init.el +++ b/lisp/vc/ediff-init.el @@ -942,13 +942,17 @@ ediff-current-diff-face-C (defface ediff-current-diff-Ancestor (if (featurep 'emacs) - '((((class color) (min-colors 88)) - (:background "VioletRed")) - (((class color) (min-colors 16)) - (:foreground "Black" :background "VioletRed")) - (((class color)) - (:foreground "black" :background "magenta3")) - (t (:inverse-video t))) + '((((class color) (min-colors 88) (background light)) + :background "#cfdeee") + (((class color) (min-colors 88) (background dark)) + :background "#004151") + (((class color) (min-colors 16) (background light)) + :background "#cfdeee") + (((class color) (min-colors 16) (background dark)) + :background "#004151") + (((class color)) + (:foreground "black" :background "magenta3")) + (t (:inverse-video t))) '((((type tty)) (:foreground "black" :background "magenta3")) (((class color)) (:foreground "Black" :background "VioletRed")) (t (:inverse-video t)))) @@ -1052,13 +1056,17 @@ ediff-fine-diff-face-C (defface ediff-fine-diff-Ancestor (if (featurep 'emacs) - '((((class color) (min-colors 88)) - (:background "Green")) - (((class color) (min-colors 16)) - (:foreground "Black" :background "Green")) - (((class color)) - (:foreground "red3" :background "green")) - (t (:underline t :stipple "gray3"))) + '((((class color) (min-colors 88) (background light)) + :background "#00c5c0") + (((class color) (min-colors 88) (background dark)) + :background "#009591") + (((class color) (min-colors 16) (background light)) + :background "#00c5c0") + (((class color) (min-colors 16) (background dark)) + :background "#009591") + (((class color)) + (:foreground "red3" :background "green")) + (t (:underline t :stipple "gray3"))) '((((type tty)) (:foreground "red3" :background "green")) (((class color)) (:foreground "Black" :background "Green")) (t (:underline t :stipple "gray3")))) -- 2.11.0 >From a67907ba3166b3bcc22504c099b056c072fd1d09 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Mon, 6 Mar 2017 22:47:09 +0900 Subject: [PATCH 2/2] Show ancestor buffer in 3way merges Add an option ediff-show-ancestor', to control if the ancestor buffer must be shown in 3way merges (Bug#25493); set it non-nil by default. Add a toggle to change this option interactively; the original value of the option is restored on exit. Update the window setup so that the ancestor buffer is shown in 3way merges when ediff-show-ancestor is non-nil. Any operation on ediff windows must take in account the ancestor window as well, when this is shown. * lisp/vc/ediff-init.el (ediff-show-ancestor): New option. (ediff--show-ancestor-orig): New defvar. * lisp/vc/ediff-wind.el (ediff-window-Ancestor): New defvar. (ediff-setup-windows-plain-merge, ediff-setup-windows-multiframe-merge): Display ancestor buffer if ediff-show-ancestor is non-nil. (ediff-keep-window-config): Expect ancestor window in ediff-window-config-saved. (ediff-window-alist): Add entry for the ancestor window. * lisp/vc/ediff-util.el (ediff-setup-control-buffer): ediff-window-config-saved contains ancestor window. (ediff-show-ancestor): Delete this command. (ediff-setup-keymap): Bind ediff-toggle-show-ancestor to '/' for merge jobs. (ediff-update-diffs): Compute new diffs using ancestor buffer. (ediff-recenter): Update doc string. Consider the ancestor buffer. (ediff--check-ancestor-exists): New defun. (ediff-toggle-show-ancestor): New command; toggle ediff-show-ancestor. (ediff--restore-options-on-exit): Restore ediff-show-ancestor on exit. (ediff-scroll-vertically, ediff-scroll-horizontally) (ediff-operate-on-windows): Consider the ancestor as well. * lisp/vc/ediff-help.el (ediff-long-help-message-merge): List ediff-toggle-show-ancestor. * doc/misc/ediff.texi (Introduction, Quick Help Commands): Update manual. ; * etc/NEWS: Announce these changes. --- doc/misc/ediff.texi | 8 ++- etc/NEWS | 5 ++ lisp/vc/ediff-help.el | 2 +- lisp/vc/ediff-init.el | 10 ++++ lisp/vc/ediff-util.el | 155 ++++++++++++++++++++++++++++++++------------------ lisp/vc/ediff-wind.el | 86 ++++++++++++++++++++++++---- 6 files changed, 197 insertions(+), 69 deletions(-) diff --git a/doc/misc/ediff.texi b/doc/misc/ediff.texi index 19b7adbd66..87d3dfd6ed 100644 --- a/doc/misc/ediff.texi +++ b/doc/misc/ediff.texi @@ -99,7 +99,8 @@ Introduction another (and recover old differences if you change your mind). Another powerful feature is the ability to merge a pair of files into a -third buffer. Merging with an ancestor file is also supported. +third buffer. Merging with an ancestor file, (a.k.a. 3way merges) +is also supported. Furthermore, Ediff is equipped with directory-level capabilities that allow the user to conveniently launch browsing or merging sessions on groups of files in two (or three) different directories. @@ -828,7 +829,10 @@ Quick Help Commands @item / @kindex / -Displays the ancestor file during merges. +@vindex ediff-show-ancestor +Toggle to display the ancestor file in 3way merges. +You can enable permanently this setting customizing the variable +@code{ediff-show-ancestor}. @item & @kindex & In some situations, such as when one of the files agrees with the ancestor file diff --git a/etc/NEWS b/etc/NEWS index 8f7356f3e0..9dd3fe2053 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -361,6 +361,11 @@ words where first character is upper rather than title case, e.g., * Changes in Specialized Modes and Packages in Emacs 26.1 ++++ +*** The ancestor buffer is shown by default in 3way merges. +A new option ediff-show-ancestor and a new toggle +ediff-toggle-show-ancestor. + ** TeX: Add luatex and xetex as alternatives to pdftex ** Electric-Buffer-menu diff --git a/lisp/vc/ediff-help.el b/lisp/vc/ediff-help.el index 3292b4d939..52a4825207 100644 --- a/lisp/vc/ediff-help.el +++ b/lisp/vc/ediff-help.el @@ -112,7 +112,7 @@ ediff-long-help-message-merge C-l -recenter | #f/#h -focus/hide regions | + -combine diff regions v/V -scroll up/dn | X -read-only in buf X | wx -save buf X -scroll lt/rt | m -wide display | wd -save diff output - ~ -swap variants | s -shrink window C | / -show ancestor buff + ~ -swap variants | s -shrink window C | / -show/hide ancestor buff | $$ -show clashes only | & -merge w/new default | $* -skip changed regions | " diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el index 535fdbfc90..e054268859 100644 --- a/lisp/vc/ediff-init.el +++ b/lisp/vc/ediff-init.el @@ -1363,6 +1363,16 @@ ediff-make-buffers-readonly-at-startup ;; if nil, this silences some messages (defvar ediff-verbose-p t) +(defcustom ediff-show-ancestor t +"If non-nil, show ancestor buffer in 3way merges and refine it." + :type 'boolean + :group 'ediff-merge + :version "26.1") + +;; Store orig value of `ediff-show-ancestor' when changed in +;; `ediff-toggle-show-ancestor' and restore it on exit. +(ediff-defvar-local ediff--show-ancestor-orig nil "") + (defcustom ediff-autostore-merges 'group-jobs-only "Save the results of merge jobs automatically. With value nil, don't save automatically. With value t, always diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el index f81397950d..549066e1ec 100644 --- a/lisp/vc/ediff-util.el +++ b/lisp/vc/ediff-util.el @@ -178,7 +178,7 @@ ediff-setup-keymap (define-key ediff-mode-map "r" nil) (cond (ediff-merge-job ;; Will barf if no ancestor - (define-key ediff-mode-map "/" 'ediff-show-ancestor) + (define-key ediff-mode-map "/" 'ediff-toggle-show-ancestor) ;; In merging, we allow only A->C and B->C copying. (define-key ediff-mode-map "a" 'ediff-copy-A-to-C) (define-key ediff-mode-map "b" 'ediff-copy-B-to-C) @@ -553,11 +553,12 @@ ediff-setup-control-buffer (ediff-refresh-mode-lines) (setq ediff-control-window (selected-window)) (setq ediff-window-config-saved - (format "%S%S%S%S%S%S%S" + (format "%S%S%S%S%S%S%S%S" ediff-control-window ediff-window-A ediff-window-B ediff-window-C + ediff-window-Ancestor ediff-split-window-function (ediff-multiframe-setup-p) ediff-wide-display-p)) @@ -600,12 +601,6 @@ ediff-update-diffs if necessary." (interactive) (ediff-barf-if-not-control-buffer) - (if (and (ediff-buffer-live-p ediff-ancestor-buffer) - (not - (y-or-n-p - "Ancestor buffer will not be used. Recompute diffs anyway? "))) - (error "Recomputation of differences canceled")) - (let ((point-A (ediff-with-current-buffer ediff-buffer-A (point))) ;;(point-B (ediff-with-current-buffer ediff-buffer-B (point))) (tmp-buffer (get-buffer-create ediff-tmp-buffer)) @@ -614,14 +609,17 @@ ediff-update-diffs ;; (null ediff-buffer-C) is no problem, as we later check if ;; ediff-buffer-C is alive (buf-C-file-name (buffer-file-name ediff-buffer-C)) + (buf-ancestor-file-name (buffer-file-name ediff-ancestor-buffer)) (overl-A (ediff-get-value-according-to-buffer-type 'A ediff-narrow-bounds)) (overl-B (ediff-get-value-according-to-buffer-type 'B ediff-narrow-bounds)) (overl-C (ediff-get-value-according-to-buffer-type 'C ediff-narrow-bounds)) - beg-A end-A beg-B end-B beg-C end-C - file-A file-B file-C) + (overl-Ancestor (ediff-get-value-according-to-buffer-type + 'Ancestor ediff-narrow-bounds)) + beg-A end-A beg-B end-B beg-C end-C beg-Ancestor end-Ancestor + file-A file-B file-C file-Ancestor) (if (stringp buf-A-file-name) (setq buf-A-file-name (file-name-nondirectory buf-A-file-name))) @@ -629,15 +627,19 @@ ediff-update-diffs (setq buf-B-file-name (file-name-nondirectory buf-B-file-name))) (if (stringp buf-C-file-name) (setq buf-C-file-name (file-name-nondirectory buf-C-file-name))) + (if (stringp buf-ancestor-file-name) + (setq buf-ancestor-file-name (file-name-nondirectory buf-ancestor-file-name))) (ediff-unselect-and-select-difference -1) (setq beg-A (ediff-overlay-start overl-A) beg-B (ediff-overlay-start overl-B) beg-C (ediff-overlay-start overl-C) + beg-Ancestor (ediff-overlay-start overl-Ancestor) end-A (ediff-overlay-end overl-A) end-B (ediff-overlay-end overl-B) - end-C (ediff-overlay-end overl-C)) + end-C (ediff-overlay-end overl-C) + end-Ancestor (ediff-overlay-end overl-Ancestor)) (if ediff-word-mode (progn @@ -645,51 +647,37 @@ ediff-update-diffs (setq file-A (ediff-make-temp-file tmp-buffer "regA")) (ediff-wordify beg-B end-B ediff-buffer-B tmp-buffer) (setq file-B (ediff-make-temp-file tmp-buffer "regB")) - (if ediff-3way-job - (progn - (ediff-wordify beg-C end-C ediff-buffer-C tmp-buffer) - (setq file-C (ediff-make-temp-file tmp-buffer "regC")))) + (when ediff-3way-job + (ediff-wordify beg-C end-C ediff-buffer-C tmp-buffer) + (setq file-C (ediff-make-temp-file tmp-buffer "regC"))) + (when ediff-merge-with-ancestor-job + (ediff-wordify beg-Ancestor end-Ancestor ediff-ancestor-buffer tmp-buffer) + (setq file-Ancestor (ediff-make-temp-file tmp-buffer "regAncestor"))) ) ;; not word-mode (setq file-A (ediff-make-temp-file ediff-buffer-A buf-A-file-name)) (setq file-B (ediff-make-temp-file ediff-buffer-B buf-B-file-name)) (if ediff-3way-job (setq file-C (ediff-make-temp-file ediff-buffer-C buf-C-file-name))) + (when ediff-merge-with-ancestor-job + (setq file-Ancestor + (ediff-make-temp-file + ediff-ancestor-buffer + buf-ancestor-file-name))) ) - (ediff-clear-diff-vector 'ediff-difference-vector-A 'fine-diffs-also) (ediff-clear-diff-vector 'ediff-difference-vector-B 'fine-diffs-also) (ediff-clear-diff-vector 'ediff-difference-vector-C 'fine-diffs-also) (ediff-clear-diff-vector 'ediff-difference-vector-Ancestor 'fine-diffs-also) - ;; let them garbage collect. we can't use the ancestor after recomputing - ;; the diffs. - (setq ediff-difference-vector-Ancestor nil - ediff-ancestor-buffer nil - ediff-state-of-merge nil) - (setq ediff-killed-diffs-alist nil) ; invalidate saved killed diff regions - - ;; In case of merge job, fool it into thinking that it is just doing - ;; comparison - (let ((ediff-setup-diff-regions-function ediff-setup-diff-regions-function) - (ediff-3way-comparison-job ediff-3way-comparison-job) - (ediff-merge-job ediff-merge-job) - (ediff-merge-with-ancestor-job ediff-merge-with-ancestor-job) - (ediff-job-name ediff-job-name)) - (if ediff-merge-job - (setq ediff-setup-diff-regions-function 'ediff-setup-diff-regions3 - ediff-3way-comparison-job t - ediff-merge-job nil - ediff-merge-with-ancestor-job nil - ediff-job-name 'ediff-files3)) - (funcall ediff-setup-diff-regions-function file-A file-B file-C)) - + (funcall ediff-setup-diff-regions-function file-A file-B + (if ediff-merge-with-ancestor-job file-Ancestor file-C)) (setq ediff-number-of-differences (length ediff-difference-vector-A)) (delete-file file-A) (delete-file file-B) - (if file-C - (delete-file file-C)) + (and file-C (delete-file file-C)) + (and file-Ancestor (delete-file file-Ancestor)) (if ediff-3way-job (ediff-set-state-of-all-diffs-in-all-buffers ediff-control-buffer)) @@ -737,14 +725,16 @@ ediff-revert-buffers-then-recompute-diffs ;; optional NO-REHIGHLIGHT says to not rehighlight buffers (defun ediff-recenter (&optional no-rehighlight) "Bring the highlighted region of all buffers being compared into view. -Reestablish the default three-window display." +Reestablish the default window display." (interactive) (ediff-barf-if-not-control-buffer) (let (buffer-read-only) (if (and (ediff-buffer-live-p ediff-buffer-A) (ediff-buffer-live-p ediff-buffer-B) (or (not ediff-3way-job) - (ediff-buffer-live-p ediff-buffer-C))) + (ediff-buffer-live-p ediff-buffer-C)) + (or (not ediff-merge-with-ancestor-job) + (ediff-buffer-live-p ediff-ancestor-buffer))) (ediff-setup-windows ediff-buffer-A ediff-buffer-B ediff-buffer-C ediff-control-buffer) (or (eq this-command 'ediff-quit) @@ -963,18 +953,43 @@ ediff-toggle-autorefine (setq ediff-auto-refine 'nix)) )) -(defun ediff-show-ancestor () - "Show the ancestor buffer in a suitable window." - (interactive) - (ediff-recenter) +(defun ediff--check-ancestor-exists () (or (ediff-buffer-live-p ediff-ancestor-buffer) (if ediff-merge-with-ancestor-job - (error "Lost connection to ancestor buffer...sorry") - (error "Not merging with ancestor"))) - (let (wind) - (cond ((setq wind (ediff-get-visible-buffer-window ediff-ancestor-buffer)) - (raise-frame (window-frame wind))) - (t (set-window-buffer ediff-window-C ediff-ancestor-buffer))))) + (error "Lost connection to ancestor buffer. This shouldn't happen. \ +Please report this bug to bug-gnu-emacs@gnu.org") + (error "Not merging with ancestor")))) + +;; Restore `ediff-show-ancestor' on exit. +(defun ediff--restore-options-on-exit () + (message "Restoring ediff-show-ancestor to %S..." ediff--show-ancestor-orig) + (setq ediff-show-ancestor ediff--show-ancestor-orig + ediff--show-ancestor-orig nil) + (remove-hook 'ediff-quit-hook #'ediff--restore-options-on-exit)) + +(defun ediff-toggle-show-ancestor () + "Toggle to show/hide the ancestor buffer." + (interactive) + (ediff--check-ancestor-exists) + ;; Save original value if not yet, and add hook to restore it on exit. + (unless ediff--show-ancestor-orig + (setq ediff--show-ancestor-orig ediff-show-ancestor) + (add-hook 'ediff-quit-hook #'ediff--restore-options-on-exit)) + (setq ediff-show-ancestor (not ediff-show-ancestor)) + ;; If equal than orig, then nothing to restore on exit. + (when (eq ediff-show-ancestor ediff--show-ancestor-orig) + (setq ediff--show-ancestor-orig nil) + (remove-hook 'ediff-quit-hook #'ediff--restore-options-on-exit)) + (if (not ediff-show-ancestor) + (progn + (delete-window ediff-window-Ancestor) + (ediff-recenter) + (message "Ancestor buffer is hidden")) + (let ((wind + (ediff-get-visible-buffer-window ediff-ancestor-buffer))) + (when wind (raise-frame (window-frame wind)))) + (ediff-recenter) + (message "Showing ancestor buffer"))) (defun ediff-make-or-kill-fine-diffs (arg) "Compute fine diffs. With negative prefix arg, kill fine diffs. @@ -1468,7 +1483,10 @@ ediff-operate-on-windows (ediff-recenter 'no-rehighlight)) (if (not (and (ediff-buffer-live-p ediff-buffer-A) (ediff-buffer-live-p ediff-buffer-B) - (or (not ediff-3way-job) ediff-buffer-C) + (or (not ediff-3way-job) (ediff-buffer-live-p ediff-buffer-C)) + (or (not ediff-merge-with-ancestor-job) + (not ediff-show-ancestor) + (ediff-buffer-live-p ediff-ancestor-buffer)) )) (error ediff-KILLED-VITAL-BUFFER)) @@ -1476,11 +1494,15 @@ ediff-operate-on-windows (wind-A ediff-window-A) (wind-B ediff-window-B) (wind-C ediff-window-C) + (wind-Anc ediff-window-Ancestor) (coefA (ediff-get-region-size-coefficient 'A operation)) (coefB (ediff-get-region-size-coefficient 'B operation)) (three-way ediff-3way-job) + (with-Ancestor (and ediff-merge-with-ancestor-job ediff-show-ancestor)) (coefC (if three-way - (ediff-get-region-size-coefficient 'C operation)))) + (ediff-get-region-size-coefficient 'C operation))) + (coefAnc (if with-Ancestor + (ediff-get-region-size-coefficient 'Ancestor operation)))) (select-window wind-A) (condition-case nil @@ -1496,6 +1518,11 @@ ediff-operate-on-windows (condition-case nil (funcall operation (round (* coefC arg))) (error)))) + (when with-Ancestor + (select-window wind-Anc) + (condition-case nil + (funcall operation (round (* coefAnc arg))) + (error))) (select-window wind))) (defun ediff-scroll-vertically (&optional arg) @@ -1512,6 +1539,9 @@ ediff-scroll-vertically (ediff-buffer-live-p ediff-buffer-B) (or (not ediff-3way-job) (ediff-buffer-live-p ediff-buffer-C)) + (or (not ediff-merge-with-ancestor-job) + (not ediff-show-ancestor) + (ediff-buffer-live-p ediff-ancestor-buffer)) )) (error ediff-KILLED-VITAL-BUFFER)) @@ -1531,6 +1561,10 @@ ediff-scroll-vertically (window-height ediff-window-B) (if ediff-3way-job (window-height ediff-window-C) + 500) ; some large number + (if (and ediff-merge-with-ancestor-job + ediff-show-ancestor) + (window-height ediff-window-Ancestor) 500)) ; some large number 2) 1 next-screen-context-lines)) @@ -1556,6 +1590,9 @@ ediff-scroll-horizontally (ediff-buffer-live-p ediff-buffer-B) (or (not ediff-3way-job) (ediff-buffer-live-p ediff-buffer-C)) + (or (not ediff-merge-with-ancestor-job) + (not ediff-show-ancestor) + (ediff-buffer-live-p ediff-ancestor-buffer)) )) (error ediff-KILLED-VITAL-BUFFER)) @@ -1587,7 +1624,10 @@ ediff-scroll-horizontally (if ediff-3way-comparison-job (window-width ediff-window-C) 500) ; some large number - ) + (if (and ediff-merge-with-ancestor-job + ediff-show-ancestor) + (window-height ediff-window-Ancestor) + 500)) ; some large number 2) 3))) ;; window found @@ -1689,6 +1729,11 @@ ediff-get-region-size-coefficient (funcall func 'B n ctl-buf) (if (ediff-buffer-live-p ediff-buffer-C) (funcall func 'C n ctl-buf) + 0) + (if (and ediff-merge-with-ancestor-job + ediff-show-ancestor + (ediff-buffer-live-p ediff-ancestor-buffer)) + (funcall func 'Ancestor n ctl-buf) 0)))) ;; this covers the horizontal coefficient as well: ;; if max-lines = 0 then coef = 1 diff --git a/lisp/vc/ediff-wind.el b/lisp/vc/ediff-wind.el index cd10288643..8516c11d13 100644 --- a/lisp/vc/ediff-wind.el +++ b/lisp/vc/ediff-wind.el @@ -115,6 +115,8 @@ ediff-window-setup-function (ediff-defvar-local ediff-window-B nil "") ;; Official window for buffer C (ediff-defvar-local ediff-window-C nil "") +;; Official window for buffer Ancestor +(ediff-defvar-local ediff-window-Ancestor nil "") ;; Ediff's window configuration. ;; Used to minimize the need to rearrange windows. (ediff-defvar-local ediff-window-config-saved "" "") @@ -126,7 +128,8 @@ ediff-window-alist (B . ediff-window-B) (?B . ediff-window-B) (C . ediff-window-C) - (?C . ediff-window-C))) + (?C . ediff-window-C) + (Ancestor . ediff-window-Ancestor))) (defcustom ediff-split-window-function 'split-window-vertically @@ -363,9 +366,13 @@ ediff-setup-windows-plain-merge ;; skip dedicated and unsplittable frames (ediff-destroy-control-frame control-buffer) (let ((window-min-height 1) + (with-Ancestor-p (ediff-with-current-buffer control-buffer + ediff-merge-with-ancestor-job)) split-window-function merge-window-share merge-window-lines - wind-A wind-B wind-C) + (buf-Ancestor (ediff-with-current-buffer control-buffer + ediff-ancestor-buffer)) + wind-A wind-B wind-C wind-Ancestor) (ediff-with-current-buffer control-buffer (setq merge-window-share ediff-merge-window-share ;; this lets us have local versions of ediff-split-window-function @@ -394,6 +401,14 @@ ediff-setup-windows-plain-merge (setq wind-C (selected-window)) (switch-to-buffer buf-C) + (when (and ediff-show-ancestor with-Ancestor-p) + (select-window wind-C) + (funcall split-window-function) + (when (eq (selected-window) wind-C) + (other-window 1)) + (switch-to-buffer buf-Ancestor) + (setq wind-Ancestor (selected-window))) + (select-window wind-A) (funcall split-window-function) @@ -405,7 +420,8 @@ ediff-setup-windows-plain-merge (ediff-with-current-buffer control-buffer (setq ediff-window-A wind-A ediff-window-B wind-B - ediff-window-C wind-C)) + ediff-window-C wind-C + ediff-window-Ancestor wind-Ancestor)) (ediff-select-lowest-window) (ediff-setup-control-buffer control-buffer) @@ -516,9 +532,13 @@ ediff-setup-windows-multiframe-merge (wind-A (ediff-get-visible-buffer-window buf-A)) (wind-B (ediff-get-visible-buffer-window buf-B)) (wind-C (ediff-get-visible-buffer-window buf-C)) + (buf-Ancestor (ediff-with-current-buffer control-buf + ediff-ancestor-buffer)) + (wind-Ancestor (ediff-get-visible-buffer-window buf-Ancestor)) (frame-A (if wind-A (window-frame wind-A))) (frame-B (if wind-B (window-frame wind-B))) (frame-C (if wind-C (window-frame wind-C))) + (frame-Ancestor (if wind-Ancestor (window-frame wind-Ancestor))) ;; on wide display, do things in one frame (force-one-frame (ediff-with-current-buffer control-buf ediff-wide-display-p)) @@ -549,7 +569,10 @@ ediff-setup-windows-multiframe-merge (merge-window-share (ediff-with-current-buffer control-buf ediff-merge-window-share)) merge-window-lines - designated-minibuffer-frame + designated-minibuffer-frame ; ediff-merge-with-ancestor-job + (with-Ancestor-p (ediff-with-current-buffer control-buf + ediff-merge-with-ancestor-job)) + (done-Ancestor (not with-Ancestor-p)) done-A done-B done-C) ;; buf-A on its own @@ -585,6 +608,19 @@ ediff-setup-windows-multiframe-merge (setq wind-C (selected-window)) (setq done-C t))) + ;; buf-Ancestor on its own + (if (and ediff-show-ancestor + with-Ancestor-p + (window-live-p wind-Ancestor) + (ediff-window-ok-for-display wind-Ancestor) + (null use-same-frame)) ; buf Ancestor on its own + (progn + ;; buffer buf-Ancestor is seen in live wind-Ancestor + (select-window wind-Ancestor) + (delete-other-windows) + (setq wind-Ancestor (selected-window)) + (setq done-Ancestor t))) + (if (and use-same-frame-for-AB ; implies wind A and B are suitable (window-live-p wind-A)) (progn @@ -606,6 +642,7 @@ ediff-setup-windows-multiframe-merge (let ((window-min-height 1)) (if (and (eq frame-A frame-B) (eq frame-B frame-C) + (eq frame-C frame-Ancestor) (frame-live-p frame-A)) (select-frame frame-A) ;; avoid dedicated and non-splittable windows @@ -623,6 +660,14 @@ ediff-setup-windows-multiframe-merge (setq wind-C (selected-window)) (switch-to-buffer buf-C) + (when (and ediff-show-ancestor with-Ancestor-p) + (select-window wind-C) + (funcall split-window-function) + (if (eq (selected-window) wind-C) + (other-window 1)) + (switch-to-buffer buf-Ancestor) + (setq wind-Ancestor (selected-window))) + (select-window wind-A) (funcall split-window-function) @@ -633,8 +678,8 @@ ediff-setup-windows-multiframe-merge (setq done-A t done-B t - done-C t) - )) + done-C t + done-Ancestor t))) (or done-A ; Buf A to be set in its own frame, ;;; or it was set before because use-same-frame = 1 @@ -668,10 +713,22 @@ ediff-setup-windows-multiframe-merge (setq wind-C (selected-window)) )) + (or done-Ancestor ; Buf Ancestor to be set in its own frame, + (not ediff-show-ancestor) + ;;; or it was set before because use-same-frame = 1 + (progn + ;; Buf-Ancestor was not set up yet as it wasn't visible + ;; and use-same-frame = nil + (select-window orig-wind) + (delete-other-windows) + (switch-to-buffer buf-Ancestor) + (setq wind-Ancestor (selected-window)))) + (ediff-with-current-buffer control-buf (setq ediff-window-A wind-A ediff-window-B wind-B - ediff-window-C wind-C) + ediff-window-C wind-C + ediff-window-Ancestor wind-Ancestor) (setq frame-A (window-frame ediff-window-A) designated-minibuffer-frame (window-frame (minibuffer-window frame-A)))) @@ -679,7 +736,6 @@ ediff-setup-windows-multiframe-merge (ediff-setup-control-frame control-buf designated-minibuffer-frame) )) - ;; Window setup for all comparison jobs, including 3way comparisons (defun ediff-setup-windows-multiframe-compare (buf-A buf-B buf-C control-buf) ;;; Algorithm: @@ -1295,7 +1351,9 @@ ediff-keep-window-config (let ((ctl-wind ediff-control-window) (A-wind ediff-window-A) (B-wind ediff-window-B) - (C-wind ediff-window-C)) + (C-wind ediff-window-C) + (ancestor-job ediff-merge-with-ancestor-job) + (Ancestor-wind ediff-window-Ancestor)) (and (ediff-window-visible-p A-wind) @@ -1303,13 +1361,19 @@ ediff-keep-window-config ;; if buffer C is defined then take it into account (or (not ediff-3way-job) (ediff-window-visible-p C-wind)) + (or (not ancestor-job) + (not ediff-show-ancestor) + (ediff-window-visible-p Ancestor-wind)) (eq (window-buffer A-wind) ediff-buffer-A) (eq (window-buffer B-wind) ediff-buffer-B) (or (not ediff-3way-job) (eq (window-buffer C-wind) ediff-buffer-C)) + (or (not ancestor-job) + (not ediff-show-ancestor) + (eq (window-buffer Ancestor-wind) ediff-ancestor-buffer)) (string= ediff-window-config-saved - (format "%S%S%S%S%S%S%S" - ctl-wind A-wind B-wind C-wind + (format "%S%S%S%S%S%S%S%S" + ctl-wind A-wind B-wind C-wind Ancestor-wind ediff-split-window-function (ediff-multiframe-setup-p) ediff-wide-display-p))))))) -- 2.11.0 --8<-----------------------------cut here---------------end--------------->8--- In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.8) of 2017-03-06 Repository revision: 0fae08d0072f74d97ca70b91a4d46d8d28a03952 From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 11 08:44:32 2017 Received: (at 25493) by debbugs.gnu.org; 11 Mar 2017 13:44:32 +0000 Received: from localhost ([127.0.0.1]:50381 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cmhJv-0003K7-Tf for submit@debbugs.gnu.org; Sat, 11 Mar 2017 08:44:32 -0500 Received: from mail-io0-f196.google.com ([209.85.223.196]:36490) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cmhJt-0003Jr-MZ for 25493@debbugs.gnu.org; Sat, 11 Mar 2017 08:44:29 -0500 Received: by mail-io0-f196.google.com with SMTP id 68so9406986ioh.3 for <25493@debbugs.gnu.org>; Sat, 11 Mar 2017 05:44:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=T556tkf516p5L5Std2155DFQPt2q9LhmK9VSEm+3nfg=; b=ADCJHHSzp7vPBXRy+3pT65Ao2AD7SuVmcyjDIg7tx9lAh9nE9jUAQMDJbS7efTSRwq 4o7nLabat14jk6Vlgq12DmQ0KFaARC+xjIqSv3RaFlfZlqn1mENJyUahkyeVOx/iOCsD 3+K59U8BmNQg+LsY5KkCR7+ukyxtzEvPSW/aQYVtTuekvPSbbr18ctLxVScOxBz3TKWY hUiu4rNCCMmX/OyvDydOryaurePuPOqe8ACNnvaOhAif3365zzRhrJQ8saA5RkR3tpRC 8zYBeWhOWzHGCoakK0Ia5vIf+7dPeF20JBXwIl+A6K+F6K84j/zZcPRmLfROBmrzOvNK FBCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=T556tkf516p5L5Std2155DFQPt2q9LhmK9VSEm+3nfg=; b=APNbR/BTplgdNDthZVovrc6ut+Nm7AgFA3L37iN42YK5n+vno9YBEXfaA1XnK+7Dnt h19iipAyaWQBTzdbjfXvomfqMbzIesFiTm3wRyvKv4UkL/wn5CaPbNoqJdNEf0g9rjA8 KWKthEZE2oEuD8iNElasqQVeuxFmoSdnneZl9d6uBr0AwR6U2Qf/Pfod+SQhEcjwaCGK /lk6QVayLAy+Q3PbFYRT8k9bYPwjRGhDKb6112l8Ma3zAPsJE5lV98LAOLJ1SCIte/Ij YLshhaGJhSF9GlzWT+7HsDmyb5PFp/h/K98wyl5n5X0g8P7W4UC4or5ZRNa9ivuGJgOj pLoQ== X-Gm-Message-State: AMke39kabUWJfagk/ZGO5dVg1mZD7d+SHX9d/4fc6W36JNpFsnXoHf0ucpL4ITxklS9Zaw== X-Received: by 10.107.31.11 with SMTP id f11mr24027090iof.183.1489239864189; Sat, 11 Mar 2017 05:44:24 -0800 (PST) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id j14sm1502461itd.0.2017.03.11.05.44.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 Mar 2017 05:44:23 -0800 (PST) From: npostavs@users.sourceforge.net To: Tino Calancha Subject: Re: bug#25493: 26.0.50; ediff merge should (optionally) show ancestor in fourth window References: <874lzqe9tn.fsf@calancha-pc> <87fuisabg5.fsf@users.sourceforge.net> <87innmh53f.fsf@calancha-pc> Date: Sat, 11 Mar 2017 08:45:40 -0500 In-Reply-To: <87innmh53f.fsf@calancha-pc> (Tino Calancha's message of "Mon, 06 Mar 2017 23:06:44 +0900") Message-ID: <87efy47wqj.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 25493 Cc: Philipp Stephani , 25493@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.8 (/) Tino Calancha writes: > OK. I have simplified the patch a lot. I have restricted to the problem > in hands: to show the buffer ancestor in 3way merges. The refinement of > this buffer must keep in the TODO list (see below). Thanks, it's a lot more comprehensible now. > Subject: [PATCH 2/2] Show ancestor buffer in 3way merges > > Add an option ediff-show-ancestor', to control if the ancestor buffer > must be shown in 3way merges (Bug#25493); set it non-nil by default. ^^ Extra space there. > - > - ;; In case of merge job, fool it into thinking that it is just doing > - ;; comparison > - (let ((ediff-setup-diff-regions-function ediff-setup-diff-regions-function) > - (ediff-3way-comparison-job ediff-3way-comparison-job) > - (ediff-merge-job ediff-merge-job) > - (ediff-merge-with-ancestor-job ediff-merge-with-ancestor-job) > - (ediff-job-name ediff-job-name)) > - (if ediff-merge-job > - (setq ediff-setup-diff-regions-function 'ediff-setup-diff-regions3 > - ediff-3way-comparison-job t > - ediff-merge-job nil > - ediff-merge-with-ancestor-job nil > - ediff-job-name 'ediff-files3)) > - (funcall ediff-setup-diff-regions-function file-A file-B file-C)) > - > + (funcall ediff-setup-diff-regions-function file-A file-B > + (if ediff-merge-with-ancestor-job file-Ancestor file-C)) It works when I tested it, so I guess this is correct, but it's not really obvious to me why (i.e., why we no longer need to "fool it"). Could you add an explanation to the commit message? Otherwise looks good to me. From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 14 03:43:51 2017 Received: (at 25493-done) by debbugs.gnu.org; 14 Mar 2017 07:43:51 +0000 Received: from localhost ([127.0.0.1]:54689 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cnh7W-0007g9-QD for submit@debbugs.gnu.org; Tue, 14 Mar 2017 03:43:51 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:36801) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cnh7V-0007fv-5m for 25493-done@debbugs.gnu.org; Tue, 14 Mar 2017 03:43:49 -0400 Received: by mail-pg0-f67.google.com with SMTP id 25so22708587pgy.3 for <25493-done@debbugs.gnu.org>; Tue, 14 Mar 2017 00:43:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version; bh=hOrntg0RDUtsUu4OLNQh4WlUMPoe+7NJBkdXzlg+2gA=; b=BZLSD9MtSwRGjVi7fYasNcWv1FvUQsDg5VjcSPQs3XP8lhtVK4zntzz0WXn7xQ7zuE QcfP1Jf67kru8sag1XWxdyWAgdLmR49DKYIgYdvDsRT+xVFTABGMYMJ7qMjitUNR492j s5Bkk1zDFCxtRtVaOMxv43j++2qZnvM+MP9bVawohsLl442Tl7JSxhYBaDCJ3uD61stO qoUGNIQbASIKE5cIn+dCDBCOJFpfixZ5B9hgzJ05F8BR8vzjW2yjTg+avNq+02kCSHE7 FmTyjrM0SKpK+FAtIjAFjOn7zpM2UL7CU0XIsZdC2cn5rkFNnP1yRpwDdxSJ61p99Nvk P0ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=hOrntg0RDUtsUu4OLNQh4WlUMPoe+7NJBkdXzlg+2gA=; b=rcKWu736wA6wpJUnJ0odQYphdDrej8TAD4BwYVwy2j6tn8SR7z4hV0oQWeCspUJEIR RnMR9UxdyjpxhMIAVFmSg/ms0xYWus0ur7B2gbyzATI0WO08lfGSXqw2WNdvbkkmTTD9 HCRMKawOV7pdqpYo4EynOO9cxo6CYYzA1FGQH7BGtNyskWcdH3asEhjsILzgbu4WZqxb q36URk1ndK2uV42Wwg9qx14wMv5HvNgQ0YF6XDRyJC480faF903GhJ6LPNkFB0qze9VC jdRN7eiWMBRCVW3hpmrh2PMY0HQxo43CFwtn/gAWRukTJfZrVq1s4CiQ+tlgpIsktl/W Sjkw== X-Gm-Message-State: AMke39la93dQ4M2iG/hZt9vDG5zL7PbNtJHvTAvXz4zNKZ6A+wwYLmYrM5XQ/VzxnEjupA== X-Received: by 10.99.37.199 with SMTP id l190mr41368612pgl.86.1489477423209; Tue, 14 Mar 2017 00:43:43 -0700 (PDT) Received: from calancha-pc (161.224.128.101.dy.bbexcite.jp. [101.128.224.161]) by smtp.gmail.com with ESMTPSA id p66sm36587617pfb.88.2017.03.14.00.43.41 for <25493-done@debbugs.gnu.org> (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 Mar 2017 00:43:42 -0700 (PDT) From: Tino Calancha To: 25493-done@debbugs.gnu.org Subject: Re: bug#25493: 26.0.50; ediff merge should (optionally) show ancestor in fourth window References: <874lzqe9tn.fsf@calancha-pc> <87fuisabg5.fsf@users.sourceforge.net> <87innmh53f.fsf@calancha-pc> <87efy47wqj.fsf@users.sourceforge.net> Date: Tue, 14 Mar 2017 16:43:38 +0900 In-Reply-To: <87efy47wqj.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net's message of "Sat, 11 Mar 2017 08:45:40 -0500") Message-ID: <87k27sfglx.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 25493-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) npostavs@users.sourceforge.net writes: >> Subject: [PATCH 2/2] Show ancestor buffer in 3way merges >> >> Add an option ediff-show-ancestor', to control if the ancestor buffer >> must be shown in 3way merges (Bug#25493); set it non-nil by default. > ^^ > Extra space there. Thanks. >> - >> - ;; In case of merge job, fool it into thinking that it is just doing >> - ;; comparison >> - (let ((ediff-setup-diff-regions-function ediff-setup-diff-regions-function) >> - (ediff-3way-comparison-job ediff-3way-comparison-job) >> - (ediff-merge-job ediff-merge-job) >> - (ediff-merge-with-ancestor-job ediff-merge-with-ancestor-job) >> - (ediff-job-name ediff-job-name)) >> - (if ediff-merge-job >> - (setq ediff-setup-diff-regions-function 'ediff-setup-diff-regions3 >> - ediff-3way-comparison-job t >> - ediff-merge-job nil >> - ediff-merge-with-ancestor-job nil >> - ediff-job-name 'ediff-files3)) >> - (funcall ediff-setup-diff-regions-function file-A file-B file-C)) >> - >> + (funcall ediff-setup-diff-regions-function file-A file-B >> + (if ediff-merge-with-ancestor-job file-Ancestor file-C)) > > It works when I tested it, so I guess this is correct, but it's not > really obvious to me why (i.e., why we no longer need to "fool it"). > Could you add an explanation to the commit message? Now I mention that this trick is not necessary. Before the patch there were several parts of the code executed only if `ediff-3way-comparison-job' was non-nil. After the patch, those parts of the code also test if `ediff-merge-with-ancestor-job' is non-nil; that's why we don't need to fool it anymore. > Otherwise looks good to me. Thank you. Pushed to master as commit 0f3d1b782353fd1fc0ab5f89d47d9e790f44e6b2 From unknown Wed Jun 18 00:21:17 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 11 Apr 2017 11:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator