From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ahei Newsgroups: gmane.emacs.help Subject: Re: Compare two sequent lines in one file Date: Sun, 23 May 2010 00:33:54 +0800 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=000e0cd258569fdfad0487315ffd X-Trace: dough.gmane.org 1274636823 13031 80.91.229.12 (23 May 2010 17:47:03 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 23 May 2010 17:47:03 +0000 (UTC) To: filebat Mark , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun May 23 19:47:01 2010 connect(): No such file or directory Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OGFGI-0003HD-Pw for geh-help-gnu-emacs@m.gmane.org; Sun, 23 May 2010 19:46:55 +0200 Original-Received: from localhost ([127.0.0.1]:38465 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OGFGH-00082h-UO for geh-help-gnu-emacs@m.gmane.org; Sun, 23 May 2010 13:46:54 -0400 Original-Received: from [140.186.70.92] (port=46511 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFre8-0005qa-So for help-gnu-emacs@gnu.org; Sat, 22 May 2010 12:33:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OFre7-0000fw-OQ for help-gnu-emacs@gnu.org; Sat, 22 May 2010 12:33:56 -0400 Original-Received: from mail-px0-f169.google.com ([209.85.212.169]:61393) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OFre7-0000fs-Fn for help-gnu-emacs@gnu.org; Sat, 22 May 2010 12:33:55 -0400 Original-Received: by pxi12 with SMTP id 12so2161653pxi.0 for ; Sat, 22 May 2010 09:33:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=ZcwbqlotDYgWWIXlJEW+YSfg0xxW8Ke1uiYEVA/eUIg=; b=s0jcaDFDUGOw7drxSX7TgoZ6KhfGMdSzpjRn9g4BAwavxjjxP0vxRlST7KXV7FO5ax hK0J2PBhQKj5qhfW8FmilHpaHggHxzpRgaapRbsIY6gPcRphUcpDOr+Ve5jd8XFNUIm9 SgoK1fy/9eCBZLHTiCU4oKt6zJq+JXmcTir+c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=rejO+Gh4HPF52+kDfxadijzoSQYW9vkgdFuQ+iAaRMtFClOx5GWmA2nEdUwsYKwpBV i0qKonoj+L/yfMT165GZ10ICupxldY9LKkh3pWWduhNJmDFn/iPiEWyqaxv50zk1Ma1A vt2y1y1VMB1qnC+yYpiKiRXFXjvT4GXfPWqAQ= Original-Received: by 10.142.207.15 with SMTP id e15mr2084667wfg.14.1274546034302; Sat, 22 May 2010 09:33:54 -0700 (PDT) Original-Received: by 10.142.139.6 with HTTP; Sat, 22 May 2010 09:33:54 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Mailman-Approved-At: Sun, 23 May 2010 13:44:27 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:73744 Archived-At: --000e0cd258569fdfad0487315ffd Content-Type: text/plain; charset=ISO-8859-1 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 wrote: > > > On Sat, May 22, 2010 at 11:13 PM, filebat Mark 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 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 >> >> > --000e0cd258569fdfad0487315ffd Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable but I do not know why belowing command can not work, if anyone know, let me= know:
(defun ediff-sequent-lines ()
=A0=A0"Compare= two sequent lines in the same buffer, by calling `ediff-regions-internal&#= 39;."
=A0=A0(interactive)
=A0=A0(let (buf (current-buffer))
<= div>=A0=A0 =A0(ediff-regions-internal
=A0=A0 =A0 buf (line-beginn= ing-position) (line-end-position)
=A0=A0 =A0 buf (line-beginning-= position 2) (line-end-position 2)
=A0=A0 =A0 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.mar= k@gmail.com> wrote:
I have tried to get it works by calling the function of ediff-regions-inter= nal.
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 ()
=A0 "Compare two sequent lines in th= e same buffer, by calling ediff-regions-internal"
=A0 (interactive)=
=A0 (save-excursion
=A0=A0=A0 (move-beginning-of-line 1)
=A0=A0=A0 (s= etq beg-a (point))
=A0=A0=A0 (move-end-of-line 1)
=A0=A0=A0 (setq end= -a (point))
=A0=A0=A0 (next-line 1)
=A0=A0=A0 (move-beginning-of-line= 1)
=A0=A0=A0 (setq beg-b (point))
=A0=A0=A0 (move-end-of-line 1)
=A0=A0=A0 (setq end-b (point))
=A0=A0= =A0 (ediff-regions-internal
=A0=A0=A0=A0=A0=A0 (get-buffer (buffer-name)= ) beg-a end-a
=A0=A0=A0=A0=A0=A0 (get-buffer (buffer-name)) beg-b end-b<= br>=A0=A0=A0=A0=A0=A0 nil 'ediff-windows-wordwise 'word-mode nil) =A0=A0=A0 )
)


More briefly version, and provide restoring frame configuration:
(defun ediff-sequent-lines ()
=A0=A0"= ;Compare two sequent lines in the same buffer, by calling `ediff-regions-in= ternal'."
=A0=A0(interactive)
=A0=A0(let ((fc (current-frame-con= figuration)))
=A0=A0 =A0(eval
=A0=A0 =A0 `(defun rfc ()=
=A0=A0 =A0 =A0 =A0(set-frame-configuration ',fc)
= =A0=A0 =A0 =A0 =A0(remove-hook 'ediff-after-quit-hook-internal 'rfc= )))
=A0=A0 =A0(add-hook 'ediff-after-quit-hook-internal 'rfc)
=A0=A0 =A0(ediff-regions-internal
=A0=A0 =A0 (current-buffe= r) (line-beginning-position) (line-end-position)
=A0=A0 =A0 (curr= ent-buffer) (line-beginning-position 2) (line-end-position 2)
=A0=A0 =A0 nil 'ediff-windows-wordwise 'word-mode nil)))
=
=A0
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?=A0 A sample fil= e can be found at the bottom.

With my friend's suggestion, I hav= e 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-in= ternal.
I may even have to change the code of ediff.el!

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

,-----------
| =3D=3D=3D=3D=3D=3D=3D=3D=3D Difference =3D=3D=3D=3D= =3D=3D=3D=3D=3D
|
| MDLS_List=3Ddailybuild1-171-112-r1s1-002,dailybui= ld1-171-112-r1s1-001,dailybuild1-171-112-r2s1-002,dailybuild1-171-112-r2s1-= 001
| MDLS_List=3Ddailybuild1-171-112-r1s1-001,dailybuild1-171-112-r1s1-= 003,dailybuild1-171-112-r2s1-002,dailybuild1-171-112-r2s1-001
|
| =3D=3D=3D=3D=3D=3D=3D=3D=3D Difference =3D=3D=3D=3D=3D=3D=3D=3D=3D|
| SS_DiskList=3D/dev/sdd1,/dev/sdd2,/dev/sde1,/dev/sde1
| SS_Disk= List=3D/dev/sdc1,/dev/sdd1,/dev/sde1,/dev/sdf1
|
| =3D=3D=3D=3D=3D=3D= =3D=3D=3D Difference =3D=3D=3D=3D=3D=3D=3D=3D=3D
|
| SS_NumDisks=3D2<= br> | SS_NumDisks=3D4
`-----------


--
Thanks & Regards

Denny Zhang



--
Thanks & Regards

Denny Zhang



--000e0cd258569fdfad0487315ffd--