From: Hrvoje Niksic <hniksic@xemacs.org>
Subject: (font-lock-mode 1) does not always force font-lock
Date: Thu, 23 Oct 2003 01:52:11 +0200 [thread overview]
Message-ID: <m3smlkygno.fsf@hniksic.iskon.hr> (raw)
I have code that needs to force fontification of a file loaded from
disk without affecting buffers visiting the file. What I tried was:
(with-temp-buffer
(insert-file-contents FILE)
(let ((buffer-file-name FILE)) ; for normal-mode
(normal-mode)
(font-lock-mode 1)
;; Here the buffer should be fontified and font-lock-mode turned
;; on.
font-lock-mode))
This returns nil because `(font-lock-mode 1)' does not force
font-lock, contrary to the docstring which, in GNU Emacs 21.2.1,
states:
With arg, turn Font Lock mode off if and only if arg is a
non-positive number; if arg is nil, toggle Font Lock mode;
anything else turns Font Lock on.
I assume the problem is that the buffer is that the buffer in question
is temporary. But `(font-lock-mode 1)' should IMHO still force
font-lock. And if not, there should be a way to say, "yes, I know
what I'm doing and I really want to fontify this temporary buffer."
A workaround that works for me is to add:
(unless font-lock-mode
(font-lock-fontify-buffer))
but that kind of solution might not work elsewhere.
next reply other threads:[~2003-10-22 23:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-22 23:52 Hrvoje Niksic [this message]
2003-10-23 18:38 ` (font-lock-mode 1) does not always force font-lock Richard Stallman
2003-10-23 22:30 ` Hrvoje Niksic
2003-10-24 5:22 ` Alexander Pohoyda
2003-10-24 9:49 ` Hrvoje Niksic
2003-10-24 19:12 ` Alexander Pohoyda
2003-10-24 20:15 ` Hrvoje Niksic
2003-10-25 7:35 ` Alexander Pohoyda
2003-10-25 9:52 ` Hrvoje Niksic
2003-10-26 11:32 ` Alexander Pohoyda
2003-10-26 16:56 ` Hrvoje Niksic
2003-10-26 19:07 ` Stefan Monnier
2003-10-27 23:44 ` Richard Stallman
2003-10-28 22:09 ` Alexander Pohoyda
2003-11-18 21:13 ` Alexander Pohoyda
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3smlkygno.fsf@hniksic.iskon.hr \
--to=hniksic@xemacs.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.