unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Font-lock-faces in Emacs 23.2
@ 2010-12-16 14:13 gerald.jean
  2010-12-16 16:16 ` Drew Adams
  0 siblings, 1 reply; 4+ messages in thread
From: gerald.jean @ 2010-12-16 14:13 UTC (permalink / raw)
  To: help-gnu-emacs


Hello,

I am using Emacs-23.2 on a RedHat 64-bit box.  Ever since IT upgraded from
21.3 to 23.2 I have problems with just one face, namely "Font Lock Type
Face".  Every time I restart Emacs I have to do the following:

1.- M-x customize-group «enter»
2.- font-lock-faces «enter»
3.- Then move down to the "Font Lock Type Face", it is always set to
Goldenrod (which is unreadable on the                 background color I am
using for years).
4.- Then change the Foreground entry from Goldenrod to OrangeRed (for
example).
5.- Then move back to top of buffer, click the «Set for current session»
button and the «Save for future sess      ions button», reply «yes» to the
asked question about saving the current settings.
6.- Exit customize

The settings have been applied and are OK, and stay that way for the time
the current session remains open .
Next time I restart Emacs I am at square 1 again.

Customize has written the following code to my «.emac» file, and this is
the last statement in my «.emacs» file:

(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(default ((t (:inherit nil :stipple nil :background "LightBlue"
:foreground "Maroon" :inverse-video nil :box nil :strike-through nil
:overline nil :underline nil :slant normal :weight bold :height 137 :width
normal :foundry "b&h" :family "lucidatypewriter"))))
 '(dired-header ((t (:inherit default :foreground "OrangeRed"))))
 '(font-lock-type-face ((t (:foreground "OrangeRed"))))
 '(outline-5 ((t (:inherit font-lock-type-face :foreground "OrangeRed")))))

I did post about this problem a little while ago but didn't get any usefull
replies?

Thanks for any support,

Gérald Jean
Conseiller senior en statistiques,
VP Actuariat et Solutions d'assurances,
Desjardins Groupe d'Assurances Générales
télephone            : (418) 835-4900 poste (7639)
télecopieur          : (418) 835-6657
courrier électronique: gerald.jean@dgag.ca

"We believe in God, others must bring Data."

W. Edwards Deming




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

* RE: Font-lock-faces in Emacs 23.2
  2010-12-16 14:13 Font-lock-faces in Emacs 23.2 gerald.jean
@ 2010-12-16 16:16 ` Drew Adams
  2010-12-16 21:17   ` gerald.jean
  0 siblings, 1 reply; 4+ messages in thread
From: Drew Adams @ 2010-12-16 16:16 UTC (permalink / raw)
  To: gerald.jean, help-gnu-emacs

> 1.- M-x customize-group <enter>
> 2.- font-lock-faces <enter>
> 3.- Then move down to the "Font Lock Type Face"...
> 4.- Then change the Foreground entry... to OrangeRed...
> 5.- ...click the <Set for current session> button
>     and the <Save for future sessions button>, reply <yes>...

No need do `Set', since you're doing `Save' (but it doesn't hurt).

> 6.- Exit customize 
...
> Customize has written the following code to my <.emac> file, 
> and this is the last statement in my <.emacs> file:
> 
> (custom-set-faces...
>  '(dired-header ((t (:inherit default :foreground "OrangeRed"))))
>  '(font-lock-type-face ((t (:foreground "OrangeRed"))))...

Does your .emacs get loaded that far, so that the `customize-set-faces' actually
gets eval'd?  E.g., does the `dired-header' face show up OK?

Font lock is sometimes a bit special. What happens if you customize a different
font-lock face, e.g. `font-lock-doc-face'?  Does that work (for subsequent
sessions)?

Are you sure that the face wasn't in fact customized for future sessions, but
that perhaps font-lock-mode wasn't turned on?  Which color is indicated as the
foreground setting after you start up the second time, if you do `customize-face
RET font-lock-type-face RET' then?

Try (after backing up your .emacs) using a different .emacs that has only this
in it:

