unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dan Hitt <dan.hitt@gmail.com>
To: Tomas Nordin <tomasn@posteo.net>
Cc: 46507@debbugs.gnu.org
Subject: bug#46507: 26.1; bold attribute copied into enriched-mode text is not saved
Date: Sun, 7 Mar 2021 08:51:26 -0800	[thread overview]
Message-ID: <CAOphizKinRJ=HH=GPyJ9qiQVszG-9jRFAOrxrthwizDKo94oEw@mail.gmail.com> (raw)
In-Reply-To: <87mtvf3zdz.fsf@posteo.net>

[-- Attachment #1: Type: text/plain, Size: 2226 bytes --]

On Sun, Mar 7, 2021 at 4:46 AM Tomas Nordin <tomasn@posteo.net> wrote:

> Hello Dan
>
> Dan Hitt <dan.hitt@gmail.com> writes:
>
> > I am using emacs 26.1 on debian 10.3.
> >
> > The bug is that when you copy bolded-colored text from an eshell buffer
> > into an enriched-text buffer, the bold shows after the copy --- but if
> you
> > then close the enriched-text file, and re-open it, the bolding is gone.
>
> I have no experience with Enriched mode but I read this from [1]:
>
>     Enriched mode is typically used with Text mode (see Text Mode). It
>     is not compatible with Font Lock mode, which is used by many major
>     modes, including most programming language modes, for syntax
>     highlighting (see Font Lock). Unlike Enriched mode, Font Lock mode
>     assigns text properties automatically, based on the current buffer
>     contents; those properties are not saved to disk.
>
> So if the "bolded-colored" text is a font lock thing, it will not be
> saved to disc. Could that be it?
>
> [1]
> https://www.gnu.org/software/emacs/manual/html_node/emacs/Enriched-Text.html#Enriched-Text-1
>
> --
> Tomas
>

Thanks Thomas for your mail.

I think something like that might explain the behavior: i believe that a
command in eshell (or a shell buffer also) gets bolded as a result of
fontlock.

But when the bolded text is copied to the enriched buffer, it stays
bolded, even though there's no font-lock in enriched text.

Presumably the bolded state of the text is visible to elisp---it must just
be some kind of text property.

So, as part of the saving process, enriched-text-mode could certainly
traverse the buffer and note all the places where text is bold and save
those as well as being bold.

It already does something like that because when you manually bold text
(via M-o b), that bolded text is remembered.

And, as an analogy: when the text changes color in eshell --- for example,
the response to a command gets colored orange, that color change is also
due to font-lock.

When the colored text is copied into an enriched-mode buffer, the text
stays orange.  And when the enriched buffer is saved, the orange color gets
saved with it.

So sometimes, at least, enriched saves on a WYSIWYG basis.

dan

[-- Attachment #2: Type: text/html, Size: 3095 bytes --]

  reply	other threads:[~2021-03-07 16:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-14  2:01 bug#46507: 26.1; bold attribute copied into enriched-mode text is not saved Dan Hitt
2021-03-07 12:46 ` Tomas Nordin
2021-03-07 16:51   ` Dan Hitt [this message]
2021-03-07 19:23     ` Tomas Nordin
2021-03-07 19:29       ` Eli Zaretskii
2021-03-07 20:18         ` Dan Hitt
2021-03-08 13:16           ` Eli Zaretskii
2021-03-13 10:28             ` Eli Zaretskii
2021-03-13 18:47               ` Dan Hitt
2021-03-13 19:22                 ` Eli Zaretskii
2021-03-14  7:32                   ` Dan Hitt
2021-03-14  7:50                     ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOphizKinRJ=HH=GPyJ9qiQVszG-9jRFAOrxrthwizDKo94oEw@mail.gmail.com' \
    --to=dan.hitt@gmail.com \
    --cc=46507@debbugs.gnu.org \
    --cc=tomasn@posteo.net \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).