Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Starting emacs in ediff mode.

339 views
Skip to first unread message

DaLoverhino

unread,
Jan 23, 2008, 7:51:16 PM1/23/08
to
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.

Kevin Rodgers

unread,
Jan 23, 2008, 9:42:31 PM1/23/08
to help-gn...@gnu.org

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

--
Kevin Rodgers
Denver, Colorado, USA

DaLoverhino

unread,
Jan 24, 2008, 11:40:48 AM1/24/08
to

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

Lennart Borgman (gmail)

unread,
Jan 24, 2008, 11:50:05 AM1/24/08
to help-gn...@gnu.org
Kevin Rodgers wrote:
> 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%\")"


Thien-Thi Nguyen

unread,
Jan 24, 2008, 1:03:05 PM1/24/08
to gnu-ema...@gnu.org
() DaLoverhino <DaLov...@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


Rob Wolfe

unread,
Jan 24, 2008, 1:50:02 PM1/24/08
to
DaLoverhino <DaLov...@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

Rob Wolfe

unread,
Jan 24, 2008, 2:20:52 PM1/24/08
to
we are awake, is not another sleep a little
different from the former, from which we awake when we suppose ourselves
asleep?

And who doubts that, if we dreamt in company, and the dreams chanced to
agree, which is common enough, and if we were always alone when awake, we
should believe that matters were reversed? In short, as we often dream that
we dream, heaping dream upon dream, may it not be that this half of our
life, wherein we think ourselves awake, is itself only a dream on which the
others are grafted, from which we wake at death, during which we have as few
principles of truth and good as during natural sleep, these different
thoughts which disturb us being perhaps only illusions like the flight of
time and the vain fancies of our dreams?

These are the chief arguments on one side and the other.

I omit minor ones, such as the sceptical talk against the impressions of
custom, education, manners, country and the like. Though these influence the
majority of common folk, who dogmatise only on shallow foundations, they are
upset by t


Lennart Borgman (gmail)

unread,
Jan 24, 2008, 5:06:44 PM1/24/08
to
way in me."

193Luke 22:66. "Art thou the Christ? tell us."

194John 5:36. "The works which the father hath given me to finish... bear
witness of me." John 10:26-27. "But ye believe not, because ye are not of my
sheep... My sheep hear my voice.

[195]"What sign shewest thou then, that we may see, and believe thee. (They
do not say: What doctrine do you preach?)"

196John 3:2. "No man can do these miracles that thou doest, except God be
with him."

[197]"The Lord, making manifest his presence, upholdeth them that are his
own portion."

198"And others, tempting him, sought of him a sign from heaven."

199Matt. 12:39. "An evil generation seeketh after a sign; and there shall no
sign be given to it."

200"And he sighed deeply in his spirit, and saith, why doth this generation
seek after a sign?"

201"Mark 6:5. "And he could there do no mighty work."

202John 4:48. "Except ye see... ye will not believe."

2039. "In signs and lying wonders."

204II Thess. 2:9-11 "After the working of Satan... and with all
deceivableness of unrighteousness in them that perish, because they received
not the love of the truth, that they might be saved. And for this cause God
shall send them strong delusion, that they should believe a lie."

205Deut. 13:3. "for the Lord your God proveth you, to know whether ye love
the Lord."

206Matt. 24:25-26. "Behold, I have told you b


DaLoverhino

unread,
Jan 24, 2008, 4:26:27 PM1/24/08
to
turns him from God, and not God; and that he has no other good than
God, and not a rich land. Let those who believe that the good of man is in
the flesh, and evil in what turns him away from sensual pleasures, satiate
themselves with them, and die in them. But let those who seek God with all
their heart, who are only troubled at not seeing Him, who desire only to
possess Him and have as enemies only those who turn them away from Him, who
are grieved at seeing themselves surrounded and overwhelmed with such
enemies, take comfort. I proclaim to them happy news. There exists a
Redeemer for them. I shall show Him to them. I shall show that there is a
God for them. I shall not show Him to others. I shall make them see that a
Messiah has been promised, who should deliver them from their enemies, and
that One has come to free them from their iniquities, but not from their
enemies.

