all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Starting emacs in ediff mode.
@ 2008-01-24  0:51 DaLoverhino
  2008-01-24  2:42 ` Kevin Rodgers
       [not found] ` <mailman.6460.1201142559.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 27+ messages in thread
From: DaLoverhino @ 2008-01-24  0:51 UTC (permalink / raw)
  To: help-gnu-emacs

Hello.  I would like to use emacs as I would use say diff or sdiff.

Is there a way to start emacs in ediff mode and pass along with it
through the command line, the two files I want to ediff?  If the
command line is unwieldy, I can always wrap it up in a script.

thanks.

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

* Re: Starting emacs in ediff mode.
  2008-01-24  0:51 Starting emacs in ediff mode DaLoverhino
@ 2008-01-24  2:42 ` Kevin Rodgers
  2008-01-24 16:50   ` Lennart Borgman (gmail)
       [not found] ` <mailman.6460.1201142559.18990.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 27+ messages in thread
From: Kevin Rodgers @ 2008-01-24  2:42 UTC (permalink / raw)
  To: help-gnu-emacs

DaLoverhino wrote:
> Hello.  I would like to use emacs as I would use say diff or sdiff.
> 
> Is there a way to start emacs in ediff mode and pass along with it
> through the command line, the two files I want to ediff?  If the
> command line is unwieldy, I can always wrap it up in a script.

emacs --eval '(ediff-files "file_1" "file_2")'

-- 
Kevin Rodgers
Denver, Colorado, USA

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

* Re: Starting emacs in ediff mode.
       [not found] ` <mailman.6460.1201142559.18990.help-gnu-emacs@gnu.org>
@ 2008-01-24 16:40   ` DaLoverhino
  2008-01-24 18:03     ` Thien-Thi Nguyen
  2008-01-24 18:50     ` Rob Wolfe
  0 siblings, 2 replies; 27+ messages in thread
From: DaLoverhino @ 2008-01-24 16:40 UTC (permalink / raw)
  To: help-gnu-emacs

On Jan 23, 9:42 pm, Kevin Rodgers <kevin.d.rodg...@gmail.com> wrote:
> DaLoverhino wrote:
> > Hello.  I would like to use emacs as I would use say diff or sdiff.
>
> > Is there a way to start emacs in ediff mode and pass along with it
> > through the command line, the two files I want to ediff?  If the
> > command line is unwieldy, I can always wrap it up in a script.
>
> emacs --eval '(ediff-files "file_1" "file_2")'
>
> --
> Kevin Rodgers
> Denver, Colorado, USA

Thanks.  It works from the command line, but when I put it in a shell,
it doesn't seem to work.  Do you know what is going on?

#!/bin/bash

fileA=$1
fileB=$2

if [[ -z "$fileA" && -z "$fileB" ]]
then
  echo "Need two files to ediff."
  exit 1
fi



evalArg="'(ediff-files \"$fileA\" \"$fileB\" )'"

echo emacs --geometry 150x80 --eval $evalArg

emacs --geometry 150x80 --eval $evalArg

exit 0

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

* Re: Starting emacs in ediff mode.
  2008-01-24  2:42 ` Kevin Rodgers
@ 2008-01-24 16:50   ` Lennart Borgman (gmail)
  2008-01-25  9:45     ` Eli Zaretskii
  0 siblings, 1 reply; 27+ messages in thread
From: Lennart Borgman (gmail) @ 2008-01-24 16:50 UTC (permalink / raw)
  Cc: help-gnu-emacs

Kevin Rodgers wrote:
> DaLoverhino wrote:
>> Hello.  I would like to use emacs as I would use say diff or sdiff.
>>
>> Is there a way to start emacs in ediff mode and pass along with it
>> through the command line, the two files I want to ediff?  If the
>> command line is unwieldy, I can always wrap it up in a script.
> 
> emacs --eval '(ediff-files "file_1" "file_2")'

It is a bit more difficult on Windows:

@rem Put this file (ediff.cmd) in your PATH.
@rem (Created by Setup Helper at Tue Apr 03 20:48:56 2007)
@rem -----------------------------
@rem Starts Emacs ediff (through gnuserv) from command line.
@rem Takes the two file to compare as parameters.
@setlocal
@set f1=%1
@set f2=%2
@set f1=%f1:\=/%
@set f2=%f2:\=/%
@set emacs_cd=%CD:\=/%
@set emacs_client="c:\emacs\p\070403\emacs\bin\emacsclient.exe"
@%emacs_client% -n
@%emacs_client% -e "(setq default-directory \"%emacs_cd%\")"
@%emacs_client% -n  -e "(ediff-files \"%f1%\" \"%f2%\")"

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

