From: Perry Smith <pedzsan@gmail.com>
To: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
Cc: help-gnu-emacs@gnu.org
Subject: Re: how to map sh-mode to mean bash-mode
Date: Sun, 17 Jul 2011 09:25:22 -0500 [thread overview]
Message-ID: <812736AF-2EAB-4612-8371-70B47FAC1F7B@gmail.com> (raw)
In-Reply-To: <4E22AADE.1090701@easy-emacs.de>
On Jul 17, 2011, at 4:26 AM, Andreas Röhler wrote:
> Am 16.07.2011 01:58, schrieb jidanni@jidanni.org:
>> $ touch a.sh a.bash
>> $ emacs -nw -Q a.bash a.sh
>> See they are in different modeline modes?
>> How can I make them both bash mode?
>> No matter if it is filename prefix, or #!/bin/sh or whatever.
>> I tried defalias, and it didn't work.
>>
>>
>
> Hi,
>
> AFAIU you want a bash-specific editing environment.
> I'm interested in that question, as delivered some shell-script tools.
> Maybe have a look at
>
> sh-beg-end.el at https://launchpad.net/s-x-emacs-werkstatt/
>
> BTW, what should such bash-mode do, what sh-mode and shell-script-mode do not?
I'm curious on this too but... emacs looks at the #! line as well as the suffix. So if you do:
echo '#!/bin/bash' > f1.sh
echo '#!/bin/bash' > f2.bash
and then edit them, both put you into bash mode. And:
echo '#!/bin/bash' > f3
(no suffix) will put you into bash mode too as well as
echo '#!/usr/bin/env bash' > f4
(more complicated interpretation of the #! line)
Likewise:
echo '#!/usr/bin/env ruby' > f5
will put you into Ruby mode when editing f5.
My curiosity is where is all this magic done so I could tweak it if I needed to? I know about file-mode-alist but that is just the suffix mapping part. What is interpreting the #! of a file?
Thanks,
pedz
next prev parent reply other threads:[~2011-07-17 14:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-15 23:58 how to map sh-mode to mean bash-mode jidanni
2011-07-17 9:26 ` Andreas Röhler
2011-07-17 14:25 ` Perry Smith [this message]
2011-07-17 17:30 ` Andreas Röhler
2011-07-17 17:48 ` Andreas Röhler
2011-07-17 20:42 ` bug#9110: " jidanni
2011-07-18 5:52 ` Andreas Röhler
2011-07-18 8:19 ` Peter Dyballa
2011-07-18 8:31 ` Andreas Röhler
2011-07-18 8:40 ` Peter Dyballa
2011-07-26 5:43 ` Kevin Rodgers
[not found] <jwvpqla4326.fsf-monnier+gnu.emacs.help@gnu.org>
2011-07-18 4:51 ` jidanni
2011-07-19 23:25 ` jidanni
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=812736AF-2EAB-4612-8371-70B47FAC1F7B@gmail.com \
--to=pedzsan@gmail.com \
--cc=andreas.roehler@easy-emacs.de \
--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).