Subject: 24.3; ediff-swap-buffers doesn't swap per-difference colors

From: Anthony Foiani <[email-masked]>
Date: Wed, 2 Apr 2014 00:05:27 -0700

This bug report will be sent to the Bug-GNU-Emacs mailing list
and the GNU bug tracker at debbugs.gnu.org.  Please check that
the From: line contains a valid email address.  After a delay of up
to one day, you should receive an acknowledgment at that address.

Please write in English if possible, as the Emacs maintainers
usually do not have translators for other languages.

Please describe exactly what actions triggered the bug, and
the precise symptoms of the bug.  If you can, give a recipe
starting from `emacs -Q':

What I wanted to happen:

  When using "~" to swap buffers A and B in a simple "ediff-buffers"
  invocation, I would like the per-diff region backgrounds to also be
  swapped (e.g, red should stay on the top or left, while green should
  be on the bottom or right).

How I tried to make it happen:

  0. Start emacs with "emacs -q"
  1. Create buffer "*before*", add some content
  2. Create buffer "*after*", add similar but slightly different
     content.
  3. M-x ediff-buffers RET *before* RET *after* RET
  4. "~" to swap A/B buffers
  5. "n" to go to change 1

What actually happened:

  At step (5) above, instead of seeing dim red + bright red on the top,
  and dim green + bright green on the bottom, the overall regions had
  the wrong color (dim green on top, dim red on bottom), while the
  refinements had the correct colors (bright red on top, bright greeen
  on bottom).

Screenshots:

  1. Correct colors, before swapping with "~":
     http://foiani.home.dyndns.org/~tony/emacs/correct-before-swap.png

  2. Incorrect colors, after swap:
     http://foiani.home.dyndns.org/~tony/emacs/wrong-after-swap.png

  (Each of those images are about 35KiB, if size is a concern.)

Other info:

My .Xresources:

  Emacs*foreground: grey80
  Emacs*background: black
  Emacs.default.attributeFont: dejavu sans:pixelsize=14
  Emacs.font: dejavu sans mono:pixelsize=14
  Emacs*modeline.foreground: grey90
  Emacs*modeline.background: grey30
  Emacs*zmacs-region.background: #000044
  Emacs*isearch.background: #004444

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/usr/share/emacs/24.3/etc/DEBUG.

In GNU Emacs 24.3.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.8.2)
 of 2013-08-14 on buildvm-15.phx2.fedoraproject.org
Windowing system distributor `Fedora Project', version 11.0.11404000
System Description:    Fedora release 19 (Schrödinger’s Cat)

Configured using:
 `configure '--build=x86_64-redhat-linux-gnu'
 '--host=x86_64-redhat-linux-gnu' '--program-prefix='
 '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr'
 '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc'
 '--datadir=/usr/share' '--includedir=/usr/include'
 '--libdir=/usr/lib64' '--libexecdir=/usr/libexec'
 '--localstatedir=/var' '--sharedstatedir=/var/lib'
 '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-dbus'
 '--with-gif' '--with-jpeg' '--with-png' '--with-rsvg' '--with-tiff'
 '--with-xft' '--with-xpm' '--with-x-toolkit=gtk3' '--with-gpm=no'
 'build_alias=x86_64-redhat-linux-gnu'
 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g
 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
 --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic'
 'LDFLAGS=-Wl,-z,relro ''

Important settings:
  value of $LANG: en_US.utf8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  shell-dirtrack-mode: t
  tooltip-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

Recent input:
C-e C-b C-d A C-n <tab> C-p C-a C-SPC C-n C-n C-w C-p
C-p C-y C-_ C-p C-y C-p C-e C-b C-b C-b C-d A C-a C-p
C-SPC C-n C-n C-w C-y C-y C-p C-f C-f C-f C-f C-f C-f
C-f C-f C-f C-f C-f C-p C-f C-e C-b C-d B C-n C-b C-b
C-b C-d B C-a C-n <tab> C-n C-p C-p C-e <backspace>
C-p C-p C-d C-n <tab> C-n <tab> C-p C-p C-a C-p C-e
C-p C-a C-n C-e C-p <return> ( p r o g n C-a C-n C-p
<tab> C-n <tab> C-n <tab> C-n <tab> C-n <tab> C-n <tab>
C-n <tab> C-n <tab> C-e <backspace> ) ) ) C-a C-n C-SPC
C-n C-n C-n C-n C-n C-n C-n C-w C-p C-p C-p C-n C-n
C-x C-s C-e C-n C-g C-v C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-e C-n C-n C-p C-x C-e C-x C-b C-x o C-g
C-g C-x o C-x C-g M-x e d i f f - b u f <tab> <return>
* b e f o r e * <return> * a f t e r <return> | n p
~ n q y q y C-g C-g C-g <switch-frame> <switch-frame>
<down-mouse-1> <mouse-movement> <drag-mouse-1> <down-mouse-1>
<mouse-movement> <mouse-1> C-x C-b C-x o C-n C-n C-n
C-p C-n f C-x 1 M-v M-v C-v C-l C-p C-p C-p C-p C-p
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-f C-f
C-f C-f C-f C-f C-f C-f C-f C-f C-n C-n C-e ) C-n C-n
<backspace> <backspace> C-_ C-_ C-_ C-_ SPC C-_ C-_
C-p C-p C-p C-p C-p C-p C-n C-n C-n C-p C-e C-n C-n
M-x r e p o r t <tab> <return>

Recent messages:
progn: Symbol's value as variable is void: ediff-even-diff-A
ediff-next-difference: Args out of range: 1, 64
Quit this Ediff session? (y or n)  y
ediff-recenter: Args out of range: 1, 64
Quit this Ediff session? (y or n)  y
ediff-recenter: Args out of range: 1, 64
Quit [3 times]
Mark set
Undo! [5 times]
Redo!

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils mule-util edebug easymenu jka-compr shell
pcomplete grep compile comint ansi-color ring misearch multi-isearch
dired-aux dired emerge ediff-merg ediff-diff ediff-wind ediff-help
ediff-util ediff-mult ediff-init ediff time-date tooltip ediff-hook
vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment lisp-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty emacs)