From: Henrik Austad <henrikau@stud.ntnu.no>
To: help-gnu-emacs@gnu.org
Subject: Re: How to open a file in sh-mode
Date: Thu, 14 Aug 2008 12:03:17 +0200 [thread overview]
Message-ID: <200808141203.22315.henrikau@stud.ntnu.no> (raw)
In-Reply-To: <38b2ab8a0808140203s53c339f3k70d5887d42a4de2f@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1844 bytes --]
On Thursday 14 August 2008 11:03:07 Francis Moreau wrote:
> On Thu, Aug 14, 2008 at 10:16 AM, Henrik Austad <henrikau@stud.ntnu.no>
wrote:
> > On Thursday 14 August 2008 09:53:39 Francis Moreau wrote:
> >> Hello,
> >>
> >> I'm trying to open a file with emacs automatically set on sh-mode.
> >> The file name can't be used to guess that emacs should be in sh-mode
> >> when opening it.
> >>
> >> So I tried:
> >>
> >> $ emacs -f sh-mode foo
> >>
> >> But that doesn't work.
> >>
> >> Could anybody give me some advices ?
> >
> > 1) which version of emacs are you using?
> > 2) is it a valid-sh file? i.e. does it start with #!/bin/bash on the
> > first line?
>
> No, it's actually the file created by fc(1) to edit the bash history.
>
> It uses the FCEDIT env variable to launch the editor it going to use.
>
> So I'd like to set it to:
>
> export FCEDIT="emacs -f sh-mode"
>
> so that fc(1) uses emacs as editor in sh-mode directly.
>
> Note that the name of the temporary file is *appended* to what you
> specified in FCEDIT.
so, basically you are looking for a way of putting #!/bin/bash before the
output of fc is included?
I don't see any obvious ways of doing this, but, you could, if you wanted to,
use .bash_history (or the appropriate history-file for your shell) and grep
for what you want there?
When you set emacs to be the editor, remember that you call emacs with a new
file as argument, i.e. if you specify foo as a file, emacs will open *both*
foo and the new file from fc.
You could, perhaps, add a hook in .emacs as all files created by fc starts
with [shell]-fc-<numbers>
so basically, I think the question boils down to:
"""
How do I create a hook in my .emacs so that all files starting with bash-fc-*
will load sh-mode?
"""
--
mvh Henrik Austad
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2008-08-14 10:03 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 [this message]
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
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200808141203.22315.henrikau@stud.ntnu.no \
--to=henrikau@stud.ntnu.no \
--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.
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.