* bug#9110: how to map sh-mode to mean bash-mode
2011-07-17 20:42 ` bug#9110: how to map sh-mode to mean bash-mode jidanni
@ 2011-07-17 23:02 ` Glenn Morris
2011-07-17 23:53 ` bug#9110: closed (Re: bug#9110: how to map sh-mode to mean bash-mode) jidanni
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Glenn Morris @ 2011-07-17 23:02 UTC (permalink / raw)
To: 9110-done
jidanni@jidanni.org wrote:
> As you know, the bash shell likes to call itself sh sometimes.
> But it is really still bash.
No, it isn't.
> Hence I would like to make my emacs assume anything it thinks is sh is
> really bash, and thus show me "bash" in the mode line, not "sh", no
> matter how smart it thinks it is.
(add-hook 'sh-mode-hook
'(lambda () (and buffer-file-name
(string-match "\\.sh\\'" buffer-file-name)
(sh-set-shell "bash"))))
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#9110: closed (Re: bug#9110: how to map sh-mode to mean bash-mode)
2011-07-17 20:42 ` bug#9110: how to map sh-mode to mean bash-mode jidanni
2011-07-17 23:02 ` Glenn Morris
@ 2011-07-17 23:53 ` jidanni
2011-07-18 15:42 ` Stefan Monnier
2011-07-18 4:51 ` bug#9110: how to map sh-mode to mean bash-mode jidanni
` (2 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: jidanni @ 2011-07-17 23:53 UTC (permalink / raw)
To: 9110
>>>>> "GbTS" == GNU bug Tracking System <help-debbugs@gnu.org> writes:
GbTS> (add-hook 'sh-mode-hook
GbTS> '(lambda () (and buffer-file-name
GbTS> (string-match "\\.sh\\'" buffer-file-name)
GbTS> (sh-set-shell "bash"))))
Thanks, but that doesn't also cover the case when there is a #!/bin/sh
but no .sh or .bash.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#9110: how to map sh-mode to mean bash-mode
2011-07-17 20:42 ` bug#9110: how to map sh-mode to mean bash-mode jidanni
2011-07-17 23:02 ` Glenn Morris
2011-07-17 23:53 ` bug#9110: closed (Re: bug#9110: how to map sh-mode to mean bash-mode) jidanni
@ 2011-07-18 4:51 ` jidanni
2011-07-18 5:52 ` Andreas Röhler
2011-07-19 23:25 ` bug#9110: " jidanni
4 siblings, 0 replies; 7+ messages in thread
From: jidanni @ 2011-07-18 4:51 UTC (permalink / raw)
To: monnier; +Cc: help-gnu-emacs, 9110
>>>>> "SM" == Stefan Monnier <monnier@iro.umontreal.ca> writes:
SM> Check C-h m to see how to control them.
Got it!
(add-to-list 'sh-alias-alist '(sh . bash))
Thanks!
I declare this thread closed.
Bye.
See ya.
Adios.
Hasta la pasta.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: how to map sh-mode to mean bash-mode
2011-07-17 20:42 ` bug#9110: how to map sh-mode to mean bash-mode jidanni
` (2 preceding siblings ...)
2011-07-18 4:51 ` bug#9110: how to map sh-mode to mean bash-mode jidanni
@ 2011-07-18 5:52 ` Andreas Röhler
2011-07-19 23:25 ` bug#9110: " jidanni
4 siblings, 0 replies; 7+ messages in thread
From: Andreas Röhler @ 2011-07-18 5:52 UTC (permalink / raw)
To: jidanni; +Cc: help-gnu-emacs, bug-gnu-emacs
Am 17.07.2011 22:42, schrieb jidanni@jidanni.org:
> Dear bug-gnu-emacs,
> There is no way to map sh-mode to bash-mode.
Again: AFAIK there no such thing like `bash-mode' in Emacs.
There is a `sh-mode' dealing with several kind of shells.
If `sh-mode' thinks you are dealing with a bash -- by shebang or
suffix-- it provides for it. An alias is called `shell-script-mode'
See C-h f shell-script-mode RET
for what it does.
> As you know, the bash shell likes to call itself sh sometimes.
Didn't know that. Curious to read an example.
> But it is really still bash.
Well, bash might use a sh as a subset. Don't know that architecture.
> Hence I would like to make my emacs assume anything it thinks is sh is
> really bash, and thus show me "bash" in the mode line, not "sh", no
> matter how smart it thinks it is.
Could you deliver an example of usage for that?
If you send code written for a bash to a simple sh - some may work,
others will fail.
You are surely implementing bugs then.
See also
> http://lists.gnu.org/archive/html/help-gnu-emacs/2011-07/msg00143.html
> However the real solution should be a one liner of lisp in ones .emacs.
>
What's great about a one-liner? Usually they are hard to read.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#9110: how to map sh-mode to mean bash-mode
2011-07-17 20:42 ` bug#9110: how to map sh-mode to mean bash-mode jidanni
` (3 preceding siblings ...)
2011-07-18 5:52 ` Andreas Röhler
@ 2011-07-19 23:25 ` jidanni
4 siblings, 0 replies; 7+ messages in thread
From: jidanni @ 2011-07-19 23:25 UTC (permalink / raw)
To: monnier; +Cc: help-gnu-emacs, 9110
OK, I perfected it:
(eval-after-load "sh-script" '(add-to-list 'sh-alias-alist '(sh . bash)))
^ permalink raw reply [flat|nested] 7+ messages in thread