* Re: Starting emacs in ediff mode.
  2008-01-24 16:40   ` DaLoverhino
@ 2008-01-24 18:03     ` Thien-Thi Nguyen
  2008-01-24 18:50     ` Rob Wolfe
  1 sibling, 0 replies; 27+ messages in thread
From: Thien-Thi Nguyen @ 2008-01-24 18:03 UTC (permalink / raw)
  To: gnu-emacs-help

() DaLoverhino <DaLoveRhino@hotmail.com>
() Thu, 24 Jan 2008 08:40:48 -0800 (PST)

   echo emacs --geometry 150x80 --eval $evalArg

this command displays the "emacs ..." command,
but does not invoke it.  try removing the "echo".

thi

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

* Re: Starting emacs in ediff mode.
  2008-01-24 16:40   ` DaLoverhino
  2008-01-24 18:03     ` Thien-Thi Nguyen
@ 2008-01-24 18:50     ` Rob Wolfe
  2008-01-25 20:51       ` DaLoverhino
  1 sibling, 1 reply; 27+ messages in thread
From: Rob Wolfe @ 2008-01-24 18:50 UTC (permalink / raw)
  To: help-gnu-emacs

DaLoverhino <DaLoveRhino@hotmail.com> writes:

[...]

> Thanks.  It works from the command line, but when I put it in a shell,
> it doesn't seem to work.  Do you know what is going on?
>
> #!/bin/bash
>
> fileA=$1
> fileB=$2
>
> if [[ -z "$fileA" && -z "$fileB" ]]
> then
>   echo "Need two files to ediff."
>   exit 1
> fi
>
>
>
> evalArg="'(ediff-files \"$fileA\" \"$fileB\" )'"
>
> echo emacs --geometry 150x80 --eval $evalArg
>
> emacs --geometry 150x80 --eval $evalArg
>
> exit 0

Try this:
emacs --geometry 150x80 --eval "(ediff-files \"$fileA\" \"$fileB\")"

HTH,
Rob

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

* Re: Starting emacs in ediff mode.
  2008-01-24 16:50   ` Lennart Borgman (gmail)
@ 2008-01-25  9:45     ` Eli Zaretskii
  2008-01-25 14:55       ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 27+ messages in thread
From: Eli Zaretskii @ 2008-01-25  9:45 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Thu, 24 Jan 2008 17:50:05 +0100
> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
> CC: help-gnu-emacs@gnu.org
> 
> Kevin Rodgers wrote:
> > DaLoverhino wrote:
> >> Hello.  I would like to use emacs as I would use say diff or sdiff.
> >>
> >> Is there a way to start emacs in ediff mode and pass along with it
> >> through the command line, the two files I want to ediff?  If the
> >> command line is unwieldy, I can always wrap it up in a script.
> > 
> > emacs --eval '(ediff-files "file_1" "file_2")'
> 
> It is a bit more difficult on Windows:

This works for me on Windows:

   emacs --eval "(ediff-files \"file_1\" \"file_2\")"

> @rem Put this file (ediff.cmd) in your PATH.
> @rem (Created by Setup Helper at Tue Apr 03 20:48:56 2007)
> @rem -----------------------------
> @rem Starts Emacs ediff (through gnuserv) from command line.
> @rem Takes the two file to compare as parameters.
> @setlocal
> @set f1=%1
> @set f2=%2
> @set f1=%f1:\=/%
> @set f2=%f2:\=/%
> @set emacs_cd=%CD:\=/%
> @set emacs_client="c:\emacs\p\070403\emacs\bin\emacsclient.exe"
> @%emacs_client% -n
> @%emacs_client% -e "(setq default-directory \"%emacs_cd%\")"
> @%emacs_client% -n  -e "(ediff-files \"%f1%\" \"%f2%\")"

Can you explain what did you need all this complexity for?

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

* Re: Starting emacs in ediff mode.
  2008-01-25  9:45     ` Eli Zaretskii
