unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* modes not doing much
@ 2006-08-12  8:09 YAD
  2006-08-12 11:05 ` Colin S. Miller
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: YAD @ 2006-08-12  8:09 UTC (permalink / raw)


So far I've used Ruby mode and HTML mode.
No colors, no auto-indent on <rtrn>.

So what are the modes doing?  Vim and even the
Firefox source viewer have syntax-based colors.
Isn't Emacs supposed to do that too?

Also, Lisp .cl files and Python .py files are coming up in
Fundamental mode, while OCaml .ml files come up in Lisp mode.
What the heck is going on? :(

-- 
Yet another Dan

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

* Re: modes not doing much
  2006-08-12  8:09 modes not doing much YAD
@ 2006-08-12 11:05 ` Colin S. Miller
  2006-08-12 11:23   ` Colin S. Miller
                     ` (2 more replies)
  2006-08-12 14:56 ` robert.thorpe
  2006-08-12 21:23 ` dsjoblom
  2 siblings, 3 replies; 10+ messages in thread
From: Colin S. Miller @ 2006-08-12 11:05 UTC (permalink / raw)


YAD wrote:
> So far I've used Ruby mode and HTML mode.
> No colors, no auto-indent on <rtrn>.
> 
> So what are the modes doing?  Vim and even the
> Firefox source viewer have syntax-based colors.
> Isn't Emacs supposed to do that too?
> 
> Also, Lisp .cl files and Python .py files are coming up in
> Fundamental mode, while OCaml .ml files come up in Lisp mode.
> What the heck is going on? :(
> 

Try
M-x font-lock-mode
for colouring

to make this permanent, place this in your .emacs file

(add-hook 'html-mode-hook '(lambda ()
                                  (turn-on-font-lock))

(add-hook 'haskell-mode-hook '(lambda ()
                                  (turn-on-font-lock))


I have auto-indent enabled for C, but I can't see where
it is switched on.



To associate a file name with a mode, use
(add-to-list 'auto-mode-alist '("\\.cl\\'" . lisp-mode) 't)
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode) 't)
I can't find the mode for Ocaml - you might need to google for one.


Python should be bound by default - what does
C-h v auto-mode-alist RET
report?



These code snippets are for XEmacs - they should
work on GNU Emacs, but I can't guarantee that.

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] 10+ messages in thread

* Re: modes not doing much
  2006-08-12 11:05 ` Colin S. Miller
@ 2006-08-12 11:23   ` Colin S. Miller
  2006-08-12 13:27   ` Hadron Quark
  2006-08-12 15:00   ` YAD
  2 siblings, 0 replies; 10+ messages in thread
From: Colin S. Miller @ 2006-08-12 11:23 UTC (permalink / raw)


YAD,

Looking a bit closer at my auto-mode-alist shows
it contains, amongs other entries,

("\\.py$" . python-mode)
("\\.ml[iylp]?$" . caml-mode)
("\\.ml\\'" . lisp-mode)

The second entry means .ml optionally follwed by i, y, l, or p,
are in caml-mode.

However, the last entry overrides .ml,
so adding to your .emacs
(remove-alist 'auto-mode-alist '"\\.ml\\'")
should work, if emacs's auto-mode-alist is the same as
XEmacs's.




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] 10+ messages in thread

* Re: modes not doing much
  2006-08-12 11:05 ` Colin S. Miller
  2006-08-12 11:23   ` Colin S. Miller
@ 2006-08-12 13:27   ` Hadron Quark
  2006-08-12 15:00   ` YAD
  2 siblings, 0 replies; 10+ messages in thread
From: Hadron Quark @ 2006-08-12 13:27 UTC (permalink / raw)


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

> YAD wrote:
>> So far I've used Ruby mode and HTML mode.
>> No colors, no auto-indent on <rtrn>.
>>
>> So what are the modes doing?  Vim and even the
>> Firefox source viewer have syntax-based colors.
>> Isn't Emacs supposed to do that too?
>>
>> Also, Lisp .cl files and Python .py files are coming up in
>> Fundamental mode, while OCaml .ml files come up in Lisp mode.
>> What the heck is going on? :(
>>
>
> Try
> M-x font-lock-mode
> for colouring

I have

(global-font-lock-mode 1)

in my .emacs. Using emacs-snaphot

,----
| GNU Emacs 22.0.50.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of
| 2006-01-16 on vernadsky, modified by Debian
`----

I have to refresh the screen (hilite & unhilite) the text for c mode
hiliting to start working. Why is this?


>
> to make this permanent, place this in your .emacs file
>
> (add-hook 'html-mode-hook '(lambda ()
>                                  (turn-on-font-lock))
>
> (add-hook 'haskell-mode-hook '(lambda ()
>                                  (turn-on-font-lock))
>
>
> I have auto-indent enabled for C, but I can't see where
> it is switched on.
>
>
>
> To associate a file name with a mode, use
> (add-to-list 'auto-mode-alist '("\\.cl\\'" . lisp-mode) 't)
> (add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode) 't)
> I can't find the mode for Ocaml - you might need to google for one.
>
>
> Python should be bound by default - what does
> C-h v auto-mode-alist RET
> report?
>
>
>
> These code snippets are for XEmacs - they should
> work on GNU Emacs, but I can't guarantee that.
>
> 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] 10+ messages in thread

* Re: modes not doing much
  2006-08-12  8:09 modes not doing much YAD
  2006-08-12 11:05 ` Colin S. Miller
@ 2006-08-12 14:56 ` robert.thorpe
  2006-08-12 16:26   ` YAD
  2006-08-12 21:23 ` dsjoblom
  2 siblings, 1 reply; 10+ messages in thread
From: robert.thorpe @ 2006-08-12 14:56 UTC (permalink / raw)


YAD wrote:
> So far I've used Ruby mode and HTML mode.
> No colors, no auto-indent on <rtrn>.
>
> So what are the modes doing?  Vim and even the
> Firefox source viewer have syntax-based colors.
> Isn't Emacs supposed to do that too?
>
> Also, Lisp .cl files and Python .py files are coming up in
> Fundamental mode, while OCaml .ml files come up in Lisp mode.
> What the heck is going on? :(

In addition to what others have said :

* Common Lisp files normally end in .lsp or .lisp this is what Emacs
expects

* You're probably using an old Emacs with no Python support.  This will
be fixed in the v22.  Until then you can install python mode from the
python distribution.

* Indentation in Emacs is via tab, hit tab and it will auto indent the
current like to whatever the mode considers the right indentation.  You
can get the same behaviour by ending lines with M-j.  It doesn't do it
automatically so the user has the choice to ignore what the mode thinks
is right easily.

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

* Re: modes not doing much
  2006-08-12 11:05 ` Colin S. Miller
  2006-08-12 11:23   ` Colin S. Miller
  2006-08-12 13:27   ` Hadron Quark
@ 2006-08-12 15:00   ` YAD
  2006-08-12 16:37     ` Drew Adams
  2 siblings, 1 reply; 10+ messages in thread
From: YAD @ 2006-08-12 15:00 UTC (permalink / raw)


Colin S. Miller wrote:

> M-x font-lock-mode
> for colouring

Thanks.

 > to make this permanent, place this in your .emacs file
 > (add-hook 'html-mode-hook '(lambda ()
 >                                  (turn-on-font-lock))

Hadron Quark wrote:
 > I have
 > (global-font-lock-mode 1)
 > in my .emacs.

I found that too:
http://lug.umbc.edu/tutorials/adv-emacs.html
 > Add  (global-font-lock-mode 1 t)
 > to  ~/.emacs  to always use font-lock mode
___

Colin S. Miller wrote:

 > I have auto-indent enabled for C,
 > but I can't see where it is switched on.

Does it have to be switched on? If a mode does neither
coloring nor indentation, then what does it do?

> Python should be bound by default - what does
> C-h v auto-mode-alist RET
> report?

 > Looking a bit closer at my auto-mode-alist shows
 > it contains, amongs other entries,
 > ("\\.py$" . python-mode)
 > ("\\.ml[iylp]?$" . caml-mode)
 > ("\\.ml\\'" . lisp-mode)

I don't have python-mode or caml-mode, but I'm using GNU.
Video games and the "Emacs Psychiatrist", but RMS/GNU couldn't fit
in important language editing modes, or make sure the modes work.

lisp-mode colors are working now that I moved my .cl file to .l
No indentation anywhere though.

Thanks for the help.

-- 
Yet another Dan

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

* Re: modes not doing much
  2006-08-12 14:56 ` robert.thorpe
@ 2006-08-12 16:26   ` YAD
  0 siblings, 0 replies; 10+ messages in thread
From: YAD @ 2006-08-12 16:26 UTC (permalink / raw)


robert.thorpe@antenova.com wrote:

> * You're probably using an old Emacs with no Python support.  This will
> be fixed in the v22.

I just downloaded 21.4a a couple weeks ago.

> * Indentation in Emacs is via tab, hit tab and it will auto indent the
> current like to whatever the mode considers the right indentation.

I just figured that out.  It's been over a decade since I used Emacs 
regularly, so my recollection of it is fragmented.  Effusive and abject 
apologies to Mr. Stallman and all the good people at GNU.

-- 
Yet another Dan

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

* RE: modes not doing much
  2006-08-12 15:00   ` YAD
@ 2006-08-12 16:37     ` Drew Adams
  0 siblings, 0 replies; 10+ messages in thread
From: Drew Adams @ 2006-08-12 16:37 UTC (permalink / raw)


    I don't have python-mode or caml-mode, but I'm using GNU.
    Video games and the "Emacs Psychiatrist", but RMS/GNU couldn't fit
    in important language editing modes, or make sure the modes work.

So now you have three things to turn to, when frustrated with Emacs:

* video games
* M-x doctor
* help-gnu-emacs

Here are two more:

* M-x dissociated-press
* http://www.emacswiki.org/cgi-bin/wiki/SiteMap

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

* Re: modes not doing much
  2006-08-12  8:09 modes not doing much YAD
  2006-08-12 11:05 ` Colin S. Miller
  2006-08-12 14:56 ` robert.thorpe
@ 2006-08-12 21:23 ` dsjoblom
  2006-08-12 22:17   ` Giorgos Keramidas
  2 siblings, 1 reply; 10+ messages in thread
From: dsjoblom @ 2006-08-12 21:23 UTC (permalink / raw)



YAD wrote:
> So far I've used Ruby mode and HTML mode.
> No colors, no auto-indent on <rtrn>.

Others have already helped with the coloring problem, but you may want
to try this in your .emacs to set up auto-indenting for programming
modes you are using:

(add-hook 'perl-mode-hook
          #'(lambda ()
              ;; A better newline
              (local-set-key "\C-m"
#'reindent-then-newline-and-indent)))

This particular example is for perl, adjust the hook name to the name
of your mode hook. For other similar functions to bind to the return
key, try M-x apropos newline-and-indent.

Regards,
Daniel Sjöblom

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

* Re: modes not doing much
  2006-08-12 21:23 ` dsjoblom
@ 2006-08-12 22:17   ` Giorgos Keramidas
  0 siblings, 0 replies; 10+ messages in thread
From: Giorgos Keramidas @ 2006-08-12 22:17 UTC (permalink / raw)


On 12 Aug 2006 14:23:28 -0700, dsjoblom@abo.fi wrote:
> YAD wrote:
>> So far I've used Ruby mode and HTML mode.
>> No colors, no auto-indent on <rtrn>.
>
> Others have already helped with the coloring problem, but you may want
> to try this in your .emacs to set up auto-indenting for programming
> modes you are using:
>
> (add-hook 'perl-mode-hook
>           #'(lambda ()
>               ;; A better newline
>               (local-set-key "\C-m"
> #'reindent-then-newline-and-indent)))

In recent Emacs versions, you can also write this as:

    (add-hook 'perl-mode-hook
              (lambda ()
                ;; A better newline
                (local-set-key (kbd "RET") 'reindent-then-newline-and-indent)))

which I sometimes find cleaner than "\C-\M-\S-foo" stuff :)

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

end of thread, other threads:[~2006-08-12 22:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-12  8:09 modes not doing much YAD
2006-08-12 11:05 ` Colin S. Miller
2006-08-12 11:23   ` Colin S. Miller
2006-08-12 13:27   ` Hadron Quark
2006-08-12 15:00   ` YAD
2006-08-12 16:37     ` Drew Adams
2006-08-12 14:56 ` robert.thorpe
2006-08-12 16:26   ` YAD
2006-08-12 21:23 ` dsjoblom
2006-08-12 22:17   ` Giorgos Keramidas

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