unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* need help customizing font-lock colors in syntax highlighting  (fortran)
@ 2008-03-31 19:41 bcbarnes
  2008-04-01  7:29 ` Glenn Morris
  2008-04-01  8:59 ` Peter Dyballa
  0 siblings, 2 replies; 4+ messages in thread
From: bcbarnes @ 2008-03-31 19:41 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

I've been using emacs for a long time, mostly for Fortran and Python
programming.  I'm currently porting some code from fixed-format to
free-format Fortran, which means the extension of the source file
would change from ".f" to ".f90" -- and the code, which is standard
Fortran 95, would have the F90 filter (f90.el by Glenn Morris) applied
instead of the fortran.el (fortran mode) filter.

In the old fortran mode filter, intrinsics such as mod, exp, and
others would be highlighting in a different color (say, pink) than the
control flow commands such as if/endif, do/enddo (which would be in
purple).  In the F90 mode, these commands are all highlighted in the
same color.  I find this to be undesirable, but I'm not sure how to
change it.  Poking around the f90.el source and google tells me it
will involve something like set-face-foreground of a font-lock mode,
but I don't know what to do.

Can anyone help me out in getting my syntax highlighting customized?
Or should I email the maintainer of the filters?  I am using emacs
22.1 on Fedora 8 and also Aquamacs 1.3 (based on emacs 22.1) on OS X
Leopard.

thanks,

Brian


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

* Re: need help customizing font-lock colors in syntax highlighting (fortran)
  2008-03-31 19:41 need help customizing font-lock colors in syntax highlighting (fortran) bcbarnes
@ 2008-04-01  7:29 ` Glenn Morris
  2008-04-01 15:54   ` bcbarnes
  2008-04-01  8:59 ` Peter Dyballa
  1 sibling, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2008-04-01  7:29 UTC (permalink / raw)
  To: help-gnu-emacs

bcbarnes@gmail.com wrote:

> In the old fortran mode filter, intrinsics such as mod, exp, and
> others would be highlighting in a different color (say, pink) than the
> control flow commands such as if/endif, do/enddo (which would be in
> purple). In the F90 mode, these commands are all highlighted in the
> same color. I find this to be undesirable, but I'm not sure how to
> change it.

I don't really know why it is like it is, but it is. Anyway, add to
~/.emacs:

(eval-after-load "f90"
  '(progn
     (setq f90-font-lock-keywords-3
      (append f90-font-lock-keywords-2
          (list
           f90-keywords-level-3-re
           f90-operators-re
           (list f90-procedures-re '(1 font-lock-builtin-face keep))
           "\\<real\\>"))
      f90-font-lock-keywords-4 (append f90-font-lock-keywords-3
          (list f90-hpf-keywords-re)))))


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

* Re: need help customizing font-lock colors in syntax highlighting (fortran)
  2008-03-31 19:41 need help customizing font-lock colors in syntax highlighting (fortran) bcbarnes
  2008-04-01  7:29 ` Glenn Morris
@ 2008-04-01  8:59 ` Peter Dyballa
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Dyballa @ 2008-04-01  8:59 UTC (permalink / raw)
  To: bcbarnes; +Cc: help-gnu-emacs


Am 31.03.2008 um 21:41 schrieb bcbarnes:
> In the F90 mode, these commands are all highlighted in the
> same color.  I find this to be undesirable, but I'm not sure how to
> change it.  Poking around the f90.el source and google tells me it
> will involve something like set-face-foreground of a font-lock mode,
> but I don't know what to do.


In case you want to change the colour, you can start with C-u C-x =  
on a character in the unwanted face (font and colour). A *Help*  
buffer opens, allowing you to customise the settings in the  
"paragraph" where it describes the text properties.

In your case it will fail, because apparently different sorts of key  
words are mixed. So you would change the face for all of them again,  
for the whole set or "mixed" case.

--
Greetings

   Pete

A morning without coffee is like something without something else.








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

* Re: need help customizing font-lock colors in syntax highlighting  (fortran)
  2008-04-01  7:29 ` Glenn Morris
@ 2008-04-01 15:54   ` bcbarnes
  0 siblings, 0 replies; 4+ messages in thread
From: bcbarnes @ 2008-04-01 15:54 UTC (permalink / raw)
  To: help-gnu-emacs

On Apr 1, 2:29 am, Glenn Morris <rgm+n...@stanford.edu> wrote:
> bcbar...@gmail.com wrote:
> > In the old fortran mode filter, intrinsics such as mod, exp, and
> > others would be highlighting in a different color (say, pink) than the
> > control flow commands such as if/endif, do/enddo (which would be in
> > purple). In the F90 mode, these commands are all highlighted in the
> > same color. I find this to be undesirable, but I'm not sure how to
> > change it.
>
> I don't really know why it is like it is, but it is. Anyway, add to
> ~/.emacs:
>
> (eval-after-load "f90"
>   '(progn
>      (setq f90-font-lock-keywords-3
>       (append f90-font-lock-keywords-2
>           (list
>            f90-keywords-level-3-re
>            f90-operators-re
>            (list f90-procedures-re '(1 font-lock-builtin-face keep))
>            "\\<real\\>"))
>       f90-font-lock-keywords-4 (append f90-font-lock-keywords-3
>           (list f90-hpf-keywords-re)))))


Excellent, Glenn!  That does exactly what I wanted.  Tested in both
emacs 22.1 and Aquamacs 1.3 / OS X.  Thanks.

-Brian


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

end of thread, other threads:[~2008-04-01 15:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-31 19:41 need help customizing font-lock colors in syntax highlighting (fortran) bcbarnes
2008-04-01  7:29 ` Glenn Morris
2008-04-01 15:54   ` bcbarnes
2008-04-01  8:59 ` Peter Dyballa

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