@ 2008-01-25 14:55       ` Lennart Borgman (gmail)
  2008-01-25 16:48         ` Eli Zaretskii
       [not found]         ` <mailman.6531.1201279722.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 27+ messages in thread
From: Lennart Borgman (gmail) @ 2008-01-25 14:55 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

Eli Zaretskii wrote:
>> Date: Thu, 24 Jan 2008 17:50:05 +0100
>> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
>> CC: help-gnu-emacs@gnu.org
>>
>> Kevin Rodgers wrote:
>>> DaLoverhino wrote:
>>>> Hello.  I would like to use emacs as I would use say diff or sdiff.
>>>>
>>>> Is there a way to start emacs in ediff mode and pass along with it
>>>> through the command line, the two files I want to ediff?  If the
>>>> command line is unwieldy, I can always wrap it up in a script.
>>> emacs --eval '(ediff-files "file_1" "file_2")'
>> It is a bit more difficult on Windows:
> 
> This works for me on Windows:
> 
>    emacs --eval "(ediff-files \"file_1\" \"file_2\")"
> 
>> @rem Put this file (ediff.cmd) in your PATH.
>> @rem (Created by Setup Helper at Tue Apr 03 20:48:56 2007)
>> @rem -----------------------------
>> @rem Starts Emacs ediff (through gnuserv) from command line.
>> @rem Takes the two file to compare as parameters.
>> @setlocal
>> @set f1=%1
>> @set f2=%2
>> @set f1=%f1:\=/%
>> @set f2=%f2:\=/%
>> @set emacs_cd=%CD:\=/%
>> @set emacs_client="c:\emacs\p\070403\emacs\bin\emacsclient.exe"
>> @%emacs_client% -n
>> @%emacs_client% -e "(setq default-directory \"%emacs_cd%\")"
>> @%emacs_client% -n  -e "(ediff-files \"%f1%\" \"%f2%\")"
> 
> Can you explain what did you need all this complexity for?


Sure:

- Emacs client is used.
- File names given need not be absolute.
- You can not give use \ in the file names.
- Be nice, do not put env variables in the users environment

The rest is just comments ;-)

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

* Re: Starting emacs in ediff mode.
  2008-01-25 14:55       ` Lennart Borgman (gmail)
@ 2008-01-25 16:48         ` Eli Zaretskii
  2008-01-25 17:03           ` Juanma Barranquero
       [not found]         ` <mailman.6531.1201279722.18990.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 27+ messages in thread
From: Eli Zaretskii @ 2008-01-25 16:48 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Fri, 25 Jan 2008 15:55:20 +0100
> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
> CC: help-gnu-emacs@gnu.org
> 
> - File names given need not be absolute.
> - You can not give use \ in the file names.
> - Be nice, do not put env variables in the users environment

Which of these problems are relevant to the simple invocation of Emacs
that I suggested:

> >    emacs --eval "(ediff-files \"file_1\" \"file_2\")"

As for this one:

> - Emacs client is used.

I don't see how is this relevant to the OP's question: if they already
have Emacs running, they could simply invoke Ediff from within that
Emacs session.  And if Emacs is not running, what's the advantage of
using emacsclient?

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

* Re: Starting emacs in ediff mode.
  2008-01-25 16:48         ` Eli Zaretskii
@ 2008-01-25 17:03           ` Juanma Barranquero
  2008-01-26  8:44             ` Eli Zaretskii
       [not found]             ` <mailman.6561.1201337056.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 27+ messages in thread
From: Juanma Barranquero @ 2008-01-25 17:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

On Jan 25, 2008 5:48 PM, Eli Zaretskii <eliz@gnu.org> wrote:

> > - File names given need not be absolute.
> > - You can not give use \ in the file names.
> > - Be nice, do not put env variables in the users environment
>
> Which of these problems are relevant to the simple invocation of Emacs
> that I suggested:
>
> > >    emacs --eval "(ediff-files \"file_1\" \"file_2\")"

I think Lennart is saying that if file_1 and file_2 are relative,
Emacs does not find them, and if they are absolute, the backslashes in
the paths cause problems (at the very least, they must be escaped
themselves).

> I don't see how is this relevant to the OP's question: if they already
> have Emacs running, they could simply invoke Ediff from within that
> Emacs session.  And if Emacs is not running, what's the advantage of
> using emacsclient?

Lennart's patched emacsclient starts Emacs automatically.

             Juanma

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

* Re: Starting emacs in ediff mode.
  2008-01-24 18:50     ` Rob Wolfe
@ 2008-01-25 20:51       ` DaLoverhino
  0 siblings, 0 replies; 27+ messages in thread
From: DaLoverhino @ 2008-01-25 20:51 UTC (permalink / raw)
  To: help-gnu-emacs

On Jan 24, 1:50 pm, Rob Wolfe <r...@smsnet.pl> wrote:
> DaLoverhino <DaLoveRh...@hotmail.com> writes:
>
> [...]
>
>
>
> > Thanks.  It works from the command line, but when I put it in a shell,
> > it doesn't seem to work.  Do you know what is going on?
>
> > #!/bin/bash
>
> > fileA=$1
> > fileB=$2
>
> > if [[ -z "$fileA" && -z "$fileB" ]]
> > then
> >   echo "Need two files to ediff."
> >   exit 1
> > fi
>
> > evalArg="'(ediff-files \"$fileA\" \"$fileB\" )'"
>
> > echo emacs --geometry 150x80 --eval $evalArg
>
> > emacs --geometry 150x80 --eval $evalArg
>
> > exit 0
>
> Try this:
> emacs --geometry 150x80 --eval "(ediff-files \"$fileA\" \"$fileB\")"
>
> HTH,
> Rob

That did work.  Thanks!!

And thanks everyone for helping me out.

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

* Re: Starting emacs in ediff mode.
       [not found]         ` <mailman.6531.1201279722.18990.help-gnu-emacs@gnu.org>
