bug-gnu-emacs
[Top][All Lists]
Advanced

[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: 05 Dec 2001 00:25:52 +0000
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 on i686-pc-linux-gnu

address@hidden (Glenn Morris) wrote:

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

Well, the following will fix this, but it's rather ugly, and given that the
whole problem can be avoided by just making the "+" character the first
item on the continuation line, it's pretty pointless too! But hey...

(defun f90-match-real-declaration (limit)
 "Match the declaration of a real variable, if this is a single line or 
the first row in a continuation line." 
 (if (or (eq (f90-present-statement-cont) 'single) 
                  (eq (f90-present-statement-cont) 'begin))
                  (re-search-forward
                   "^[ \t0-9]*\\(real\\)\\(.*::\\|[ \t]*(.*)\\)?\\([^!\n]*\\)" 
limit t)
        ))


And change f90-font-lock-keywords-2 by removing "real" from the regexp that
matches variable declarations, namely "^[ \t0-9]*\\(real||\..., and
inserting the following item after that one:

'(f90-match-real-declaration
    (1 font-lock-type-face) (3 font-lock-variable-name-face))


Glenn



reply via email to

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