From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.help Subject: Re: help: howto call ediff from elisp, interactive and multiple args ... Date: Sat, 13 Nov 2010 20:16:05 +0100 Message-ID: <8739r5uj9m.fsf@tux.homenetwork> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1289675894 2036 80.91.229.12 (13 Nov 2010 19:18:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 13 Nov 2010 19:18:14 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Nov 13 20:18:03 2010 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 1PHLbv-0007Wa-1U for geh-help-gnu-emacs@m.gmane.org; Sat, 13 Nov 2010 20:18:03 +0100 Original-Received: from localhost ([127.0.0.1]:49356 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PHLbu-0001Le-Dz for geh-help-gnu-emacs@m.gmane.org; Sat, 13 Nov 2010 14:18:02 -0500 Original-Received: from [140.186.70.92] (port=33595 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PHLbU-0001LT-N6 for help-gnu-emacs@gnu.org; Sat, 13 Nov 2010 14:17:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PHLbQ-0003MH-OO for help-gnu-emacs@gnu.org; Sat, 13 Nov 2010 14:17:36 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:37500) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PHLbQ-0003Lk-CT for help-gnu-emacs@gnu.org; Sat, 13 Nov 2010 14:17:32 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PHLbO-0007FR-P2 for help-gnu-emacs@gnu.org; Sat, 13 Nov 2010 20:17:30 +0100 Original-Received: from 248.211.85-79.rev.gaoland.net ([79.85.211.248]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 13 Nov 2010 20:17:30 +0100 Original-Received: from thierry.volpiatto by 248.211.85-79.rev.gaoland.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 13 Nov 2010 20:17:30 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 59 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 248.211.85-79.rev.gaoland.net User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.2.90 (gnu/linux) Cancel-Lock: sha1:gbTLQl8Ud6ACmEbrwp6kc1die1o= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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:75366 Archived-At: Peter Daum writes: > Sorry, I couldn't find an appropriate subject line: > > I have to compare many similar binary files and the best tool I could > find so far for this purpose is a combination of emacs, hexl-mode and > ediff. Because this involves far too much typing, I am trying to write a > little lisp function to set up everything. I already know several ways > how not to do this ;-) > > (defun hexl-ediff (file1 file2) > "hexl-find 2 files and run ediff on them" > (interactive "fFile 1:" "fFile2:") > (hexl-find-file file1) > (let* > ( > (buffer1 (last-buffer)) > (bn1 (buffer-name buffer1)) > (void (hexl-find-file file2)) > (buffer2 (last-buffer)) > (bn2 (buffer-name buffer2)) > (void (message "b1: %s b2: %s" bn1 bn2)) > ) > (ediff-buffers bn1 bn2) > )) > > There are several problems with this: > > 1) I could not find a way how to interactively call this with 2 files. > I'll get prompted for the 1st file and then I run into an error about > the wrong #args without any chance to enter the 2nd file name > 2) More severe: I could not come up with any reliable way how to get the > names of the buffers that the calls to hexl-find-file created (the > desperate attempt with "last-buffer" will return "*Completions*" ;-) > > Any ideas? (defun hexl-ediff (file1 file2) "hexl-find 2 files and run ediff on them" (interactive "fFile 1: \nfFile2:") (let ((buffer1 (progn (hexl-find-file file1) (buffer-name (current-buffer)))) (buffer2 (progn (hexl-find-file file2) (buffer-name (current-buffer))))) (ediff-buffers buffer1 buffer2))) > Regards, > Peter > > > -- A+ Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997