all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Is there an emacs bash script mode / colouring?
@ 2009-09-15 18:57 Eric B.
  2009-09-15 19:06 ` Bruno Barbier
  2009-09-15 19:11 ` Anselm Helbig
  0 siblings, 2 replies; 11+ messages in thread
From: Eric B. @ 2009-09-15 18:57 UTC (permalink / raw
  To: help-gnu-emacs

Hi,

This may sound like a silly question, but is there a major/minor mode for 
emacs that does syntax colouring and auto-formatting of bash scripts?

I've tried searching the web, but can't seem to find anything applicable.

Thanks!

Eric




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is there an emacs bash script mode / colouring?
  2009-09-15 18:57 Is there an emacs bash script mode / colouring? Eric B.
@ 2009-09-15 19:06 ` Bruno Barbier
  2009-09-15 19:11 ` Anselm Helbig
  1 sibling, 0 replies; 11+ messages in thread
From: Bruno Barbier @ 2009-09-15 19:06 UTC (permalink / raw
  To: help-gnu-emacs

On 2009-09-15, Eric B. <ebenze@hotmail.com> wrote:
> Hi,
>
> This may sound like a silly question, but is there a major/minor mode for 
> emacs that does syntax colouring and auto-formatting of bash scripts?
>
> I've tried searching the web, but can't seem to find anything applicable.
>
> Thanks!
>
> Eric
>
>

shell-script-mode? (part of GNU Emacs)



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is there an emacs bash script mode / colouring?
  2009-09-15 18:57 Is there an emacs bash script mode / colouring? Eric B.
  2009-09-15 19:06 ` Bruno Barbier
@ 2009-09-15 19:11 ` Anselm Helbig
  2009-09-16 15:53   ` Eric B.
  2009-10-12  3:32   ` David Combs
  1 sibling, 2 replies; 11+ messages in thread
From: Anselm Helbig @ 2009-09-15 19:11 UTC (permalink / raw
  To: help-gnu-emacs

Hi!

> This may sound like a silly question, but is there a major/minor mode for 
> emacs that does syntax colouring and auto-formatting of bash scripts?
> 
> I've tried searching the web, but can't seem to find anything applicable.

Well, silly it is. 8-) Bash is supported by sh-mode, which should
already be active when you're using the .sh extension for your
file. If you don't use an extension, it will be activated after a
revert-buffer. 

What version of emacs are you using or what else are you doing that
sh-mode isn't active yet?

HTH, 

Anselm


-- 
Anselm Helbig 
mailto:anselm.helbig+news2009@googlemail.com


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is there an emacs bash script mode / colouring?
  2009-09-15 19:11 ` Anselm Helbig
@ 2009-09-16 15:53   ` Eric B.
  2009-09-16 16:23     ` Colin S. Miller
  2009-09-16 17:28     ` Peter Dyballa
  2009-10-12  3:32   ` David Combs
  1 sibling, 2 replies; 11+ messages in thread
From: Eric B. @ 2009-09-16 15:53 UTC (permalink / raw
  To: help-gnu-emacs

"Anselm Helbig" <anselm.helbig+news2009@googlemail.com> wrote in message 
news:87ab0wc9ac.wl%anselm.helbig+news2009@googlemail.com...
> Hi!
>
>> This may sound like a silly question, but is there a major/minor mode for
>> emacs that does syntax colouring and auto-formatting of bash scripts?
>>
>> I've tried searching the web, but can't seem to find anything applicable.
>
> Well, silly it is. 8-) Bash is supported by sh-mode, which should
> already be active when you're using the .sh extension for your
> file. If you don't use an extension, it will be activated after a
> revert-buffer.

Well, yes - sh mode is activated upon opening of any .sh file.  However, for 
some reason, I find it doesn't do any formatting and/or syntax colouring. 
My nxml mode does both, so I know it isn't my terminal that is problematic. 
Is there something in the config that I am missing for sh-mode?

I'm running emacs 21.4.1

Thanks,

Eric




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is there an emacs bash script mode / colouring?
  2009-09-16 15:53   ` Eric B.
@ 2009-09-16 16:23     ` Colin S. Miller
  2009-09-17 18:41       ` Eric B.
  2009-09-16 17:28     ` Peter Dyballa
  1 sibling, 1 reply; 11+ messages in thread
From: Colin S. Miller @ 2009-09-16 16:23 UTC (permalink / raw
  To: help-gnu-emacs

Eric B. wrote:
> "Anselm Helbig" <anselm.helbig+news2009@googlemail.com> wrote in message 
> news:87ab0wc9ac.wl%anselm.helbig+news2009@googlemail.com...
>> Hi!
>>
>>> This may sound like a silly question, but is there a major/minor mode for
>>> emacs that does syntax colouring and auto-formatting of bash scripts?
>>>
>>> I've tried searching the web, but can't seem to find anything applicable.
>> Well, silly it is. 8-) Bash is supported by sh-mode, which should
>> already be active when you're using the .sh extension for your
>> file. If you don't use an extension, it will be activated after a
>> revert-buffer.
> 
> Well, yes - sh mode is activated upon opening of any .sh file.  However, for 
> some reason, I find it doesn't do any formatting and/or syntax colouring. 
> My nxml mode does both, so I know it isn't my terminal that is problematic. 
> Is there something in the config that I am missing for sh-mode?
> 
> I'm running emacs 21.4.1
> 
> Thanks,
> 
> Eric
> 
> 
Eric,

Does
M-x font-lock-mode
or
M-x font-lock-fontify-buffer
help?

The first will turn on fontify (syntax highlighting mode).
Is the mode-line "(Shell-script [bash])" or "(Shell-script Font[bash]") ?

The second will force the buffer to be highlighted; if
the buffer is bigger than font-lock-maximum-size
then auto-fontification is disabled.

HTH,
Colin S. Miller.

-- 
Replace the obvious in my email address with the first three letters of the hostname to reply.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is there an emacs bash script mode / colouring?
  2009-09-16 15:53   ` Eric B.
  2009-09-16 16:23     ` Colin S. Miller
@ 2009-09-16 17:28     ` Peter Dyballa
  1 sibling, 0 replies; 11+ messages in thread
From: Peter Dyballa @ 2009-09-16 17:28 UTC (permalink / raw
  To: Eric B.; +Cc: help-gnu-emacs


Am 16.09.2009 um 17:53 schrieb Eric B.:

> However, for some reason, I find it doesn't do any formatting and/ 
> or syntax colouring.


You might need to switch it on in your init file:

	(global-font-lock-mode 1)

--
Greetings

   Pete

Think of XML as Lisp for COBOL programmers.
				- Tony-A (some guy on /.)







^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is there an emacs bash script mode / colouring?
  2009-09-16 16:23     ` Colin S. Miller
@ 2009-09-17 18:41       ` Eric B.
  2009-09-18 16:19         ` Colin S. Miller
  0 siblings, 1 reply; 11+ messages in thread
From: Eric B. @ 2009-09-17 18:41 UTC (permalink / raw
  To: help-gnu-emacs

"Colin S. Miller" <no-spam-thank-you@csmiller.demon.co.uk> wrote in message 
news:4ab1111e$0$285$14726298@news.sunsite.dk...
> Eric B. wrote:
>> "Anselm Helbig" <anselm.helbig+news2009@googlemail.com> wrote in message 
>> news:87ab0wc9ac.wl%anselm.helbig+news2009@googlemail.com...
>>> Hi!
>>>
>>>> This may sound like a silly question, but is there a major/minor mode 
>>>> for
>>>> emacs that does syntax colouring and auto-formatting of bash scripts?
>>>>
>>>> I've tried searching the web, but can't seem to find anything 
>>>> applicable.
>>> Well, silly it is. 8-) Bash is supported by sh-mode, which should
>>> already be active when you're using the .sh extension for your
>>> file. If you don't use an extension, it will be activated after a
>>> revert-buffer.
>>
>> Well, yes - sh mode is activated upon opening of any .sh file.  However, 
>> for some reason, I find it doesn't do any formatting and/or syntax 
>> colouring. My nxml mode does both, so I know it isn't my terminal that is 
>> problematic. Is there something in the config that I am missing for 
>> sh-mode?
>>
>> I'm running emacs 21.4.1
>>
>> Thanks,
>>
>> Eric
>>
>>
> Eric,
>
> Does
> M-x font-lock-mode
> or
> M-x font-lock-fontify-buffer
> help?

Aha - both seem to work like a charm.  Thanks for the tip.

>
> Is the mode-line "(Shell-script [bash])" or "(Shell-script Font[bash]") ?

My mode-line is Shell-script[bash].  How do I change that to Font[bash]?

Thanks,

Eric




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is there an emacs bash script mode / colouring?
  2009-09-17 18:41       ` Eric B.
@ 2009-09-18 16:19         ` Colin S. Miller
  2009-09-18 20:12           ` despen
  0 siblings, 1 reply; 11+ messages in thread
From: Colin S. Miller @ 2009-09-18 16:19 UTC (permalink / raw
  To: help-gnu-emacs

Eric B. wrote:
> "Colin S. Miller" <no-spam-thank-you@csmiller.demon.co.uk> wrote in message 
> news:4ab1111e$0$285$14726298@news.sunsite.dk...
>> Eric,
>>
>> Does
>> M-x font-lock-mode
>> or
>> M-x font-lock-fontify-buffer
>> help?
> 
> Aha - both seem to work like a charm.  Thanks for the tip.
> 
>> Is the mode-line "(Shell-script [bash])" or "(Shell-script Font[bash]") ?
> 
> My mode-line is Shell-script[bash].  How do I change that to Font[bash]?
> 
> Thanks,
> 
> Eric
> 
> 
Ah.
emacs doesn't indicate if the font-lock minor mode is enabled;
Xemacs does.

Use
M-x font-lock-mode
as this enables fontifcation for all edits (until it is toggle off
by repeating M-x font-lock-mode)

M-x font-lock-fontify-buffer
does a one-off fontification - it is only useful if fontify gets confused,
which is normally caused by editing the start marker of a multi-line
block of text (a comment, string etc).

HTH,
Colin S. Miller

-- 
Replace the obvious in my email address with the first three letters of the hostname to reply.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is there an emacs bash script mode / colouring?
  2009-09-18 16:19         ` Colin S. Miller
@ 2009-09-18 20:12           ` despen
  0 siblings, 0 replies; 11+ messages in thread
From: despen @ 2009-09-18 20:12 UTC (permalink / raw
  To: help-gnu-emacs

"Colin S. Miller" <no-spam-thank-you@csmiller.demon.co.uk> writes:

> Eric B. wrote:
>> "Colin S. Miller" <no-spam-thank-you@csmiller.demon.co.uk> wrote in
>> message news:4ab1111e$0$285$14726298@news.sunsite.dk...
>>> Eric,
>>>
>>> Does
>>> M-x font-lock-mode
>>> or
>>> M-x font-lock-fontify-buffer
>>> help?
>>
>> Aha - both seem to work like a charm.  Thanks for the tip.
>>
>>> Is the mode-line "(Shell-script [bash])" or "(Shell-script Font[bash]") ?
>>
>> My mode-line is Shell-script[bash].  How do I change that to Font[bash]?
>>
>> Thanks,
>>
>> Eric
>>
>>
> Ah.
> emacs doesn't indicate if the font-lock minor mode is enabled;
> Xemacs does.

Yes.  A pain but easily repaired.  I find just an "F" is enough:

(or (assq 'font-lock-mode minor-mode-alist)
    (setq minor-mode-alist
          (cons '(font-lock-mode " F") minor-mode-alist)))


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is there an emacs bash script mode / colouring?
  2009-09-15 19:11 ` Anselm Helbig
  2009-09-16 15:53   ` Eric B.
@ 2009-10-12  3:32   ` David Combs
  2009-10-12 11:53     ` Richard Riley
  1 sibling, 1 reply; 11+ messages in thread
From: David Combs @ 2009-10-12  3:32 UTC (permalink / raw
  To: help-gnu-emacs

In article <87ab0wc9ac.wl%anselm.helbig+news2009@googlemail.com>,
Anselm Helbig  <anselm.helbig+news2009@googlemail.com> wrote:
>Hi!
>
>> This may sound like a silly question, but is there a major/minor mode for 
>> emacs that does syntax colouring and auto-formatting of bash scripts?
>> 
>> I've tried searching the web, but can't seem to find anything applicable.
>
>Well, silly it is. 8-) Bash is supported by sh-mode, which should
>already be active when you're using the .sh extension for your
>file. If you don't use an extension, it will be activated after a
>revert-buffer. 

If there's not an sh-extension on the file, how does the
revert-buffer help?

(Sorry -- the only way I learn anything is by asking
stupid questions like this one.)

David




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Is there an emacs bash script mode / colouring?
  2009-10-12  3:32   ` David Combs
@ 2009-10-12 11:53     ` Richard Riley
  0 siblings, 0 replies; 11+ messages in thread
From: Richard Riley @ 2009-10-12 11:53 UTC (permalink / raw
  To: help-gnu-emacs

dkcombs@panix.com (David Combs) writes:

> In article <87ab0wc9ac.wl%anselm.helbig+news2009@googlemail.com>,
> Anselm Helbig  <anselm.helbig+news2009@googlemail.com> wrote:
>>Hi!
>>
>>> This may sound like a silly question, but is there a major/minor mode for 
>>> emacs that does syntax colouring and auto-formatting of bash scripts?
>>> 
>>> I've tried searching the web, but can't seem to find anything applicable.
>>
>>Well, silly it is. 8-) Bash is supported by sh-mode, which should
>>already be active when you're using the .sh extension for your
>>file. If you don't use an extension, it will be activated after a
>>revert-buffer. 
>
> If there's not an sh-extension on the file, how does the
> revert-buffer help?

Opens in shell mode here when the script properly announces itself e.g

#!/bin/bash

as the first line.

To expect emacs to know otherwise would be a tad optimistic.

>
> (Sorry -- the only way I learn anything is by asking
> stupid questions like this one.)
>
> David
>


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-10-12 11:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-15 18:57 Is there an emacs bash script mode / colouring? Eric B.
2009-09-15 19:06 ` Bruno Barbier
2009-09-15 19:11 ` Anselm Helbig
2009-09-16 15:53   ` Eric B.
2009-09-16 16:23     ` Colin S. Miller
2009-09-17 18:41       ` Eric B.
2009-09-18 16:19         ` Colin S. Miller
2009-09-18 20:12           ` despen
2009-09-16 17:28     ` Peter Dyballa
2009-10-12  3:32   ` David Combs
2009-10-12 11:53     ` Richard Riley

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.