🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #88109

Re: font-lock-fontify-region doesn't seem to work right

#88109
From: tim werner
Date: Thu, 04 Aug 1994 15:50
53 lines
2631 bytes
>Date: Wed, 3 Aug 94 17:40:21 -0400
>From: rms@gnu.ai.mit.edu (Richard Stallman)
>
>    In emacs-19.25, with face-lock 3.03, using font-lock-fontify-region seems
>    to re-fontify only the "comment", and "string" faces, but not "keyword",
>    "type", or "function".
>
>I am not sure what you mean.  Please send me a precise recipe
>for a problem and tell me precisely what I should expect to see
>that is wrong at the end of it.

I have contrived an example that does not require face-lock.

In your .emacs file, put:

   (if (eq window-system 'x)
       (progn
         (require 'font-lock)
         (eval-after-load
          "font-lock"
          (progn
            (setq c-font-lock-keywords c-font-lock-keywords-2)
            (setq font-lock-keyword-face 'underline)))
        ))

(Note that you only need a font that supports underline to see this).

Edit a file in C-mode with something like:

   if (something)
      /* this is a comment */
      printf ("this is a string\n");

Use "M-x font-lock-mode RET" to turn on font lock for the file.  See that
the keyword "if" is underlined, as well as the comment and the string.

Select the code fragment in a region.  Use "ESC ESC (font-lock-unfontify-region
(region-beginning) (region-end)) RET" to un-fontify the region.  Note that the
underlining is gone.

Re-select the same region.  Use "ESC ESC (font-lock-fontify-region
(region-beginning) (region-end)) RET" to re-fontify the region.  Note that
the comment and string are underlined, but the keyword "if" is not.  I expect
to see the "if" keyword underlined.  Use "M-x font-lock-fontify-buffer RET",
and see that "if" becomes underlined again.

Fontify-region and fontify-buffer should give the same results on the affected
text, right?

Let me know if you need any other information from me.

thanks,
tw
Technical Details
Message-ID: <199408040109.VAA05393@sparcserver.mc.ab.com>
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!news.onramp.net!convex!news.duke.edu!MathWorks.Com!yeshua.marcam.com!charnel.ecst.csuchico.edu!nic-nac.CSU.net!usc!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!mc.ab.COM!werner

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,e1a46b9b82d176c2
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1994-08-05 03:29:49 PST
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!news.onramp.net!convex!news.duke.edu!MathWorks.Com!yeshua.marcam.com!charnel.ecst.csuchico.edu!nic-nac.CSU.net!usc!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!mc.ab.COM!werner
From: werner@mc.ab.COM (tim werner)
Newsgroups: gnu.emacs.bug
Subject: Re: font-lock-fontify-region doesn't seem to work right
Date: 4 Aug 1994 11:50:31 -0400
Organization: GNUs Not Usenet
Lines: 54
Sender: daemon@cis.ohio-state.edu
Approved: bug-gnu-emacs@prep.ai.mit.edu
Distribution: gnu
Message-ID: <199408040109.VAA05393@sparcserver.mc.ab.com>