all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#59828: Fundamental Mode buffers fail to keep text properties
@ 2022-12-05  6:30 Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-12-05  6:32 ` Yuan Fu
  0 siblings, 1 reply; 19+ messages in thread
From: Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-12-05  6:30 UTC (permalink / raw)
  To: 59828


Have noticed that when I insert text with colour properties in a buffer
using fundamental-mode, the text properties (e.g. colours) get lost.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#59828: Fundamental Mode buffers fail to keep text properties
  2022-12-05  6:30 bug#59828: Fundamental Mode buffers fail to keep text properties Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-12-05  6:32 ` Yuan Fu
  2022-12-05  8:30   ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 19+ messages in thread
From: Yuan Fu @ 2022-12-05  6:32 UTC (permalink / raw)
  To: Heime; +Cc: 59828



> On Dec 4, 2022, at 10:30 PM, Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors <bug-gnu-emacs@gnu.org> wrote:
> 
> 
> 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




^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#59828: Fundamental Mode buffers fail to keep text properties
  2022-12-05  6:32 ` Yuan Fu
@ 2022-12-05  8:30   ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-12-05 12:46     ` Eli Zaretskii
  0 siblings, 1 reply; 19+ messages in thread
From: Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-12-05  8:30 UTC (permalink / raw)
  To: Yuan Fu; +Cc: 59828

------- Original Message -------
On Monday, December 5th, 2022 at 6:32 AM, Yuan Fu <casouri@gmail.com> wrote:


> > On Dec 4, 2022, at 10:30 PM, Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors bug-gnu-emacs@gnu.org wrote:
> > 
> > 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.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#59828: Fundamental Mode buffers fail to keep text properties
  2022-12-05  8:30   ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-12-05 12:46     ` Eli Zaretskii
  2022-12-05 13:49       ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2022-12-05 12:46 UTC (permalink / raw)
  To: Heime; +Cc: casouri, 59828

> Cc: 59828@debbugs.gnu.org
> Date: Mon, 05 Dec 2022 08:30:51 +0000
> From:  Heime via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@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.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#59828: Fundamental Mode buffers fail to keep text properties
  2022-12-05 12:46     ` Eli Zaretskii
@ 2022-12-05 13:49       ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-12-05 14:41         ` Eli Zaretskii
  0 siblings, 1 reply; 19+ messages in thread
From: Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-12-05 13:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: casouri, 59828



------- Original Message -------
On Monday, December 5th, 2022 at 12:46 PM, Eli Zaretskii <eliz@gnu.org> wrote:


> > Cc: 59828@debbugs.gnu.org
> > Date: Mon, 05 Dec 2022 08:30:51 +0000
> > From: Heime via "Bug reports for GNU Emacs,
> > the Swiss army knife of text editors" bug-gnu-emacs@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"))))










^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#59828: Fundamental Mode buffers fail to keep text properties
  2022-12-05 13:49       ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-12-05 14:41         ` Eli Zaretskii
  2022-12-05 14:54           ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2022-12-05 14:41 UTC (permalink / raw)
  To: Heime; +Cc: casouri, 59828

> Date: Mon, 05 Dec 2022 13:49:28 +0000
> From: Heime <heimeborgia@protonmail.com>
> Cc: casouri@gmail.com, 59828@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.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#59828: Fundamental Mode buffers fail to keep text properties
  2022-12-05 14:41         ` Eli Zaretskii
@ 2022-12-05 14:54           ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-12-05 15:00             ` Eli Zaretskii
  0 siblings, 1 reply; 19+ messages in thread
From: Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-12-05 14:54 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: casouri, 59828

------- Original Message -------
On Monday, December 5th, 2022 at 2:41 PM, Eli Zaretskii <eliz@gnu.org> wrote:


