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

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

bug#46507: 26.1; bold attribute copied into enriched-mode text is not sa


From: Dan Hitt
Subject: bug#46507: 26.1; bold attribute copied into enriched-mode text is not saved
Date: Sat, 13 Mar 2021 23:32:51 -0800


On Sat, Mar 13, 2021 at 11:22 AM Eli Zaretskii <eliz@gnu.org> wrote:
> From: Dan Hitt <dan.hitt@gmail.com>
> Date: Sat, 13 Mar 2021 10:47:23 -0800
> Cc: Tomas Nordin <tomasn@posteo.net>, 46507@debbugs.gnu.org
>
> Thanks for your work.

You are welcome.

> The debian system i originally used is unavailable, and i'm using xubuntu 20.04 now, emacs 26.3.
>
> Nevertheless, i would be happy to test if i can.
>
> I guess this means that i have to get a copy of your modified version of enriched.el, and instruct emacs to
> use that instead of /usr/share/emacs/26.3/lisp/textmodes/enriched.elc.
>
> So i need instructions on how to do all this in order to test.

Here's the patch which should fix the issue:

diff --git a/lisp/textmodes/enriched.el b/lisp/textmodes/enriched.el
index c44b69c..e43370c 100644
--- a/lisp/textmodes/enriched.el
+++ b/lisp/textmodes/enriched.el
@@ -389,6 +389,8 @@ enriched-face-ans
         (apply 'append (mapcar 'enriched-face-ans face)))
        ((let* ((fg (face-attribute face :foreground))
                (bg (face-attribute face :background))
+                (weight (face-attribute face :weight))
+                (slant (face-attribute face :slant))
                (props (face-font face t))
                (ans (cdr (format-annotate-single-property-change
                           'face nil props enriched-translations))))
@@ -396,6 +398,10 @@ enriched-face-ans
             (setq ans (cons (list "x-color" fg) ans)))
           (unless (eq bg 'unspecified)
             (setq ans (cons (list "x-bg-color" bg) ans)))
+           (if (eq weight 'bold)
+               (setq ans (cons (list "bold") ans)))
+           (if (eq slant 'italic)
+               (setq ans (cons (list "italic") ans)))
           ans))))

 ;;;

Thanks Eli!

For the sake of anybody who stumbles across this thread, i tested it by uncompressing  /usr/share/emacs/26.3/lisp/textmodes/enriched.el.gz into a new empty directory.

Then i hand-patched in the diffs (i.e., i patched it by cut-and-paste, using emacs, not using any program that understands diffs).

Then i ran 'emacs -Q', and did M-x load-file to load in the modified enriched.el file.

Then i did the test: copying in chunks of text from eshell and shell, setting the mode to enriched, saving, closing, and reopening, and it worked in all cases.

Presumably what will happen next is that this fix eventually gets pushed out and adopted by debian and ubuntu and whoever else is downstream, but in the meantime i can just the modified enriched.el.

Thanks again for figuring out how to fix it.

dan

reply via email to

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