unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Stefan Monnier'" <monnier@IRO.UMontreal.CA>
Cc: 'Bastian Beischer' <beischer@physik.rwth-aachen.de>, Emacs-devel@gnu.org
Subject: RE: font-lock-refresh-defaults
Date: Thu, 22 Jul 2010 08:48:52 -0700	[thread overview]
Message-ID: <2A9BC99A022442569748BEF619DFB564@us.oracle.com> (raw)
In-Reply-To: <jwvsk3bshk0.fsf-monnier+emacs@gnu.org>

> > (defun Buffer-menu-fontify-and-adjust-frame ()
> >   "Use for `buffer-menu-mode-hook'.  Fontify, fit and raise frame."
> >   (save-window-excursion
> >     (save-excursion
> >       (pop-to-buffer "*Buffer List*")
> >       (when (< emacs-major-version 21)
> >         (make-local-variable 'font-lock-defaults))
> >       (setq font-lock-defaults 
> >             '(buffer-menu-font-lock-keywords t))
> >       (when (fboundp 'font-lock-refresh-defaults)
> >         (font-lock-refresh-defaults)) ; WHY NEEDED NOW?
> >       (turn-on-font-lock)
> >       (when (and (fboundp 'fit-frame) (one-window-p t))
> >         (fit-frame))
> >       (raise-frame))))
> 
> > OK, so Emacs has apparently changed something about font-locking, so
> > now you must refresh whenever you change the font-lock defaults.
> > (Whenever?  Or maybe only sometimes when you change the defaults?)
> 
> I think that's pretty much always been necessary (as a general rule),
> tho if the change is made before font-lock gets initialized, then of
> course, there's nothing to refresh and the refresh is not needed, but
> "when font-lock is initialized" is something that can depend on
> *many* things.

I won't argue that one has not sometimes had to refresh the defaults.  I will
say that the above code (without the call to `font-lock-refresh-defaults'),
which is pretty simple, works fine in all previous Emacs releases.  (And I also
initialize font-lock prior to that code.)

(And I repeat that the relevant context - the buff-menu.el code - did not change
at all.  It is there that someone will naturally look first for a change, to try
to understand why things suddenly no longer work.)

Refreshing might have been _theoretically_ necessary in the past as well, as you
suggest, but it was not very often needed in practice, AFAICT.

Anyway, `font-lock-refresh-defaults' did not even exist prior to Emacs 23.2.
(And as I said before, the above code code, without f-l-r-d, works even in Emacs
23.2.)

If this requirement to refresh has always been present (even if I didn't notice
the need in practice), how did people refresh the defaults previously, without
f-l-r-d?  Can you point me to some pre-f-l-r-d source code that actually does
it?

I repeat that _something_ has apparently changed wrt font-locking, so that you
must now refresh whenever (?) you change the defaults, or at least in more (or
different) contexts than previously.


And I repeat the main questions:

Why the change?
Just when do you now need to refresh, in practice (guidelines)?

Why is there nothing about this change in NEWS?
And nothing about when to use f-l-r-d in the Elisp manual?

IOW, it seems that this need to refresh is felt more now than before, yet there
is nothing guiding programmers about this.  There is not even any mention of the
(new) function you must call to satisfy the need (f-l-r-d).

How about a little insight into this change?  What's it all about?  Thx.




      reply	other threads:[~2010-07-22 15:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-15 21:20 font-lock-refresh-defaults Drew Adams
2010-07-22 14:46 ` font-lock-refresh-defaults Stefan Monnier
2010-07-22 15:48   ` Drew Adams [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2A9BC99A022442569748BEF619DFB564@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=Emacs-devel@gnu.org \
    --cc=beischer@physik.rwth-aachen.de \
    --cc=monnier@IRO.UMontreal.CA \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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