GNU bug report logs - #59828
Fundamental Mode buffers fail to keep text properties

Previous Next

Package: emacs;

Reported by: Heime <heimeborgia <at> protonmail.com>

Date: Mon, 5 Dec 2022 06:31:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Heime <heimeborgia <at> protonmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: casouri <at> gmail.com, 59828 <at> debbugs.gnu.org
Subject: bug#59828: Fundamental Mode buffers fail to keep text properties
Date: Mon, 05 Dec 2022 14:54:47 +0000
------- Original Message -------
On Monday, December 5th, 2022 at 2:41 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:


> > Date: Mon, 05 Dec 2022 13:49:28 +0000
> > From: Heime heimeborgia <at> protonmail.com
> > Cc: casouri <at> gmail.com, 59828 <at> debbugs.gnu.org
> > 
> > > > > > Have noticed that when I insert text with colour properties in a buffer
> > > > > > using fundamental-mode, the text properties (e.g. colours) get lost.
> > > > > 
> > > > > I assume you used the ‘face property, right? If you replace ‘face with 'font-lock-face, does it work?
> > > > > 
> > > > > Yuan
> > > > 
> > > > I used 'font-lock-face and did not work.
> > > 
> > > Please show the code you used. It works here.
> > 
> > (with-current-buffer (get-buffer-create bufrn)
> > (insert (propertize "G"
> > 'font-lock-face '(:background "green"
> > :foreground "black"))))
> 
> 
> From the ELisp manual:
> 
> ‘font-lock-face’
> This property specifies a value for the ‘face’ property that Font
> Lock mode should apply to the underlying text. It is one of the
> fontification methods used by Font Lock mode, and is useful for
> special modes that implement their own highlighting. *Note
> Precalculated Fontification::. When Font Lock mode is disabled,
> ‘font-lock-face’ has no effect.
> 
> Note the last sentence.
> 
> Conclusion: you need to turn on font-lock in that buffer.
> 

When I use (text-mode) or (org-mode), I do not get the problem.

(with-current-buffer (get-buffer-create bufrn)
 (text-mode)
 (insert (propertize "G"
 'font-lock-face '(:background "green"
 :foreground "black"))))




This bug report was last modified 2 years and 167 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.