[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to open a file in sh-mode

From: Giorgos Keramidas
Subject: Re: How to open a file in sh-mode
Date: Thu, 14 Aug 2008 17:23:04 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix)

On Thu, 14 Aug 2008 15:48:57 +0200, Francis Moreau wrote:
> On Thu, Aug 14, 2008 at 3:27 PM, Giorgos Keramidas wrote:
>> On Thu, 14 Aug 2008 15:01:02 +0200, Francis Moreau wrote:
>>> <emacs is started but I get an error in the Messages window>
>>> ("emacs" "--eval" "\"(setq-default" "default-major-mode" "'sh-mode)\""
>>> "/tmp/bash-fc-247955888988243")
>> See how the command-line arguments have been split in multiple places by
>> the shell that evaluated $FCEDIT?
> hmm not really.
> Could you tell me what's wrong here ? IOW how emacs have been launched?

It has been launched with the following command-line arguments:

    arg[0] = "emacs"
    arg[1] = "--eval"
    arg[2] = "\"(setq-default"
    arg[3] = "default-major-mode"
    arg[4] = "'sh-mode)\""
    arg[5] = "/tmp/bash-fc-247955888988243"

The shell that launched $FCEDIT as an editor, looked at its value, saw
that it had space characters in it, and split the $FCEDIT value to
several separate arguments at every unquoted space.

Try firing up Emacs with the following two commands, and look at the
*Messages* buffer to spot the difference:

    emacs -nw "foo" "bar"

    emacs -nw "foo bar"

The first should display:

    ("emacs" "-nw" "foo" "bar")

but the second should display:

    ("emacs" "-nw" "foo bar")

It may be possible to quote FCEDIT's value in some complex manner to
achieve the effect of second list, where the s-exp passed to --eval is a
single entry in the command-line argument list.  Is it worth all the
trouble to get it `right'?  My own personal preference at this point is
to say `No, not really.  I can write a shell wrapper, and be done with
it in half a minute or so' :-)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]