From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emilio Lopes Newsgroups: gmane.emacs.help Subject: Re: ediff from command line? Date: Fri, 8 Jul 2005 17:08:36 +0000 (UTC) Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1120842810 2300 80.91.229.2 (8 Jul 2005 17:13:30 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 8 Jul 2005 17:13:30 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jul 08 19:13:29 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DqwPl-000718-Fn for geh-help-gnu-emacs@m.gmane.org; Fri, 08 Jul 2005 19:13:25 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DqwRB-0003bs-Fg for geh-help-gnu-emacs@m.gmane.org; Fri, 08 Jul 2005 13:14:53 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DqwQF-0003MY-Tc for help-gnu-emacs@gnu.org; Fri, 08 Jul 2005 13:13:55 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DqwQC-0003Lh-51 for help-gnu-emacs@gnu.org; Fri, 08 Jul 2005 13:13:55 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DqwQC-0003LY-13 for help-gnu-emacs@gnu.org; Fri, 08 Jul 2005 13:13:52 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1DqwTz-0003TU-6W for help-gnu-emacs@gnu.org; Fri, 08 Jul 2005 13:17:47 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1DqwM2-0006PR-Tm for help-gnu-emacs@gnu.org; Fri, 08 Jul 2005 19:09:41 +0200 Original-Received: from vproxy01.bmwgroup.com ([192.109.190.88]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 08 Jul 2005 19:09:34 +0200 Original-Received: from eclig by vproxy01.bmwgroup.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 08 Jul 2005 19:09:34 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: help-gnu-emacs@gnu.org Original-Lines: 67 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: main.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 192.109.190.88 (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4) 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:27848 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:27848 Jim Smith <3.141592six gmail.com> writes: > ... > Basically, this means I need to > invoke emacs from the command line with two file arguments and have > emacs open an ediff session on those two files. How do I do that? Here is how I do this on so called "Windows" OSes. Use at your own risk! #!/usr/bin/env perl # Time-stamp: <2003-08-22 13:57:12 Emilio C. Lopes> use strict; use warnings; use Getopt::Long; use File::Spec; use vars qw( $emacs_client $ediff_fun $verbose $help $version ); $version="1.0"; { GetOptions( 'verbose|v' => \$verbose ,'help|h' => \$help ) or usage(1); usage(0) if ($help); usage(1) if (@ARGV lt 2); $emacs_client = 'gnudoit'; if (@ARGV == 2) { $ediff_fun = 'ediff-files'; } elsif (@ARGV == 3) { $ediff_fun = 'ediff-files3'; } else { die "Error: Expecting two or three arguments.\n" } ## Convert to absolute filenames; Translate backslashes to forward ## slashes; Quote the arguments. map { $_= File::Spec->rel2abs( $_ ) ; tr /\\/\// ; $_ = "\\\"$_\\\""} @ARGV; my $cmd="$emacs_client ($ediff_fun " . join (" ", @ARGV) . ") > " . File::Spec->devnull(); print "$cmd\n" if ($verbose); system "$cmd"; } sub usage { print <<"EOF"; Ediff version $version: Frontend to Emacs' ediff package. Usage: $0 file1 file2 [file3] EOF exit $_[0]; }