[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: f90-mode - auto-fill and font-lock

From: Glenn Morris
Subject: Re: f90-mode - auto-fill and font-lock
Date: 04 Dec 2001 21:38:34 +0000
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 on i686-pc-linux-gnu

"Stefan Monnier" <monnier+gnu.emacs.bug/news/@RUM.cs.yale.edu> wrote:

> I don't know F90 syntax so I can't tell how it should be fixed...

The highlighting should be as follows:

[end] module module_name

"[end] module" should be in font-lock-keyword-face, "module_name" should be
in font-lock-function-name-face.

In addition, there is the syntax:

module procedure proc_name1, proc_name2, ...

where "module procedure" should be in font-lock-keyword-face, and any
elements following should be in font-lock-function-name-face.

And none of this should get fontified in comments.

> Or swapping the two regexps...

This seems a good idea. Modifying f90-font-lock-keywords-1 to start with
the following elements works for me:

'("\\<\\(end[ \t]*\\(program\\|module\\|function\\|subroutine\\|type\\)\\)\\>[ 
    (1 font-lock-keyword-face) (3 font-lock-function-name-face nil t))
'("\\<\\(module[ \t]*procedure\\)\\>[ \t]*\\([^!\n]*\\)"
    (1 font-lock-keyword-face) (2 font-lock-function-name-face nil t))
    (1 font-lock-keyword-face) (2 font-lock-function-name-face nil t))

Whilst playing around with this, I noticed another (very very) minor thing
to do with the highlighting of "real". This is so silly it's probably not
worth bothering with, but pressing on regardless...

This is tricky because it can be both a declaration:

real(4) :: x     ! (A)

where the "(4)" and the "::" are optional; and an intrinsic function:

x = real(2) + &  ! (B)
     real(4)     ! (C)

Instances (A) and (B) are highlighted correctly, but (C) gets highlighted
like (A) instead of like (B). I don't think I've actually come across this
in practice though.

> The default auto-filling function (comment-indent-new-line) uses
> (if soft (insert-and-inherit ?\n) (newline 1)) but f90's
> function does not have soft, so I'm not sure whether it should use hard
> newlines or not.  Would anyone use `use-hard-newlines' with f90 anyway?

I don't know about this, sorry.

Thanks for your help,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]