all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: Heime <heimeborgia@protonmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>, 59828-done@debbugs.gnu.org
Subject: bug#59828: Fundamental Mode buffers fail to keep text properties
Date: Mon, 5 Dec 2022 12:25:55 -0800	[thread overview]
Message-ID: <BC02D1B2-0B7A-47CD-85F3-BD445A6D008A@gmail.com> (raw)
In-Reply-To: <XRwRl1eTXItBm3zLl5VmmTywNIeflmtf_Dh4pFuc1K6-5VpUlW_gRtbLLkooV1RPqZxBrUkHR2e5if_sx2Rg9rIUJItNzYimepbp_Ztd0TM=@protonmail.com>



> 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




  reply	other threads:[~2022-12-05 20:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=BC02D1B2-0B7A-47CD-85F3-BD445A6D008A@gmail.com \
    --to=casouri@gmail.com \
    --cc=59828-done@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=heimeborgia@protonmail.com \
    /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.