[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#9678: closed (24.0.50; ediff-inferior-compare-regi

From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#9678: closed (24.0.50; ediff-inferior-compare-regions ignores user response for ediff buffer selection)
Date: Fri, 14 Dec 2012 15:25:02 +0000

Your message dated Fri, 14 Dec 2012 10:23:53 -0500
with message-id <address@hidden>
and subject line Re: bug#11319: [PATCH 1/2] BUGFIX: select 
current-diff-comparison regions for ediff-inferior-compare-regions correctly
has caused the debbugs.gnu.org bug report #11319,
regarding 24.0.50; ediff-inferior-compare-regions ignores user response for 
ediff buffer selection
to be marked as done.

(If you believe you have received this mail in error, please contact

11319: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11319
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 24.0.50; ediff-inferior-compare-regions ignores user response for ediff buffer selection Date: Wed, 5 Oct 2011 17:32:05 -0700
This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your report will be posted to the address@hidden mailing list
and the gnu.emacs.bug news group, and at http://debbugs.gnu.org.

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':

How to reproduce:

1. Open up three separate buffers.

2. Add the same content into all three buffers, except arrange for the
content to be different on all three buffers on one of the lines (This
is just to get a difference to run through

3. Run `ediff-buffers3' and select each of the three buffers

4. Type 'n' to go to the first difference.

5. Type '=' t run `ediff-inferior-compare-regions'

6. When prompted for "Enter the 1st buffer you want to compare",
answer with 'a'.

7. When prompted for "Enter the 2nd buffer you want to compare" ,
answer with 'c'. 

8. When prompted for "Compare currently highlighted difference
regions?" answer with 'y'.

9. Notice that the new ediff session has the region for the B buffer
and not the C buffer.

My analysis: I believe the bug is the hardcoding of 'A and 'B
buf-types in both calls to
`ediff-clone-buffer-for-current-diff-comparison' made inside the
`ediff-inferior-compare-regions' function here:

                    bufA 'A "-Region.A-")

And here:

                    bufB 'B "-Region.B-")

Here is a possible fixed version of the function where I introduced
the buf-type-A and buf-type-B local variables to store the 'A, 'B, or
'C symbols corresponding to the users selection, and used those values
in the calls to `ediff-clone-buffer-for-current-diff-comparison':

(defun ediff-inferior-compare-regions ()
  "Compare regions in an active Ediff session.
Like ediff-regions-linewise but is called from under an active Ediff session on
the files that belong to that session.

After quitting the session invoked via this function, type C-l to the parent
Ediff Control Panel to restore highlighting."
  (let ((answer "")
        (possibilities (list ?A ?B ?C))
        (zmacs-regions t)
        begA begB endA endB bufA bufB buf-type-A buf-type-B)
    (if (ediff-valid-difference-p ediff-current-difference)
          (ediff-set-fine-diff-properties ediff-current-difference 'default)
    (ediff-paint-background-regions 'unhighlight)
    (flet ((char-to-buf-type (char)
                             (cond ((eq char ?A) 'A)
                                   ((eq char ?B) 'B)
                                   ((eq char ?C) 'C)
                                    (error "Assertion failed: invalid character 
%S" char)))))
      (cond ((ediff-merge-job)
             (setq bufB ediff-buffer-C)
             ;; ask which buffer to compare to the merge buffer
             (while (cond ((eq answer ?A)
                           (setq bufA ediff-buffer-A
                                 possibilities '(?B)
                                 buf-type-B (char-to-buf-type answer))
                          ((eq answer ?B)
                           (setq bufA ediff-buffer-B
                                 possibilities '(?A)
                                 buf-type-B (char-to-buf-type answer))
                          ((equal answer ""))
                          (t (beep 1)
                             (message "Valid values are A or B")
                             (sit-for 2)
               (let ((cursor-in-echo-area t))
                  "Which buffer to compare to the merge buffer (A or B)? ")
                 (setq answer (capitalize (read-char-exclusive))))))
             ;; ask which two buffers to compare
             (while (cond ((memq answer possibilities)
                           (setq possibilities (delq answer possibilities))
                           (setq bufA
                                   answer ediff-buffer-alist)))
                           (setq buf-type-A (char-to-buf-type answer))
                          ((equal answer ""))
                          (t (beep 1)
                              "Valid values are %s"
                              (mapconcat 'char-to-string possibilities " or "))
                             (sit-for 2)
               (let ((cursor-in-echo-area t))
                 (message "Enter the 1st buffer you want to compare (%s): "
                          (mapconcat 'char-to-string possibilities " or "))
                 (setq answer (capitalize (read-char-exclusive)))))
             (setq answer "") ; silence error msg
             (while (cond ((memq answer possibilities)
                           (setq possibilities (delq answer possibilities))
                           (setq bufB
                                   answer ediff-buffer-alist)))
                           (setq buf-type-B (char-to-buf-type answer))
                          ((equal answer ""))
                          (t (beep 1)
                              "Valid values are %s"
                              (mapconcat 'char-to-string possibilities " or "))
                             (sit-for 2)
               (let ((cursor-in-echo-area t))
                 (message "Enter the 2nd buffer you want to compare (%s): "
                          (mapconcat 'char-to-string possibilities "/"))
                 (setq answer (capitalize (read-char-exclusive))))))
            (t ; 2way comparison
             (setq bufA ediff-buffer-A
                   bufB ediff-buffer-B
                   possibilities nil))))
    (if (and (ediff-valid-difference-p ediff-current-difference)
             (y-or-n-p "Compare currently highlighted difference regions? "))
        (setq use-current-diff-p t))
    (setq bufA (if use-current-diff-p
                    bufA buf-type-A "-Region.A-")
                 (ediff-clone-buffer-for-region-comparison bufA "-Region.A-")))
    (ediff-with-current-buffer bufA
      (setq begA (region-beginning)
            endA (region-end))
      (goto-char begA)
      (setq begA (point))
      (goto-char endA)
      (or (eobp) (forward-char)) ; include the newline char
      (setq endA (point)))
    (setq bufB (if use-current-diff-p
                    bufB buf-type-B "-Region.B-")
                 (ediff-clone-buffer-for-region-comparison bufB "-Region.B-")))
    (ediff-with-current-buffer bufB
      (setq begB (region-beginning)
            endB (region-end))
      (goto-char begB)
      (setq begB (point))
      (goto-char endB)
      (or (eobp) (forward-char)) ; include the newline char
      (setq endB (point)))
     bufA begA endA bufB begB endB
     nil                        ; setup-hook
     (if use-current-diff-p     ; job name
     (if use-current-diff-p     ; word mode, if diffing current diff
         t nil)
     ;; setup param to pass to ediff-setup
     (list (cons 'ediff-split-window-function ediff-split-window-function)))))

I did not test the "ediff-merge-job" case but I suspect it also needs
to set the buf-type-A and buf-type-B variables. The 'char-to-buf-type'
local function could be written more concisely, but I could not find a
way to map a ?A character to a 'A symbol without resorting to a clunky
cond construct.

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

In GNU Emacs (x86_64-unknown-linux-gnu, GTK+ Version 2.20.1)
 of 2011-01-15 on hungover
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
configured using `configure  '--with-x-toolkit' '--with-xft' 

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Shell

Minor modes in effect:
  desktop-save-mode: t
  auto-insert-mode: t
  erc-ring-mode: t
  erc-services-mode: t
  erc-networks-mode: t
  shell-dirtrack-mode: t
  delete-selection-mode: t
  iswitchb-mode: t
  display-time-mode: t
  tooltip-mode: t
  mouse-wheel-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: 1
  transient-mark-mode: t
  abbrev-mode: t

Recent input:
<return> r h y <tab> w <tab> <return> M-x r e p o r 
t - e m <tab> b <tab> <return>

Recent messages:
History item: 498
History item: 499
History item: 500
Completing command name...
Type C-x 1 to delete the help window.
mouse-2, RET: find function's definition
Renamed transient buffer "*Help*" to "*Help*<2>"
uncompressing ediff-util.el.gz...done

Load-path shadows:
/home/brentg/emacs_lisp_imported/slime/tree-widget hides 
/home/brentg/emacs_lisp_imported/remember/remember hides 
/home/brentg/emacs_lisp_imported/css-mode/css-mode hides 

(shadow mailalias bbdb-vm vm-autoload bbdb-snarf mail-extr rfc822
bbdb-com vm-rfaddons vm-message vm-macro multi-isearch emacsbug
ansi-color bg-emacs bg-desktop-setup conf-mode nxml-uchnm rng-xsd
xsd-regexp rng-cmpct vc-git skeleton desktop bg-customizations
bg-kmacro-setup bg-match-util bg-x-setup bg-ebrowse-setup ebrowse
ebuff-menu electric bg-init-program-setup bg-dos-batch-mode
bg-cmake-setup cmake-mode bg-quack-setup quack bg-qmake-setup
bg-allout-setup bg-gimp-mode-setup eldoc cmuscheme scheme gimp-mode
scheme-complete snippet autoinsert bg-edebug-setup edebug
bg-lisppaste-setup bg-instrument-util bg-calc-setup calc-ext calc
calc-loaddefs calc-macs bg-sudo-setup sudo bg-crontab-util bg-reminder
bg-wikipedia-mode-setup wikipedia-mode bg-outline-magic-mode-setup
outline-magic noutline outline bg-emacs-lisp-mode-setup bg-lisp-util
find-func bg-lisp-setup bg-stumpwm-setup stumpwm-mode
bg-css-mode-setup bg-gnuserv-setup gnuserv bg-compressed-files-setup
bg-apropos-mode-setup apropos bg-search-tcl bg-man-setup bg-env-setup
man assoc bg-visual-basic-mode-setup bg-regr-util bg-help-mode-setup
help-mode bg-diag bg-password-hiding-setup bg-browser-setup
bg-x-windows-util bg-perl-setup gud bg-perl-util bg-rectangle-setup
bg-picture-mode-setup bg-xml-setup rng-nxml rng-valid rng-loc rng-uri
rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns
nxml-mode nxml-outln nxml-rap nxml-util nxml-glyph nxml-enc xmltok
bg-boxquote-setup boxquote bg-iswitchb-setup bg-outline-setup allout
bg-autosave-setup bg-mgc-specific-setup
bg-local-directory-registry-util bg-mail-abbrev-setup mailabbrev
uniquify ibuffer bg-planner-setup bg-planner-indexing
bg-planner-yank-link bg-planner-yank-link-man
bg-planner-yank-link-file bg-planner-yank-link-info bg-web-util mm-url
url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-util url-parse auth-source netrc url-vars mailcap
bg-planner-yank-link-w3m bg-w3m-util
bg-search-object-regexp-instruction-list bg-search-object-simple
bg-search-object-none bg-planner-yank-link-base bg-search-object-base
bg-planner-elisp bg-remember-mode-setup remember-planner remember
bg-bbdb-setup bbdb-autoloads bbdb bg-planner-note-util
bg-elisp-unit-test-util bg-planner-util bg-muse-hacks image-file
planner-lisp planner-publish muse-xml planner cal-menu calendar
cal-loaddefs sort muse-colors bg-muse-setup bg-planner-abbrevs-setup
muse-html muse-xml-common cus-edit cus-start cus-load muse-publish
muse-project muse-protocols muse-regexps muse muse-nested-tags
muse-mode bg-cleanup-whitespace-at-point bg-planner-vars timeclock
bg-scrolling-setup bg-irc-setup erc-ring erc-join erc-services
erc-networks erc-dcc erc-fill erc-stamp erc-goodies erc erc-backend
erc-compat format-spec bg-ediff-setup bg-info-setup
bg-completion-list-mode-setup bg-global-key-mappings
bg-wrap-variable-util bg-rx-interactive bg-grep-setup bg-grep-group
grep bg-color-moccur-setup color-moccur bg-search-replace-util
bg-occur-mode-setup bg-find-file-setup bg-bookmark-definitions
bookmark pp bg-tabstop-definitions bg-mail-setup vm-w3m vm-pine
vm-mark vm-save vm-virtual vm-summary-faces vm-edit vm-imap vm-pop
vm-delete vm-digest vm-reply vm-toolbar vm-sort vm-undo vm-page
vm-motion vm-thread vm-mouse vm-minibuf vm-mime vm-menu tapestry
vm-window vm-crypto vm-summary vm-folder vm-misc vm vm-autoloads
vm-version vm-vars bg-encryption-setup dgpg generic epa-file epa
derived epg epg-config bg-w3m-setup edmacro kmacro w3m browse-url
doc-view jka-compr image-mode timezone w3m-hist w3m-fb bookmark-w3m
w3m-ems w3m-ccl ccl w3m-favicon w3m-image w3m-proc w3m-util supercite
regi smtpmail sendmail bg-gnus-definitions imap gnus gnus-ems nnheader
gnus-util mail-utils mm-util mail-prsvr wid-edit bg-octave-setup
bg-scm-setup bg-vc-util vc pcvs pcvs-parse pcvs-info pcvs-defs
bg-git-setup git log-edit easy-mmode pcvs-util add-log ewoc
bg-tcl-mode-setup bg-compile-setup bg-grep-compilation-util
bg-python-mode-setup python-21 python bg-buffer-menu-setup warnings
bg-makefile-mode-setup bg-shell-script-mode-setup sh-script executable
bg-dbx bg-gdb bg-gdb-util bg-javascript-setup js byte-opt bytecomp
byte-compile json imenu newcomment bg-java-setup bg-minibuffer-setup
bg-frame-definitions bg-vc-mode-setup vc-dispatcher
bg-dired-extensions bg-pdf-setup bg-pdf-util dired-aux dired
bg-forms-mode-setup forms-mode forms bg-isearch-setup bg-display-setup
bg-cc-mode-setup bg-debug-util bg-narrowing-setup bg-cxx-nav
bg-run-immediate bg-window-config-helper bg-id-utils-setup idutils
compile info bg-info-util bg-symbol-stack bg-cxx-util
bg-cxx-scan-debug-mode-base bg-basic-regexps-and-chars bg-p4-setup
p4-hacks p4 advice help-fns advice-preload bg-p4-completion
bg-p4-resolve bg-set-util bg-ediff-sparse-mode
bg-ediff-sparse-mode-base bg-p4-manual-apply-mode
bg-p4-manual-apply-mode-base bg-error-nav-util bg-rx-extra
bg-shell-mode-setup bg-shell-util bg-abbrev-skeleton-util
bg-background time-date bg-rlogin-setup rlogin shell comint ring
bg-open-file-at-point bg-p4-scan-mode bg-p4-scan-mode-base view
bg-button-mode-util bg-p4-basic-button bg-p4-util cc-mode cc-fonts
easymenu cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
bg-pushfile-util bg-unit-test-util bg-elisp-debug-util elp perl-mode
mouse-sel thingatpt rect bg-delete-selection-mode-setup delsel
bg-utility iswitchb bg-file-cleanup bg-os-util bg-win32-utility
regexp-opt rx bg-win32-paths bg-linux-utility help-macro ediff-merg
ediff-diff ediff-wind ediff-help ediff-util ediff-mult ediff-init
ediff bg-coding-system-setup time bg-basic-setup bg-emacs-config cl
lisppaste-autoloads xml-rpc-autoloads package reporter tooltip
ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd
fontset image fringe 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 loaddefs button minibuffer faces
cus-face files text-properties overlay 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)

--- End Message ---
--- Begin Message --- Subject: Re: bug#11319: [PATCH 1/2] BUGFIX: select current-diff-comparison regions for ediff-inferior-compare-regions correctly Date: Fri, 14 Dec 2012 10:23:53 -0500 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
Version: 24.4

> The buffer types passed to
> ediff-clone-buffer-for-current-diff-comparison are used to select the
> character ranges that participate in the inferior comparison.  Those
> were being hardcoded as 'A and 'B, which was wrong.

Thank you, it looks OK, so I installed it in trunk,


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]