@ 2008-01-25 20:58           ` DaLoverhino
  2008-01-26  7:08             ` Thierry Volpiatto
  0 siblings, 1 reply; 27+ messages in thread
From: DaLoverhino @ 2008-01-25 20:58 UTC (permalink / raw)
  To: help-gnu-emacs

On Jan 25, 11:48 am, Eli Zaretskii <e...@gnu.org> wrote:
> > Date: Fri, 25 Jan 2008 15:55:20 +0100
> > From: "Lennart Borgman (gmail)" <lennart.borg...@gmail.com>
> > CC: help-gnu-em...@gnu.org
>
> > - File names given need not be absolute.
> > - You can not give use \ in the file names.
> > - Be nice, do not put env variables in the users environment
>
> Which of these problems are relevant to the simple invocation of Emacs
> that I suggested:
>
> > >    emacs --eval "(ediff-files \"file_1\" \"file_2\")"
>
> As for this one:
>
> > - Emacs client is used.
>
> I don't see how is this relevant to the OP's question: if they already
> have Emacs running, they could simply invoke Ediff from within that
> Emacs session.  And if Emacs is not running, what's the advantage of
> using emacsclient?

You guys are too smart for me.  I can't follow your arguments.  :)

But if this helps, the reason why I wanted to know how to start emacs
in ediff mode is so that I can use it with svn (revision source
control.)  svn's diff program isn't very good.  However, svn allows
you to fire up your own diff program to do the diffs.

svn has a graphical version which I hear is more user friendly.
However, making a long story short, I can't effectively control what
software gets installed on my devbox.  So that's why I was hoping to
use emacs for my diff program.

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

* Re: Starting emacs in ediff mode.
  2008-01-25 20:58           ` DaLoverhino
@ 2008-01-26  7:08             ` Thierry Volpiatto
  0 siblings, 0 replies; 27+ messages in thread
From: Thierry Volpiatto @ 2008-01-26  7:08 UTC (permalink / raw)
  To: DaLoverhino; +Cc: help-gnu-emacs

DaLoverhino <DaLoveRhino@hotmail.com> writes:

> On Jan 25, 11:48 am, Eli Zaretskii <e...@gnu.org> wrote:
>> > Date: Fri, 25 Jan 2008 15:55:20 +0100
>> > From: "Lennart Borgman (gmail)" <lennart.borg...@gmail.com>
>> > CC: help-gnu-em...@gnu.org
>>
>> > - File names given need not be absolute.
>> > - You can not give use \ in the file names.
>> > - Be nice, do not put env variables in the users environment
>>
>> Which of these problems are relevant to the simple invocation of Emacs
>> that I suggested:
>>
>> > >    emacs --eval "(ediff-files \"file_1\" \"file_2\")"
>>
>> As for this one:
>>
>> > - Emacs client is used.
>>
>> I don't see how is this relevant to the OP's question: if they already
>> have Emacs running, they could simply invoke Ediff from within that
>> Emacs session.  And if Emacs is not running, what's the advantage of
>> using emacsclient?
>
> You guys are too smart for me.  I can't follow your arguments.  :)
>
> But if this helps, the reason why I wanted to know how to start emacs
> in ediff mode is so that I can use it with svn (revision source
> control.)  svn's diff program isn't very good.  However, svn allows
> you to fire up your own diff program to do the diffs.
>
> svn has a graphical version which I hear is more user friendly.
> However, making a long story short, I can't effectively control what
> software gets installed on my devbox.  So that's why I was hoping to
> use emacs for my diff program.
Do you use psvn.el ? with it when you are in  svn-status, you just have 
to hit E to ediff your file with the last commited version.
If you prefix your command with C-u you can ediff with the version of the file
you want.
psvn.el is installed with subversion you just have to require it.
Have a look in your site-emacs/subversion.
-- 
A + Thierry
Pub key: http://pgp.mit.edu

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

* Re: Starting emacs in ediff mode.
  2008-01-25 17:03           ` Juanma Barranquero
@ 2008-01-26  8:44             ` Eli Zaretskii
  2008-01-26 13:46               ` Juanma Barranquero
       [not found]             ` <mailman.6561.1201337056.18990.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 27+ messages in thread
From: Eli Zaretskii @ 2008-01-26  8:44 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Fri, 25 Jan 2008 18:03:30 +0100
> From: "Juanma Barranquero" <lekktu@gmail.com>
> Cc: help-gnu-emacs@gnu.org
> 
> > > >    emacs --eval "(ediff-files \"file_1\" \"file_2\")"
> 
> I think Lennart is saying that if file_1 and file_2 are relative,

Really?  It works for me with relative file names (of course, I used
"-q" as well, so if someone changes directory in their .emacs, that
could be a problem).

