unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Compare two sequent lines in one file
@ 2010-05-21 13:42 filebat Mark
  2010-05-22 15:13 ` filebat Mark
  0 siblings, 1 reply; 4+ messages in thread
From: filebat Mark @ 2010-05-21 13:42 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1090 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1219 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compare two sequent lines in one file
  2010-05-21 13:42 Compare two sequent lines in one file filebat Mark
@ 2010-05-22 15:13 ` filebat Mark
  2010-05-22 16:29   ` ahei
  0 siblings, 1 reply; 4+ messages in thread
From: filebat Mark @ 2010-05-22 15:13 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 2126 bytes --]

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)
    )
)

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

[-- Attachment #2: Type: text/html, Size: 2625 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compare two sequent lines in one file
  2010-05-22 15:13 ` filebat Mark
@ 2010-05-22 16:29   ` ahei
  2010-05-22 16:33     ` ahei
  0 siblings, 1 reply; 4+ messages in thread
From: ahei @ 2010-05-22 16:29 UTC (permalink / raw)
  To: filebat Mark, help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 2965 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 4038 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compare two sequent lines in one file
  2010-05-22 16:29   ` ahei
@ 2010-05-22 16:33     ` ahei
  0 siblings, 0 replies; 4+ messages in thread
From: ahei @ 2010-05-22 16:33 UTC (permalink / raw)
  To: filebat Mark, help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 3593 bytes --]

but I do not know why belowing command can not work, if anyone know, let me
know:
(defun ediff-sequent-lines ()
  "Compare two sequent lines in the same buffer, by calling
`ediff-regions-internal'."
  (interactive)
  (let (buf (current-buffer))
    (ediff-regions-internal
     buf (line-beginning-position) (line-end-position)
     buf (line-beginning-position 2) (line-end-position 2)
     nil 'ediff-windows-wordwise 'word-mode nil)))

On Sun, May 23, 2010 at 12:29 AM, ahei <ahei0802@gmail.com> wrote:

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

[-- Attachment #2: Type: text/html, Size: 4974 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-22 16:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-21 13:42 Compare two sequent lines in one file filebat Mark
2010-05-22 15:13 ` filebat Mark
2010-05-22 16:29   ` ahei
2010-05-22 16:33     ` ahei

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).