help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Compare two sequent lines in one file


From: ahei
Subject: Re: Compare two sequent lines in one file
Date: Sun, 23 May 2010 00:29:47 +0800



On Sat, May 22, 2010 at 11:13 PM, filebat Mark <filebat.mark@gmail.com> wrote:
I have tried to get it works by calling the function of ediff-regions-internal.
Post the code snippet here, if any one need it.

If you have better solution, please don't hesitate to email me.
Thanks for your attentions.

;; -------------------------- separator --------------------------
(defun compare-sequent-lines ()
  "Compare two sequent lines in the same buffer, by calling ediff-regions-internal"
  (interactive)
  (save-excursion
    (move-beginning-of-line 1)
    (setq beg-a (point))
    (move-end-of-line 1)
    (setq end-a (point))
    (next-line 1)
    (move-beginning-of-line 1)
    (setq beg-b (point))
    (move-end-of-line 1)
    (setq end-b (point))
    (ediff-regions-internal
       (get-buffer (buffer-name)) beg-a end-a
       (get-buffer (buffer-name)) beg-b end-b
       nil 'ediff-windows-wordwise 'word-mode nil)
    )
)


More briefly version, and provide restoring frame configuration:
(defun ediff-sequent-lines ()
  "Compare two sequent lines in the same buffer, by calling `ediff-regions-internal'."
  (interactive)
  (let ((fc (current-frame-configuration)))
    (eval
     `(defun rfc ()
        (set-frame-configuration ',fc)
        (remove-hook 'ediff-after-quit-hook-internal 'rfc)))
    (add-hook 'ediff-after-quit-hook-internal 'rfc)
    (ediff-regions-internal
     (current-buffer) (line-beginning-position) (line-end-position)
     (current-buffer) (line-beginning-position 2) (line-end-position 2)
     nil 'ediff-windows-wordwise 'word-mode nil)))
 
On Fri, May 21, 2010 at 9:42 PM, filebat Mark <filebat.mark@gmail.com> wrote:
Hi all

Can we compare two sequent lines in one file?  A sample file can be found at the bottom.

With my friend's suggestion, I have managed to do this by calling an internal function(ediff-regions-internal) of ediff.el.
However, leveraging internal interface is quite dangerous.
Besides, this is still some more effort to make it work with the way of ediff-regions-internal.
I may even have to change the code of ediff.el!

I am referring to my super heroes in the mail list. Can anyone give me a hint for a better way?

,-----------
| ========= Difference =========
|
| MDLS_List=dailybuild1-171-112-r1s1-002,dailybuild1-171-112-r1s1-001,dailybuild1-171-112-r2s1-002,dailybuild1-171-112-r2s1-001
| MDLS_List=dailybuild1-171-112-r1s1-001,dailybuild1-171-112-r1s1-003,dailybuild1-171-112-r2s1-002,dailybuild1-171-112-r2s1-001
|
| ========= Difference =========
|
| SS_DiskList=/dev/sdd1,/dev/sdd2,/dev/sde1,/dev/sde1
| SS_DiskList=/dev/sdc1,/dev/sdd1,/dev/sde1,/dev/sdf1
|
| ========= Difference =========
|
| SS_NumDisks=2
| SS_NumDisks=4
`-----------


--
Thanks & Regards

Denny Zhang



--
Thanks & Regards

Denny Zhang



reply via email to

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