> Emacs does not find them, and if they are absolute, the backslashes in
> the paths cause problems (at the very least, they must be escaped
> themselves).

Or use forward slashes; nothing new here.

> > I don't see how is this relevant to the OP's question: if they already
> > have Emacs running, they could simply invoke Ediff from within that
> > Emacs session.  And if Emacs is not running, what's the advantage of
> > using emacsclient?
> 
> Lennart's patched emacsclient starts Emacs automatically.

That's fine, but I asked what was the _advantage_ of using
emacsclient instead of invoking Emacs itself?

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

* Re: Starting emacs in ediff mode.
  2008-01-26  8:44             ` Eli Zaretskii
@ 2008-01-26 13:46               ` Juanma Barranquero
  2008-01-26 14:21                 ` Lennart Borgman (gmail)
       [not found]                 ` <mailman.6567.1201357297.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 27+ messages in thread
From: Juanma Barranquero @ 2008-01-26 13:46 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

On Jan 26, 2008 9:44 AM, Eli Zaretskii <eliz@gnu.org> wrote:

> Really?  It works for me with relative file names (of course, I used
> "-q" as well, so if someone changes directory in their .emacs, that
> could be a problem).

You're right.

> Or use forward slashes; nothing new here.

That' a bit more difficult if the Emacs invocation is not typed into
the command line, but comes from another tool.

> That's fine, but I asked what was the _advantage_ of using
> emacsclient instead of invoking Emacs itself?

That it works in both cases. So you can have a .BAT somewhere (perhaps
called from another tool) that runs emacsclient to do a diff, and it
does not need to know whether Emacs is already running or not, and
does not start multiple Emacs instances. I'd say that's an advantage.

             Juanma

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

* Re: Starting emacs in ediff mode.
  2008-01-26 13:46               ` Juanma Barranquero
@ 2008-01-26 14:21                 ` Lennart Borgman (gmail)
       [not found]                 ` <mailman.6567.1201357297.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 27+ messages in thread
From: Lennart Borgman (gmail) @ 2008-01-26 14:21 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: help-gnu-emacs

Juanma Barranquero wrote:
> On Jan 26, 2008 9:44 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> Really?  It works for me with relative file names (of course, I used
>> "-q" as well, so if someone changes directory in their .emacs, that
>> could be a problem).
> 
> You're right.

But also of course if emacs client is used you do not know which 
directory Emacs has as default. So you have to tell Emacs which 
directory the file names are relative to.

>> Or use forward slashes; nothing new here.
> 
> That' a bit more difficult if the Emacs invocation is not typed into
> the command line, but comes from another tool.

A fairly common case could be that you do file name completion in 
cmd.exe. Then you will get backward slashes. Putting these inside "..." 
will make Emacs interpret them as they should escape the next character 
in the string.

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

* Re: Starting emacs in ediff mode.
       [not found]                 ` <mailman.6567.1201357297.18990.help-gnu-emacs@gnu.org>
@ 2008-01-26 19:50                   ` Stefan Monnier
  2008-01-26 20:52                     ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 27+ messages in thread
From: Stefan Monnier @ 2008-01-26 19:50 UTC (permalink / raw)
  To: help-gnu-emacs

> But also of course if emacs client is used you do not know which directory
> Emacs has as default. So you have to tell Emacs which directory the file
> names are relative to.

No: emacsclient takes care of that already, of course.


        Stefan

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

* Re: Starting emacs in ediff mode.
  2008-01-26 19:50                   ` Stefan Monnier
@ 2008-01-26 20:52                     ` Lennart Borgman (gmail)
  2008-01-26 21:55                       ` Stefan Monnier
  0 siblings, 1 reply; 27+ messages in thread
From: Lennart Borgman (gmail) @ 2008-01-26 20:52 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs

Stefan Monnier wrote:
>> But also of course if emacs client is used you do not know which directory
>> Emacs has as default. So you have to tell Emacs which directory the file
>> names are relative to.
> 
> No: emacsclient takes care of that already, of course.


For opening a file, yes. But not for --eval AFAICS. Perhaps it should do 
it for that case too?

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

* Re: Starting emacs in ediff mode.
  2008-01-26 20:52                     ` Lennart Borgman (gmail)
@ 2008-01-26 21:55                       ` Stefan Monnier
  0 siblings, 0 replies; 27+ messages in thread
From: Stefan Monnier @ 2008-01-26 21:55 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: help-gnu-emacs

>>> But also of course if emacs client is used you do not know which directory
>>> Emacs has as default. So you have to tell Emacs which directory the file
>>> names are relative to.
>> 
>> No: emacsclient takes care of that already, of course.

> For opening a file, yes. But not for --eval AFAICS.

Oh, that's right, sorry 'bout that.

> Perhaps it should do it for that case too?

