unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Indent and CSS
@ 2003-11-27 18:44 digits
  2003-12-17 20:36 ` Kai Grossjohann
  0 siblings, 1 reply; 3+ messages in thread
From: digits @ 2003-11-27 18:44 UTC (permalink / raw)


I'm all fresh on Emacs, I have now tried to get Emacs to intent in CSS 
files all day and I can't get it to work.

This is what I want:
body {
<tab>font-size: 10px;
}

h1 {
<tab>font-weight: bold;
}

I know that I can get return-and-indent with C-j, but I would like to 
have it bound to RET when on a line with { as last char.

This is probably so easy I'll be truly ashamed of myself :P

/Gunnar

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

* Re: Indent and CSS
  2003-11-27 18:44 Indent and CSS digits
@ 2003-12-17 20:36 ` Kai Grossjohann
  2003-12-18 11:28   ` Adam Hardy
  0 siblings, 1 reply; 3+ messages in thread
From: Kai Grossjohann @ 2003-12-17 20:36 UTC (permalink / raw)


digits <digits@gentoo.se> writes:

> I'm all fresh on Emacs, I have now tried to get Emacs to intent in CSS
> files all day and I can't get it to work.

Did you look for a css Emacs mode?  www.emacswiki.org might be a good
starting point, as might be the Emacs Lisp List.

> This is what I want:
> body {
> <tab>font-size: 10px;
> }
>
> h1 {
> <tab>font-weight: bold;
> }

If you have a css mode, then you need to tell it to use an indentation
step of N and you also need to set tab-width to the same N.  (Usually,
the indentation step is 2 or 4 but tab-width is 8 by default.)  And
you need to set indent-tabs-mode to t, but that's the default.

> I know that I can get return-and-indent with C-j, but I would like to
> have it bound to RET when on a line with { as last char.

Isn't it enough to always have RET do like C-j?  Why do you want RET
to behave differently if the last char is something else?

(require 'css-mode)
(define-key css-mode-map (kbd "RET") 'newline-and-indent)

Maybe you need to change css-mode and css-mode-map, depending on the
actual css mode that you are using.

Kai

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

* Re: Indent and CSS
  2003-12-17 20:36 ` Kai Grossjohann
@ 2003-12-18 11:28   ` Adam Hardy
  0 siblings, 0 replies; 3+ messages in thread
From: Adam Hardy @ 2003-12-18 11:28 UTC (permalink / raw)
  Cc: help-gnu-emacs

On 12/17/2003 09:36 PM&nbsp;Kai Grossjohann wrote:
> digits <digits@gentoo.se> writes:
> 
> 
>>I'm all fresh on Emacs, I have now tried to get Emacs to intent in CSS
>>files all day and I can't get it to work.
> 
> 
> Did you look for a css Emacs mode?  www.emacswiki.org might be a good
> starting point, as might be the Emacs Lisp List.
> 
> 
>>This is what I want:
>>body {
>><tab>font-size: 10px;
>>}
>>
>>h1 {
>><tab>font-weight: bold;
>>}
> 
> 
> If you have a css mode, then you need to tell it to use an indentation
> step of N and you also need to set tab-width to the same N.  (Usually,
> the indentation step is 2 or 4 but tab-width is 8 by default.)  And
> you need to set indent-tabs-mode to t, but that's the default.
> 
> 
>>I know that I can get return-and-indent with C-j, but I would like to
>>have it bound to RET when on a line with { as last char.
> 
> 
> Isn't it enough to always have RET do like C-j?  Why do you want RET
> to behave differently if the last char is something else?
> 
> (require 'css-mode)
> (define-key css-mode-map (kbd "RET") 'newline-and-indent)
> 
> Maybe you need to change css-mode and css-mode-map, depending on the
> actual css mode that you are using.

one css mode:

http://camalott.com/~jtpolk/emacs.html

-- 
GNU Emacs 21.3.1 on Linux 2.4.20 Debian

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

end of thread, other threads:[~2003-12-18 11:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-27 18:44 Indent and CSS digits
2003-12-17 20:36 ` Kai Grossjohann
2003-12-18 11:28   ` Adam Hardy

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