When David foretold that the Messiah would deliver His people from their
enemies, one can believe that in the flesh these would be the Egyptians; and
then I


Kevin Rodgers

unread,
Jan 24, 2008, 3:51:57 PM1/24/08
to
but the desire to establish themselves in the esteem of men, and
if their whole perfection consists only in making men--but without
constraint--find their happiness in loving them, I declare that this
perfection is horrible. What! they have known God and have not desired
solely that men should love Him, but that men should stop short at them!
They have wanted to be the object of the voluntary delight of men.

464. Philosophers.--We are full of things which take us out of ourselves.

Our instinct makes us feel that we must seek our happiness outside
ourselves. Our passions impel us outside, even when no objects present
themselves to excite them. External objects tempt us of themselves, and call
to us, even when we are not thinking of them. And thus philosophers have
said in vain: "Retire within yourselves, you will find your good there." We
do not believe them, and those who believe them are the most empty and the
most foolish.

465. The Stoics say, "Retire within yourselves; it is there you will find
your rest."

And that is not true.

Others say, "Go out of yourselves; seek happiness


DaLoverhino

unread,
Jan 24, 2008, 2:27:35 PM1/24/08
to
400. The greatness of man.--We have so great an idea of the soul of man that
we cannot endure being despised, or not being esteemed by any soul; and all
the happiness of men consists in this esteem.

401. Glory.--The brutes do not admire each other. A horse does not admire
his companion. Not that there is no rivalry between them in a race, but that
is of no consequence; for, when in the stable, the heaviest and most
ill-formed does not give up his oats to another, as men would have others do
to them. Their virtue is satisfied with itself.

402. The greatness of man even in his lust, to have known how to extract
from it a wonderful code, and to have drawn from it a picture of
benevolence.

403. Greatness.--The reasons of effects indicate the greatness of man, in
having extracted so fair an order from lust.

404. The greatest baseness of man is the pursuit of glory. But is the
greatest mark of his excellence; for whatever possessions he may have on
earth, whatever health and essential comfort, he is not satisfied if he has
not the esteem of men. He values human reason so highly that, whatever
advantages he may have on earth, he is not content if he is not also ranked
highly in the judgement of man. This is the finest position in the world.
Nothing can turn him from that desire, which is the most indelible quality
of man's heart.

And those who must despise men, and put them on a level with the brutes, yet
wish to be admired and believed by men, and contradict themselves by their
own feelings; th


Eli Zaretskii

unread,
Jan 25, 2008, 4:45:42 AM1/25/08
to help-gn...@gnu.org
> Date: Thu, 24 Jan 2008 17:50:05 +0100
> From: "Lennart Borgman (gmail)" <lennart...@gmail.com>
> CC: help-gn...@gnu.org

>
> Kevin Rodgers wrote:
> > DaLoverhino wrote:
> > 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?


Lennart Borgman (gmail)

unread,
Jan 25, 2008, 9:55:20 AM1/25/08
to Eli Zaretskii, help-gn...@gnu.org
Eli Zaretskii wrote:
>> Date: Thu, 24 Jan 2008 17:50:05 +0100
>> From: "Lennart Borgman (gmail)" <lennart...@gmail.com>
>> CC: help-gn...@gnu.org
>>
>> Kevin Rodgers wrote:
>>> DaLoverhino wrote:
>>> 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 ;-)


Eli Zaretskii

unread,
Jan 25, 2008, 11:48:38 AM1/25/08
to help-gn...@gnu.org
> Date: Fri, 25 Jan 2008 15:55:20 +0100

> From: "Lennart Borgman (gmail)" <lennart...@gmail.com>
> CC: help-gn...@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?


Juanma Barranquero