Yes, probably.  I believe I just fixed it in the trunk.


        Stefan

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

* Re: Starting emacs in ediff mode.
       [not found]             ` <mailman.6561.1201337056.18990.help-gnu-emacs@gnu.org>
@ 2008-01-27 13:17               ` Richard G Riley
  2008-01-27 14:55                 ` Juanma Barranquero
       [not found]                 ` <mailman.6605.1201445728.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 27+ messages in thread
From: Richard G Riley @ 2008-01-27 13:17 UTC (permalink / raw)
  To: help-gnu-emacs

Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Fri, 25 Jan 2008 18:03:30 +0100
>> From: "Juanma Barranquero" <lekktu@gmail.com>
>> Cc: help-gnu-emacs@gnu.org
>> 
>> > > >    emacs --eval "(ediff-files \"file_1\" \"file_2\")"
>> 
>> I think Lennart is saying that if file_1 and file_2 are relative,
>
> Really?  It works for me with relative file names (of course, I used
> "-q" as well, so if someone changes directory in their .emacs, that
> could be a problem).
>
>> Emacs does not find them, and if they are absolute, the backslashes in
>> the paths cause problems (at the very least, they must be escaped
>> themselves).
>
> Or use forward slashes; nothing new here.
>
>> > I don't see how is this relevant to the OP's question: if they already
>> > have Emacs running, they could simply invoke Ediff from within that
>> > Emacs session.  And if Emacs is not running, what's the advantage of
>> > using emacsclient?
>> 
>> Lennart's patched emacsclient starts Emacs automatically.
>
> That's fine, but I asked what was the _advantage_ of using
> emacsclient instead of invoking Emacs itself?

The same advantage of ever using emacsclient one would have thought.

Personally I must admit to being surprised that emacsclient doesn't
invoke emacs if there is not an existing emacs running - that one
ommission makes it tricky to set up emacsclient as default viewer/editor
in many cases. One could always turn off that default behaviour for more
advanced use. I've read reasonings as to why it doesn't launch emacs if
not already done, but, well, it just seems quite wrong and I guess why
lennart changed the default in his distribution.

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

* Re: Starting emacs in ediff mode.
  2008-01-27 13:17               ` Richard G Riley
@ 2008-01-27 14:55                 ` Juanma Barranquero
  2008-01-27 15:13                   ` Lennart Borgman (gmail)
  2008-01-28 16:00                   ` reader
       [not found]                 ` <mailman.6605.1201445728.18990.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 27+ messages in thread
From: Juanma Barranquero @ 2008-01-27 14:55 UTC (permalink / raw)
  To: Richard G Riley; +Cc: help-gnu-emacs

On Jan 27, 2008 2:17 PM, Richard G Riley <rileyrgdev@gmail.com> wrote:

> Personally I must admit to being surprised that emacsclient doesn't
> invoke emacs if there is not an existing emacs running - that one
> ommission makes it tricky to set up emacsclient as default viewer/editor
> in many cases.

Of course you can run emacsclient so it will start Emacs if it is not
running; that's what the --alternate-editor option is for. The trick,
of course, is that --alternate-editor doesn't run Emacs as a server
connected to the emacsclient instance that started it. That does not
preclude using it as default viewer/editor in all cases, just the ones
where it is automatically run from a tool that expects it to be done
when emacsclient returns (for example, in many VCS when emacsclient is
used as the editor for the commit logs).

> I've read reasonings as to why it doesn't launch emacs if
> not already done, but, well, it just seems quite wrong

I haven't read (in the emacs-devel list) reasonings as to why it
*shouldn't* do it, just as to why it is not yet implemented.

             Juanma

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

* Re: Starting emacs in ediff mode.
  2008-01-27 14:55                 ` Juanma Barranquero
@ 2008-01-27 15:13                   ` Lennart Borgman (gmail)
  2008-01-27 22:25                     ` Juanma Barranquero
  2008-01-28 16:00                   ` reader
  1 sibling, 1 reply; 27+ messages in thread
From: Lennart Borgman (gmail) @ 2008-01-27 15:13 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: Richard G Riley, help-gnu-emacs

Juanma Barranquero wrote:
> On Jan 27, 2008 2:17 PM, Richard G Riley <rileyrgdev@gmail.com> wrote:
> 
>> Personally I must admit to being surprised that emacsclient doesn't
>> invoke emacs if there is not an existing emacs running - that one
>> ommission makes it tricky to set up emacsclient as default viewer/editor
>> in many cases.
> 
> Of course you can run emacsclient so it will start Emacs if it is not
> running; that's what the --alternate-editor option is for. The trick,
> of course, is that --alternate-editor doesn't run Emacs as a server
> connected to the emacsclient instance that started it. That does not
> preclude using it as default viewer/editor in all cases, just the ones
> where it is automatically run from a tool that expects it to be done
> when emacsclient returns (for example, in many VCS when emacsclient is
> used as the editor for the commit logs).
> 
>> I've read reasonings as to why it doesn't launch emacs if
>> not already done, but, well, it just seems quite wrong
> 
> I haven't read (in the emacs-devel list) reasonings as to why it
> *shouldn't* do it, just as to why it is not yet implemented.


Juanma, it might be time to start looking at it again, or? As you know I 
have code for this. I have tried to break the 
"start-emacs-automatically" part from the gui part now.

I would be glad to get your help to get this into Emacs. Even if another 
implementation for it is choosen later that will not be very hard to 
change (if we structure the code so that it can easily be changed 
later). What do you say, Juanma?

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

* Re: Starting emacs in ediff mode.
  2008-01-27 15:13                   ` Lennart Borgman (gmail)