> > Date: Mon, 05 Dec 2022 13:49:28 +0000
> > From: Heime heimeborgia@protonmail.com
> > Cc: casouri@gmail.com, 59828@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"))))





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#59828: Fundamental Mode buffers fail to keep text properties
  2022-12-05 14:54           ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-12-05 15:00             ` Eli Zaretskii
  2022-12-05 15:06               ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2022-12-05 15:00 UTC (permalink / raw)
  To: Heime; +Cc: casouri, 59828

> Date: Mon, 05 Dec 2022 14:54:47 +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.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#59828: Fundamental Mode buffers fail to keep text properties
  2022-12-05 15:00             ` Eli Zaretskii
@ 2022-12-05 15:06               ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-12-05 15:40                 ` Eli Zaretskii
  0 siblings, 1 reply; 19+ messages in thread
From: Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-12-05 15:06 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: casouri, 59828

------- Original Message -------
On Monday, December 5th, 2022 at 3:00 PM, Eli Zaretskii <eliz@gnu.org> wrote:


> > Date: Mon, 05 Dec 2022 14:54:47 +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 ?





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#59828: Fundamental Mode buffers fail to keep text properties
  2022-12-05 15:06               ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-12-05 15:40                 ` Eli Zaretskii
  2022-12-05 19:23                   ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2022-12-05 15:40 UTC (permalink / raw)
  To: Heime; +Cc: casouri, 59828-done

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





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#59828: Fundamental Mode buffers fail to keep text properties
  2022-12-05 15:40                 ` Eli Zaretskii
@ 2022-12-05 19:23                   ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-12-05 20:04                     ` Eli Zaretskii
  2022-12-05 20:07                     ` Yuan Fu
  0 siblings, 2 replies; 19+ messages in thread
From: Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-12-05 19:23 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: casouri, 59828-done

------- 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?






^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#59828: Fundamental Mode buffers fail to keep text properties
  2022-12-05 19:23                   ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-12-05 20:04                     ` Eli Zaretskii
  2022-12-05 20:07                     ` Yuan Fu
  1 sibling, 0 replies; 19+ messages in thread
From: Eli Zaretskii @ 2022-12-05 20:04 UTC (permalink / raw)
  To: Heime; +Cc: casouri, 59828-done

> Date: Mon, 05 Dec 2022 19:23:02 +0000
> From: Heime <heimeborgia@protonmail.com>
> Cc: casouri@gmail.com, 59828-done@debbugs.gnu.org
> 
> > > 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?

Not necessarily, it depends on what the Lisp program needs to do.

And turning on font-lock is just one line of Lisp away.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#59828: Fundamental Mode buffers fail to keep text properties
  2022-12-05 19:23                   ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-12-05 20:04                     ` Eli Zaretskii
@ 2022-12-05 20:07                     ` Yuan Fu
  2022-12-05 20:13                       ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 19+ messages in thread
From: Yuan Fu @ 2022-12-05 20:07 UTC (permalink / raw)
  To: Heime; +Cc: Eli Zaretskii, 59828-done



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

Yuan




^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#59828: Fundamental Mode buffers fail to keep text properties
  2022-12-05 20:07                     ` Yuan Fu
@ 2022-12-05 20:13                       ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-12-05 20:25                         ` Yuan Fu
  2022-12-05 20:27                         ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 19+ messages in thread
From: Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-12-05 20:13 UTC (permalink / raw)
  To: Yuan Fu; +Cc: Eli Zaretskii, 59828-done

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

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?





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#59828: Fundamental Mode buffers fail to keep text properties
  2022-12-05 20:13                       ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-12-05 20:25                         ` Yuan Fu
  2022-12-05 20:27                         ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 19+ messages in thread
From: Yuan Fu @ 2022-12-05 20:25 UTC (permalink / raw)
  To: Heime; +Cc: Eli Zaretskii, 59828-done



> On Dec 5, 2022, at 12:13 PM, Heime <heimeborgia@protonmail.com> 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 …)
> 
> 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?

By “interactively” I mean typing M-x switch-to-buffer <buffer name> RET. This gives you a new buffer in fundamental-mode.

