bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#59828: Fundamental Mode buffers fail to keep text properties


From: Heime
Subject: bug#59828: Fundamental Mode buffers fail to keep text properties
Date: Mon, 05 Dec 2022 20:27:09 +0000

------- Original Message -------
On Monday, December 5th, 2022 at 8:13 PM, Heime via "Bug reports for GNU Emacs, 
the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org> wrote:


> ------- Original Message -------
> On Monday, December 5th, 2022 at 8:07 PM, Yuan Fu casouri@gmail.com wrote:
> 
> 
> 
> > > On Dec 5, 2022, at 11:23 AM, Heime heimeborgia@protonmail.com wrote:
> > > 
> > > ------- Original Message -------
> > > On Monday, December 5th, 2022 at 3:40 PM, Eli Zaretskii eliz@gnu.org 
> > > wrote:
> > > 
> > > > > Date: Mon, 05 Dec 2022 15:06:09 +0000
> > > > > From: Heime heimeborgia@protonmail.com
> > > > > Cc: casouri@gmail.com, 59828@debbugs.gnu.org
> > > > > 
> > > > > > > > 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"))))
> > > > > > 
> > > > > > Because those turn on font-lock by default.
> > > > > 
> > > > > What do you think about having fundamental-mode also turn font-lock 
> > > > > on ?
> > > > 
> > > > What it does now is the result of what we think. That's why it is called
> > > > Fundamental.
> > > > 
> > > > Anyway, there's no bug here, so I'm closing this.
> > > 
> > > Is fundamental mode not usually used when working on new buffers?
> > 
> > Just to clarify:
> > 
> > 1. If font-lock-mode is off, you should use (propertize … ‘face …)
> > 2. If font-lock-mode is on, you should use (propertize … ‘font-lock-face …)

If I have a function that does the inserts, should I include the two different 
conditions, 
whether "font-lock-mode" in "off" or "on" ?

Test whether font-lock-mode is off, then use (propertize … ‘face …)
Test whether font-lock-mode is on, then use (propertize … ‘font-lock-face …)
 
> Very clear explanation.
> 
> > If you create a buffer interactively, font-lock-mode is on (at least in the 
> > latest version of Emacs, not sure which version of Emacs are you on). But 
> > if you create a buffer programmatically (as you did in the code snippet), 
> > font-lock-mode is off.
> 
> 
> Even if you make a buffer interactively in fundamental-mode, would 
> font-lock-mode be on ?
>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]