@ 2008-01-27 22:25                     ` Juanma Barranquero
  0 siblings, 0 replies; 27+ messages in thread
From: Juanma Barranquero @ 2008-01-27 22:25 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: Gnu Emacs Mailing List

On Jan 27, 2008 4:13 PM, Lennart Borgman (gmail)
<lennart.borgman@gmail.com> wrote:

> I would be glad to get your help to get this into Emacs. Even if another
> implementation for it is choosen later that will not be very hard to
> change (if we structure the code so that it can easily be changed
> later). What do you say, Juanma?

Send me the patch. But please, try to make it as simple as possible.

             Juanma

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

* Re: Starting emacs in ediff mode.
       [not found]                 ` <mailman.6605.1201445728.18990.help-gnu-emacs@gnu.org>
@ 2008-01-28 11:32                   ` Richard G Riley
  0 siblings, 0 replies; 27+ messages in thread
From: Richard G Riley @ 2008-01-28 11:32 UTC (permalink / raw)
  To: help-gnu-emacs

"Juanma Barranquero" <lekktu@gmail.com> writes:

> On Jan 27, 2008 2:17 PM, Richard G Riley <rileyrgdev@gmail.com> wrote:
>
>> Personally I must admit to being surprised that emacsclient doesn't
>> invoke emacs if there is not an existing emacs running - that one
>> ommission makes it tricky to set up emacsclient as default viewer/editor
>> in many cases.
>
> Of course you can run emacsclient so it will start Emacs if it is not
> running; that's what the --alternate-editor option is for. The trick,
> of course, is that --alternate-editor doesn't run Emacs as a server
> connected to the emacsclient instance that started it. 

Thanks for mentioning that. Staring right there at me - I had completely
missed that option. Suddenly all my defaults work a lot better :-;

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

* Re: Starting emacs in ediff mode.
  2008-01-27 14:55                 ` Juanma Barranquero
  2008-01-27 15:13                   ` Lennart Borgman (gmail)
@ 2008-01-28 16:00                   ` reader
  2008-01-28 16:36                     ` Thierry Volpiatto
  1 sibling, 1 reply; 27+ messages in thread
From: reader @ 2008-01-28 16:00 UTC (permalink / raw)
  To: help-gnu-emacs

"Juanma Barranquero" <lekktu@gmail.com> writes:

> Of course you can run emacsclient so it will start Emacs if it is not
> running; that's what the --alternate-editor option is for. The trick,
> of course, is that --alternate-editor doesn't run Emacs as a server
> connected to the emacsclient instance that started it. That does not
> preclude using it as default viewer/editor in all cases, just the ones
> where it is automatically run from a tool that expects it to be done
> when emacsclient returns (for example, in many VCS when emacsclient is
> used as the editor for the commit logs).

Sorry to butt in here... I'm a (lightweight) user of emacs considering
starting to use emacsclient.

What does your comment mean practically (aside from VCS usage).

My usage is pretty basic.  Scripting, gnus, file and directory
manipulation,  bbdb, tramp.... probably a few other things I forgot.

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

* Re: Starting emacs in ediff mode.
  2008-01-28 16:00                   ` reader
@ 2008-01-28 16:36                     ` Thierry Volpiatto
  2008-01-28 16:43                       ` Juanma Barranquero
  0 siblings, 1 reply; 27+ messages in thread
From: Thierry Volpiatto @ 2008-01-28 16:36 UTC (permalink / raw)
  To: reader; +Cc: help-gnu-emacs

reader@newsguy.com writes:

> "Juanma Barranquero" <lekktu@gmail.com> writes:
>
>> Of course you can run emacsclient so it will start Emacs if it is not
>> running; that's what the --alternate-editor option is for. The trick,
>> of course, is that --alternate-editor doesn't run Emacs as a server
>> connected to the emacsclient instance that started it. That does not
>> preclude using it as default viewer/editor in all cases, just the ones
>> where it is automatically run from a tool that expects it to be done
>> when emacsclient returns (for example, in many VCS when emacsclient is
>> used as the editor for the commit logs).
>
> Sorry to butt in here... I'm a (lightweight) user of emacs considering
> starting to use emacsclient.
>
> What does your comment mean practically (aside from VCS usage).
>
> My usage is pretty basic.  Scripting, gnus, file and directory
> manipulation,  bbdb, tramp.... probably a few other things I forgot.

