unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#9110: how to map sh-mode to mean bash-mode
       [not found] <4E232057.1040409@easy-emacs.de>
@ 2011-07-17 20:42 ` jidanni
  2011-07-17 23:02   ` Glenn Morris
                     ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: jidanni @ 2011-07-17 20:42 UTC (permalink / raw)
  To: 9110; +Cc: help-gnu-emacs, pedzsan

Dear bug-gnu-emacs,
There is no way to map sh-mode to bash-mode.
As you know, the bash shell likes to call itself sh sometimes.
But it is really still bash.
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. 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.





^ 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
                     ` (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: closed (Re: bug#9110: how to map sh-mode to mean bash-mode)
  2011-07-17 23:53   ` bug#9110: closed (Re: bug#9110: how to map sh-mode to mean bash-mode) jidanni
@ 2011-07-18 15:42     ` Stefan Monnier
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2011-07-18 15:42 UTC (permalink / raw)
  To: jidanni; +Cc: 9110

> Thanks, but that doesn't also cover the case when there is a #!/bin/sh
> but no .sh or .bash.

If it says #!/bin/sh then it really shouldn't use bashisms.
Use #!/bin/bash for that.


        Stefan





^ 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

end of thread, other threads:[~2011-07-19 23:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <4E232057.1040409@easy-emacs.de>
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 15:42     ` Stefan Monnier
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

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).