unread,
Jan 25, 2008, 12:03:30 PM1/25/08
to Eli Zaretskii, help-gn...@gnu.org
On Jan 25, 2008 5:48 PM, Eli Zaretskii <el...@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


DaLoverhino

unread,
Jan 25, 2008, 3:51:34 PM1/25/08
to
On Jan 24, 1:50 pm, Rob Wolfe <r...@smsnet.pl> wrote:

That did work. Thanks!!

And thanks everyone for helping me out.

DaLoverhino

unread,
Jan 25, 2008, 3:58:02 PM1/25/08
to
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.

Thierry Volpiatto

unread,
Jan 26, 2008, 2:08:09 AM1/26/08
to DaLoverhino, help-gn...@gnu.org
DaLoverhino <DaLov...@hotmail.com> writes:

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


Eli Zaretskii

unread,
Jan 26, 2008, 3:44:17 AM1/26/08
to help-gn...@gnu.org
> Date: Fri, 25 Jan 2008 18:03:30 +0100
> From: "Juanma Barranquero" <lek...@gmail.com>
> Cc: help-gn...@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?


Juanma Barranquero

unread,
Jan 26, 2008, 8:46:15 AM1/26/08
to Eli Zaretskii, help-gn...@gnu.org
On Jan 26, 2008 9:44 AM, Eli Zaretskii <el...@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


Lennart Borgman (gmail)

unread,
Jan 26, 2008, 9:21:17 AM1/26/08
to Juanma Barranquero, help-gn...@gnu.org
Juanma Barranquero wrote:
> On Jan 26, 2008 9:44 AM, Eli Zaretskii <el...@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.

Stefan Monnier

unread,
Jan 26, 2008, 2:50:42 PM1/26/08
to
> 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

Lennart Borgman (gmail)

unread,
Jan 26, 2008, 3:52:01 PM1/26/08
to Stefan Monnier, help-gn...@gnu.org


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


Stefan Monnier

unread,
Jan 26, 2008, 4:55:10 PM1/26/08
to Lennart Borgman (gmail), help-gn...@gnu.org

> 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


Richard G Riley

unread,
Jan 27, 2008, 8:17:12 AM1/27/08
to
Eli Zaretskii <el...@gnu.org> writes:

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.


Juanma Barranquero

unread,
Jan 27, 2008, 9:55:22 AM1/27/08
to Richard G Riley, help-gn...@gnu.org
On Jan 27, 2008 2:17 PM, Richard G Riley <riley...@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


Lennart Borgman (gmail)

unread,
Jan 27, 2008, 10:13:33 AM1/27/08
to Juanma Barranquero, Richard G Riley, help-gn...@gnu.org
Juanma Barranquero wrote:
> On Jan 27, 2008 2:17 PM, Richard G Riley <riley...@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?


Juanma Barranquero

unread,
Jan 27, 2008, 5:25:46 PM1/27/08
to Lennart Borgman (gmail), Gnu Emacs Mailing List
On Jan 27, 2008 4:13 PM, Lennart Borgman (gmail)
<lennart...@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


Richard G Riley

unread,
Jan 28, 2008, 6:32:47 AM1/28/08
to
"Juanma Barranquero" <lek...@gmail.com> writes:

> On Jan 27, 2008 2:17 PM, Richard G Riley <riley...@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 :-;

rea...@newsguy.com

unread,
Jan 28, 2008, 11:00:03 AM1/28/08
to help-gn...@gnu.org
"Juanma Barranquero" <lek...@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.


Thierry Volpiatto

unread,
Jan 28, 2008, 11:36:05 AM1/28/08
to rea...@newsguy.com, help-gn...@gnu.org
rea...@newsguy.com writes:

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

Juanma Barranquero

unread,
Jan 28, 2008, 11:43:33 AM1/28/08
to Thierry Volpiatto, help-gn...@gnu.org, rea...@newsguy.com
On Jan 28, 2008 5:36 PM, Thierry Volpiatto <thierry....@gmail.com> wrote:
> rea...@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


0 new messages