From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dan Hitt Newsgroups: gmane.emacs.bugs Subject: bug#46507: 26.1; bold attribute copied into enriched-mode text is not saved Date: Sat, 13 Mar 2021 23:32:51 -0800 Message-ID: References: <87mtvf3zdz.fsf@posteo.net> <87blbu4vl2.fsf@posteo.net> <83y2eysqyr.fsf@gnu.org> <83sg55ss4o.fsf@gnu.org> <83y2eribyt.fsf@gnu.org> <83zgz6hn9g.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000b8e2af05bd7a2410" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6740"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Tomas Nordin , 46507@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 14 08:34:21 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lLLGW-0001cb-5b for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 14 Mar 2021 08:34:20 +0100 Original-Received: from localhost ([::1]:41930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLLGV-00007q-1j for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 14 Mar 2021 03:34:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52394) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLLGF-00007e-Lv for bug-gnu-emacs@gnu.org; Sun, 14 Mar 2021 03:34:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49568) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lLLGD-0005Ze-S2 for bug-gnu-emacs@gnu.org; Sun, 14 Mar 2021 03:34:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lLLGD-0000FX-PR for bug-gnu-emacs@gnu.org; Sun, 14 Mar 2021 03:34:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dan Hitt Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 Mar 2021 07:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46507 X-GNU-PR-Package: emacs Original-Received: via spool by 46507-submit@debbugs.gnu.org id=B46507.1615707194907 (code B ref 46507); Sun, 14 Mar 2021 07:34:01 +0000 Original-Received: (at 46507) by debbugs.gnu.org; 14 Mar 2021 07:33:14 +0000 Original-Received: from localhost ([127.0.0.1]:32881 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lLLFS-0000EZ-7K for submit@debbugs.gnu.org; Sun, 14 Mar 2021 03:33:14 -0400 Original-Received: from mail-wr1-f50.google.com ([209.85.221.50]:34876) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lLLFN-0000EE-5o for 46507@debbugs.gnu.org; Sun, 14 Mar 2021 03:33:12 -0400 Original-Received: by mail-wr1-f50.google.com with SMTP id l12so7025881wry.2 for <46507@debbugs.gnu.org>; Sat, 13 Mar 2021 23:33:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=02a+cxKd87om5a2UpzmQdy83CPlgBxWf5UDCbu8PHk0=; b=XRqFURG53O2CXsX8Kv3AvdKNH+dOdOcC11EXihn9sZcoBA2gyIJIiZZgo5XgwbNVF7 /04uyyeuhzUpy7MipAc/k4kRhF6A9X33F/M4L3hAY47X4NA4S2gnU8uHgTmKk3sVcKnL D+LRF8ILZ7T9zD/oqIHKyB47lfzmYbXbbWJVdumiAyVAe2OvPe+t2L91TkuiLuDZ51Tj nHiBkTxgPzmfQ2xo/rmGEFR7k18S2lUM3U36q39JqiTeBP9uGRgzTFC6FTP10xJOApja eNypfV9kbafJ6Denk5MBBYd/uaYSKjcGSbexXlANaOg9oDG28dsxTuAPRfe5kCGcDNtf pILg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=02a+cxKd87om5a2UpzmQdy83CPlgBxWf5UDCbu8PHk0=; b=dJQ5lCzIA7bZDcjzUGSIZcWi/gFYrGx9vZuV46WHceu/VghZiKI4xR+IRbZfJp95uU 0tXBKbsnKDrYvYeA+9zSTrDtccDIKtqEVMZsQm0KSx016PXUSphTsgsyKnd/zFSJeZ/1 EYUi/IFU7cGQ3ZbmjoC0O+eltJbyDQ+15QorB2hrzERXlahscyZLBiwhhnMWzhIypCyH Kalpm7qYZlSDFR4qENpP81qmBVKyZq9v+VOG5r4cVuFVW2DeE+gIivkOpCZcvn6lbGaG dnQTlF5ZJsFUeyTBmP+qAxQEHjIjegCuR9uVmKVhtAmDdZIbIiR7C01+mPw/QqwMxzRa doLQ== X-Gm-Message-State: AOAM532F1tuJ7AEfPdMvn2oiS1InFAelQrFQr52kE4Aj0uu6HSPXBNzi hYe51Ke5cm7HgPUubEJnfEuI63qd0ilkR1tzLxA= X-Google-Smtp-Source: ABdhPJyJcn0nKPKsMDiL2qfUQydiIp09ZwKX3u1JOdtMTfCiMu7RVhe3kDgy7U8Eol+IplpQDe4fTwNtooCdmtnCJMk= X-Received: by 2002:a5d:4f0e:: with SMTP id c14mr21330921wru.78.1615707183308; Sat, 13 Mar 2021 23:33:03 -0800 (PST) In-Reply-To: <83zgz6hn9g.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:202341 Archived-At: --000000000000b8e2af05bd7a2410 Content-Type: text/plain; charset="UTF-8" On Sat, Mar 13, 2021 at 11:22 AM Eli Zaretskii wrote: > > From: Dan Hitt > > Date: Sat, 13 Mar 2021 10:47:23 -0800 > > Cc: Tomas Nordin , 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 --000000000000b8e2af05bd7a2410 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Sat, Mar 13, 2021 at 11:22 AM Eli Zare= tskii <eliz@gnu.org> wrote:
> From: Dan Hitt &= lt;dan.hitt@gmail.c= om>
> 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
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(apply 'append (mapcar 'enriched-= face-ans face)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ((let* ((fg (face-attribute face :foreground))<= br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (bg (face-attribute= face :background))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (weight (face-attr= ibute face :weight))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (slant (face-attri= bute face :slant))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (props (face-font f= ace t))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (ans (cdr (format-a= nnotate-single-property-change
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0'face nil props enriched-translations))))
@@ -396,6 +398,10 @@ enriched-face-ans
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq ans (cons (list "= ;x-color" fg) ans)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(unless (eq bg 'unspecified) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq ans (cons (list "= ;x-bg-color" bg) ans)))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if (eq weight 'bold)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq ans (cons (li= st "bold") ans)))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if (eq slant 'italic)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq ans (cons (li= st "italic") ans)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ans))))

=C2=A0;;;

Thanks Eli!

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

Then i hand-pat= ched in the diffs (i.e., i patched it by cut-and-paste, using emacs, not us= ing any program that=C2=A0understands diffs).

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

Then i did the test: copying in ch= unks of text from eshell and shell, setting the mode to enriched, saving, c= losing, and reopening, and it worked in all cases.

Presumably what will happen next is that this fix eventually gets pushed o= ut 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
--000000000000b8e2af05bd7a2410--