Actually:
when you use emacsclient, this one use a running emacs session.
if there is no emacs session it fail, except if you use the -a option
(alternate editor)
you can use a script to do that:(you can assign your script to $EDITOR)

emacsclient -a emacs "$@"

Look on emacswiki for more sophisticated scripts.

What they want to do (i think):
when you start emacsclient, if no emacs session is found, start an emacs
session with the server corresponding to the emacsclient you have
already started (ouf!).
It should be great. :)

-- 
A + Thierry
Pub key: http://pgp.mit.edu

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

* Re: Starting emacs in ediff mode.
  2008-01-28 16:36                     ` Thierry Volpiatto
@ 2008-01-28 16:43                       ` Juanma Barranquero
  0 siblings, 0 replies; 27+ messages in thread
From: Juanma Barranquero @ 2008-01-28 16:43 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: help-gnu-emacs, reader

On Jan 28, 2008 5:36 PM, Thierry Volpiatto <thierry.volpiatto@gmail.com> wrote:
> reader@newsguy.com writes:

> What they want to do (i think):
> when you start emacsclient, if no emacs session is found, start an emacs
> session with the server corresponding to the emacsclient you have
> already started (ouf!).

That's it.

What the stock Emacs' emacsclient does today:

 - Try to connect with the Emacs server.
 - If it can connect, great, that's all folks.
 - If it cannot, and there's an alternate editor, start that editor
(it could be Emacs), passing it the file arguments, etc.
 - Otherwise fail.

What would be nice (and Lennart's EmacsW32 emacsclient more or less
does, I think):

 - Try to connect with the Emacs server
 - If it can connect, great, that's all folks
 - If it cannot, start Emacs and wait until Emacs starts the server
 - Retry connecting with Emacs
 - If it can connect, great.
 - If not, start an alternate editor if defined (passing the file args, etc.)
 - Otherwise fail

The difference is that, in the first case, emacsclient starts the
alternate Emacs and then finishes. It does not maintain a connection
with Emacs or waits until the user signals (from inside Emacs) that
he's done with the buffer/file. That is not good when the one calling
emacsclient was not the user, but a process that starts emacsclient to
get a user-edited file (for example, a commit log) and considers that
emacsclient finishing means that the user-edited file is ready to be
used.

             Juanma

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

end of thread, other threads:[~2008-01-28 16:43 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-24  0:51 Starting emacs in ediff mode DaLoverhino
2008-01-24  2:42 ` Kevin Rodgers
2008-01-24 16:50   ` Lennart Borgman (gmail)
2008-01-25  9:45     ` Eli Zaretskii
2008-01-25 14:55       ` Lennart Borgman (gmail)
2008-01-25 16:48         ` Eli Zaretskii
2008-01-25 17:03           ` Juanma Barranquero
2008-01-26  8:44             ` Eli Zaretskii
2008-01-26 13:46               ` Juanma Barranquero
2008-01-26 14:21                 ` Lennart Borgman (gmail)
     [not found]                 ` <mailman.6567.1201357297.18990.help-gnu-emacs@gnu.org>
2008-01-26 19:50                   ` Stefan Monnier
2008-01-26 20:52                     ` Lennart Borgman (gmail)
2008-01-26 21:55                       ` Stefan Monnier
     [not found]             ` <mailman.6561.1201337056.18990.help-gnu-emacs@gnu.org>
2008-01-27 13:17               ` Richard G Riley
2008-01-27 14:55                 ` Juanma Barranquero
2008-01-27 15:13                   ` Lennart Borgman (gmail)
2008-01-27 22:25                     ` Juanma Barranquero
2008-01-28 16:00                   ` reader
2008-01-28 16:36                     ` Thierry Volpiatto
2008-01-28 16:43                       ` Juanma Barranquero
     [not found]                 ` <mailman.6605.1201445728.18990.help-gnu-emacs@gnu.org>
2008-01-28 11:32                   ` Richard G Riley
     [not found]         ` <mailman.6531.1201279722.18990.help-gnu-emacs@gnu.org>
2008-01-25 20:58           ` DaLoverhino
2008-01-26  7:08             ` Thierry Volpiatto
     [not found] ` <mailman.6460.1201142559.18990.help-gnu-emacs@gnu.org>
2008-01-24 16:40   ` DaLoverhino
2008-01-24 18:03     ` Thien-Thi Nguyen
2008-01-24 18:50     ` Rob Wolfe
2008-01-25 20:51       ` DaLoverhino

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.