From: Giorgos Keramidas <keramida@ceid.upatras.gr>
To: "Francis Moreau" <francis.moro@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: How to open a file in sh-mode
Date: Thu, 14 Aug 2008 16:27:24 +0300 [thread overview]
Message-ID: <87myjfvi9v.fsf@kobe.laptop> (raw)
In-Reply-To: <38b2ab8a0808140601p3f524769oe0fdb80c6db60bb@mail.gmail.com> (Francis Moreau's message of "Thu, 14 Aug 2008 15:01:02 +0200")
On Thu, 14 Aug 2008 15:01:02 +0200, "Francis Moreau" <francis.moro@gmail.com> wrote:
> On Thu, Aug 14, 2008 at 2:24 PM, Giorgos Keramidas
> <keramida@ceid.upatras.gr> wrote:
>>
>> You can probably write a short wrapper script that is used as $FCEDIT to
>> run the equivalent of:
>>
>> emacs --eval "(setq-default default-major-mode 'sh-mode)" file1 file2 ...
>>
>
> Hmm I don't why I need a wrapper script in that case, do you have an idea ?
>
> If I try without the wrapper I get:
>
> $ export FCEDIT="emacs -nw --eval \"(setq-default default-major-mode
> 'sh-mode)\""
> $ fc
>
> <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?
That's why I suggested a wrapper script. To avoid all the obnoxiously
stupid things expansion of $FCEDIT would do, and make sure that there is
only *one* level of quoting you would have to use.
The parenthesized list quoted above shows that Emacs tried to --eval the
expression "\"(setq-default", which isn't a complete Lisp s-exp (and
this is what Emacs is trying to say with the error message).
Using a shell wrapper makes expansion of the --eval argument much more
predictable here, so I tend to prefer that:
$ cat > /tmp/fcedit.sh
#!/bin/sh
emacs --eval "(setq-default default-major-mode 'sh-mode)" "$@"
^D
$ chmod 0755 /tmp/fcedit.sh
$ export FCEDIT='/tmp/fcedit.sh -nw'
$ fc
I have a few of these wrappers in my `~/bin' directory, to help me fire
up Emacs with a variety of options, i.e.:
~/bin/emacs-no-gui
This runs `emacs -nw "$@"'.
~/bin/utf-emacs
This sets up LANG, and LC_ALL, clears every other LC_XXX locale
variable, and then fires up Emacs in `utf-8 mode'.
and so on.
I really hate having to fight with backslashes to get everything right
in tons of nested quotes, quoted quotes and quoted-quoted quotes ad
infinitum, so that's why I like throwing a wrapper here and there :)
next prev parent reply other threads:[~2008-08-14 13:27 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-14 7:53 How to open a file in sh-mode Francis Moreau
2008-08-14 8:16 ` Henrik Austad
2008-08-14 9:03 ` Francis Moreau
2008-08-14 10:03 ` Henrik Austad
2008-08-14 10:06 ` Francis Moreau
2008-08-14 11:17 ` David Hansen
2008-08-14 11:36 ` Henrik Austad
2008-08-14 11:51 ` Francis Moreau
2008-08-14 11:57 ` Lennart Borgman (gmail)
[not found] ` <mailman.16667.1218708430.18990.help-gnu-emacs@gnu.org>
2008-08-14 12:24 ` Giorgos Keramidas
2008-08-14 13:01 ` Francis Moreau
2008-08-14 13:27 ` Giorgos Keramidas [this message]
2008-08-14 13:48 ` Francis Moreau
2008-08-14 14:23 ` Giorgos Keramidas
2008-08-14 8:26 ` David Hansen
2008-08-14 9:04 ` Francis Moreau
2008-08-14 9:23 ` Thierry Volpiatto
2008-08-14 9:34 ` Francis Moreau
2008-08-14 10:58 ` Peter Dyballa
2008-08-14 11:02 ` Francis Moreau
2008-08-14 11:20 ` Lennart Borgman (gmail)
2008-08-14 11:36 ` Francis Moreau
2008-08-14 11:46 ` Lennart Borgman (gmail)
2008-08-14 12:06 ` Peter Dyballa
2008-08-14 12:22 ` Francis Moreau
[not found] <mailman.16658.1218700648.18990.help-gnu-emacs@gnu.org>
2008-08-14 8:28 ` Sebastian Kaps
2008-08-14 10:29 ` Xah
2008-09-11 1:35 ` David Combs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87myjfvi9v.fsf@kobe.laptop \
--to=keramida@ceid.upatras.gr \
--cc=francis.moro@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).