unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: ediff-regions-internal can't handle (non-overlapping) regions in the same buffer
Date: Wed, 07 Dec 2005 13:59:31 -0700	[thread overview]
Message-ID: <dn7ifl$k0c$1@sea.gmane.org> (raw)

I'm working on a way to take advantage of Ediff's fine highlighting
feature within Diff mode buffers.  But calling ediff-regions-internal
programmatically with BUFFER-A the same as BUFFER-B doesn't work,
leaving only the region between BEG-B and END-B highighted.  This is
because ediff-extract-diffs first resets point in both buffers (changing
point in BUFFER-A unintentionally), then builds the diff vector by
moving by lines in each buffer.

The fix is simple, and it allows ediff-regions-internal to work with
non-overlapping regions in the same buffer: Don't set point in each
buffer until necessary:

*** emacs-21.4/lisp/ediff-diff.el~	Wed Jul  3 10:49:40 2002
--- emacs-21.4/lisp/ediff-diff.el	Wed Dec  7 13:34:26 2005
***************
*** 378,388 ****
   	      (ediff-overlay-start
   	       (ediff-get-value-according-to-buffer-type 'B bounds))))

!     ;; reset point in buffers A/B/C
!     (ediff-with-current-buffer A-buffer
!       (goto-char (if shift-A shift-A (point-min))))
!     (ediff-with-current-buffer B-buffer
!       (goto-char (if shift-B shift-B (point-min))))
       (if (ediff-buffer-live-p C-buffer)
   	(ediff-with-current-buffer C-buffer
   	  (goto-char (point-min))))
--- 378,384 ----
   	      (ediff-overlay-start
   	       (ediff-get-value-according-to-buffer-type 'B bounds))))

!     ;; reset point in buffer C
       (if (ediff-buffer-live-p C-buffer)
   	(ediff-with-current-buffer C-buffer
   	  (goto-char (point-min))))
***************
*** 456,461 ****
--- 452,458 ----
   		   c-prev c-end)
   	   ;; else convert lines to points
   	   (ediff-with-current-buffer A-buffer
+              (goto-char (if shift-A shift-A (point-min)))
   	     (forward-line (- a-begin a-prev))
   	     (setq a-begin-pt (point))
   	     (forward-line (- a-end a-begin))
***************
*** 462,467 ****
--- 459,465 ----
   	     (setq a-end-pt (point)
   		   a-prev a-end))
   	   (ediff-with-current-buffer B-buffer
+              (goto-char (if shift-B shift-B (point-min)))
   	     (forward-line (- b-begin b-prev))
   	     (setq b-begin-pt (point))
   	     (forward-line (- b-end b-begin))

Thanks,
-- 
Kevin

             reply	other threads:[~2005-12-07 20:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-07 20:59 Kevin Rodgers [this message]
2005-12-09 16:47 ` ediff-regions-internal can't handle (non-overlapping) regions in the same buffer Kevin Rodgers
2005-12-12 18:24   ` Kevin Rodgers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='dn7ifl$k0c$1@sea.gmane.org' \
    --to=ihs_4664@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).