(custom-set-faces
  '(font-lock-type-face ((t (:foreground "OrangeRed")))))

If that works, then try commenting out half of your original .emacs (leaving the
`custom-set-faces'), then comment-out 3/4, 7/8, 15/16,... until you find which
part of your init file is interfering.

In sum, play around a little, varying things, to see what you can discover.




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

* RE: Font-lock-faces in Emacs 23.2
  2010-12-16 16:16 ` Drew Adams
@ 2010-12-16 21:17   ` gerald.jean
  2010-12-16 21:47     ` Drew Adams
  0 siblings, 1 reply; 4+ messages in thread
From: gerald.jean @ 2010-12-16 21:17 UTC (permalink / raw)
  To: drew.adams; +Cc: help-gnu-emacs



"Drew Adams" <drew.adams@oracle.com> a écrit sur 2010/12/16 11:16:52 :

> > 1.- M-x customize-group <enter>
> > 2.- font-lock-faces <enter>
> > 3.- Then move down to the "Font Lock Type Face"...
> > 4.- Then change the Foreground entry... to OrangeRed...
> > 5.- ...click the <Set for current session> button
> >     and the <Save for future sessions button>, reply <yes>...
>
> No need do `Set', since you're doing `Save' (but it doesn't hurt).

I'll remember this one.

>
> > 6.- Exit customize
> ...
> > Customize has written the following code to my <.emac> file,
> > and this is the last statement in my <.emacs> file:
> >
> > (custom-set-faces...
> >  '(dired-header ((t (:inherit default :foreground "OrangeRed"))))
> >  '(font-lock-type-face ((t (:foreground "OrangeRed"))))...
>
> Does your .emacs get loaded that far, so that the `customize-set-
> faces' actually
> gets eval'd?  E.g., does the `dired-header' face show up OK?

Yes it does, in OrangeRed as specified.

>
> Font lock is sometimes a bit special. What happens if you customize
> a different
> font-lock face, e.g. `font-lock-doc-face'?  Does that work (for
subsequent
> sessions)?

For reasons I don't understand I couldn't customize "font-lock-doc-face",
everything I tried to do in there emacs told me I couldn't edit this part
of the field, I tried every where in the "Foreground" field, this field was
not ticked though?  Hence I tried a different font-lock-face,
"font-lock-keyword-face", I setted it to "Red" and accordingly Customize
wrote the following line in my .emacs.

 '(font-lock-keyword-face ((t (:foreground "Red"))))

Didn't stay for future sessions?

>
> Are you sure that the face wasn't in fact customized for future sessions,
but
> that perhaps font-lock-mode wasn't turned on?  Which color is indicated
as the
> foreground setting after you start up the second time, if you do
> `customize-face
> RET font-lock-type-face RET' then?

Goldenrod, as it always indicates upon a new startup?

>
> Try (after backing up your .emacs) using a different .emacs that hasonly
this
> in it:
>
> (custom-set-faces
>   '(font-lock-type-face ((t (:foreground "OrangeRed")))))
>
> If that works, then try commenting out half of your original .emacs
> (leaving the
> `custom-set-faces'), then comment-out 3/4, 7/8, 15/16,... until you find
which
> part of your init file is interfering.
>
> In sum, play around a little, varying things, to see what you can
discover.
>

This is what I did and thanks to Drew I located the problem.  I would never
have thought of looking there though since the problem originates from an
Emacs package I use very heavily, every day, for years, ess (Emacs Speaks
Statistics), furthermore, the problem occurred after the upgrade from 21.3
to 23.2, it was OK before?

(require 'ess-site)
(require 'ess-font-lock)
(ess-font-lock-db)  ;;  This single function caused the problem.

I went to "ess-font-lock.el" and found:

(defun ess-font-lock-db ()
  "Set font-lock colors (leave fore-/back-ground alone) courtesy David
Brahm <David.Brahm@fmr.com>"
  (interactive)
  (set-face-foreground 'font-lock-comment-face       "Firebrick")  ; #...
%...
  (set-face-foreground 'font-lock-string-face        "SeaGreen")   ; "..."
"..."
  (set-face-foreground 'font-lock-keyword-face       "MediumBlue") ; if
\end
  (set-face-foreground 'font-lock-function-name-face "VioletRed")  ; talk<-
{center}
  (set-face-foreground 'font-lock-variable-name-face "Blue")         ; xv
  (set-face-foreground 'font-lock-type-face          "Goldenrod")  ; T,F
?
  (set-face-foreground 'font-lock-constant-face      "Magenta")    ; <-
{eq1}
)

I replaced the offending "Goldenrod" by "OrangeRed" and everything is fine,
the only thing now is that at each upgrade I'll have to remember to change
this!

There is something I'd like explained if possible.  Given that I have

 (custom-set-faces...
  '(dired-header ((t (:inherit default :foreground "OrangeRed"))))
  '(font-lock-type-face ((t (:foreground "OrangeRed"))))...

way later than the call to "ess-font-lock-db" in my .emacs file why didn't
my settings override the "ess-font-lock-db" settings?

Thanks again to Drew Adams, this was annoying me for a while,

Gérald Jean
Conseiller senior en statistiques,
VP Actuariat et Solutions d'assurances,
Desjardins Groupe d'Assurances Générales
télephone            : (418) 835-4900 poste (7639)
télecopieur          : (418) 835-6657
courrier électronique: gerald.jean@dgag.ca

"We believe in God, others must bring Data."

W. Edwards Deming




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

* RE: Font-lock-faces in Emacs 23.2
  2010-12-16 21:17   ` gerald.jean
@ 2010-12-16 21:47     ` Drew Adams
  0 siblings, 0 replies; 4+ messages in thread
From: Drew Adams @ 2010-12-16 21:47 UTC (permalink / raw)
  To: gerald.jean; +Cc: help-gnu-emacs

> > varying things, to see what you can discover.
> 
> This is what I did and thanks to Drew I located the problem.  
> I would never have thought of looking there though since the problem 
> originates from an Emacs package I use very heavily, every day, for
> years, ess (Emacs Speaks Statistics), furthermore, the problem
> occurred after the upgrade from 21.3 to 23.2, it was OK before?
> 
> (require 'ess-site)
> (require 'ess-font-lock)
> (ess-font-lock-db)  ;;  This single function caused the problem.

Is that `(ess-font-lock-db)' occurrence at the top level of some file that you
load?  IOW, is it getting eval'd unconditionally whenever you load ESS?

If so, I would recommend that you file an ESS bug.
Merely loading a library should not change user settings this way.

Some reasonable ways for a library to deal with this kind of thing:

a. Just recommend particular settings, in a comment or doc string, without
actually setting them.

b. Provide a command that sets the recommended settings.

c. Provide its own user options or faces with the recommended values as the
default values.  That way, users can customize them.

> I replaced the offending "Goldenrod" by "OrangeRed" and
> everything is fine, the only thing now is that at each
> upgrade I'll have to remember to change this!

That's why it's better to file a bug report.
You should not need to modify source code that way.

> There is something I'd like explained if possible.  Given that I have
>  (custom-set-faces...
>   '(dired-header ((t (:inherit default :foreground "OrangeRed"))))
>   '(font-lock-type-face ((t (:foreground "OrangeRed"))))...
> way later than the call to "ess-font-lock-db" in my .emacs 
> file why didn't my settings override the "ess-font-lock-db" settings?

Dunno. Are you sure `ess-font-lock-db' wasn't called again later?
`custom-set-faces' unconditionally sets the faces each time it is called.  For
example:

(custom-set-faces '(font-lock-comment-face
                  ((t (:foreground "Red")))))
(set-face-foreground 'font-lock-comment-face "DarkBlue")
(custom-set-faces '(font-lock-comment-face
                  ((t (:foreground "DarkGreen")))))

Put your cursor after each of these sexps in turn and hit `C-x C-e' to evaluate
it.

My guess is that something is calling `ess-font-lock-db' again after your .emacs
is loaded.




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

end of thread, other threads:[~2010-12-16 21:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-16 14:13 Font-lock-faces in Emacs 23.2 gerald.jean
2010-12-16 16:16 ` Drew Adams
2010-12-16 21:17   ` gerald.jean
2010-12-16 21:47     ` Drew Adams

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