If you create a buffer this way, and type M-x eval-expression font-lock-mode RET, you should get t, meaning font-lock-mode is on. Whereas 

(with-current-buffer (get-buffer-create "xxx")
  font-lock-mode)

returns nil.

Yuan




^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#59828: Fundamental Mode buffers fail to keep text properties
  2022-12-05 20:13                       ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-12-05 20:25                         ` Yuan Fu
@ 2022-12-05 20:27                         ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-12-06  5:41                           ` Yuan Fu
  1 sibling, 1 reply; 19+ messages in thread
From: Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-12-05 20:27 UTC (permalink / raw)
  To: Heime; +Cc: Yuan Fu, Eli Zaretskii, 59828-done


------- 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 ?
>





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#59828: Fundamental Mode buffers fail to keep text properties
  2022-12-05 20:27                         ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-12-06  5:41                           ` Yuan Fu
  2022-12-07  0:53                             ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 19+ messages in thread
From: Yuan Fu @ 2022-12-06  5:41 UTC (permalink / raw)
  To: Heime; +Cc: Eli Zaretskii, 59828-done

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

It depends on your use-case. If you want to be safe you can just apply both properties, then it will work no matter font-lock-mode is on or not.

Yuan




^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#59828: Fundamental Mode buffers fail to keep text properties
  2022-12-06  5:41                           ` Yuan Fu
@ 2022-12-07  0:53                             ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-12-08 13:00                               ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 19+ messages in thread
From: Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-12-07  0:53 UTC (permalink / raw)
  To: Yuan Fu; +Cc: Eli Zaretskii, 59828-done


------- Original Message -------
On Tuesday, December 6th, 2022 at 5:41 AM, Yuan Fu <casouri@gmail.com> wrote:


> > > > 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 …)
> 
> 
> It depends on your use-case. If you want to be safe you can just apply both properties, then it will work no matter font-lock-mode is on or not.
> 
> Yuan

I thought that the procedure is to enable "font-lock-mode", then use (propertize … ‘font-lock-face …).

You are saying to disregard "font-lock-mode" and use (propertize … ‘face …) when it is determined that "font-lock-mode" is off.

Can I have a deeper explanation on how to handle this good?






^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#59828: Fundamental Mode buffers fail to keep text properties
  2022-12-07  0:53                             ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-12-08 13:00                               ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 19+ messages in thread
From: Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-12-08 13:00 UTC (permalink / raw)
  To: Heime; +Cc: Yuan Fu, Eli Zaretskii, 59828-done


------- Original Message -------
On Wednesday, December 7th, 2022 at 12:53 AM, Heime via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org> wrote:


> ------- Original Message -------
> On Tuesday, December 6th, 2022 at 5:41 AM, Yuan Fu casouri@gmail.com wrote:
> 
> 
> 
> > > > > 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 …)
> > 
> > It depends on your use-case. If you want to be safe you can just apply both properties, then it will work no matter font-lock-mode is on or not.
> > 
> > Yuan
 
I thought the procedure is to enable "font-lock-mode", followed by  
(propertize "G" 'font-lock-face '(:foreground "black")).  Finally disabling "font-lock-mode" in that buffer.







^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2022-12-08 13:00 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-05  6:30 bug#59828: Fundamental Mode buffers fail to keep text properties Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-05  6:32 ` Yuan Fu
2022-12-05  8:30   ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-05 12:46     ` Eli Zaretskii
2022-12-05 13:49       ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-05 14:41         ` Eli Zaretskii
2022-12-05 14:54           ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-05 15:00             ` Eli Zaretskii
2022-12-05 15:06               ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-05 15:40                 ` Eli Zaretskii
2022-12-05 19:23                   ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-05 20:04                     ` Eli Zaretskii
2022-12-05 20:07                     ` Yuan Fu
2022-12-05 20:13                       ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-05 20:25                         ` Yuan Fu
2022-12-05 20:27                         ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-06  5:41                           ` Yuan Fu
2022-12-07  0:53                             ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-08 13:00                               ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors

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.