GNU bug report logs - #30786
Save text properties in desktop

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Mon, 12 Mar 2018 22:00:02 UTC

Severity: normal

Fixed in version 27.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


Message #23 received at 30786 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 30786 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#30786: Save text properties in desktop
Date: Mon, 02 Apr 2018 22:41:13 +0300
[Message part 1 (text/plain, inline)]
>>> If the only problem is with non-readable property values then we could
>>> check for such values and not to write them to the desktop file.
>>>
>>> > Maybe solving Bug#24982 would help?

There is also bug#17090.

>>> This would help on reading the desktop, but maybe better not to save
>>> non-readable values in the first place.
>>
>> No.  If the problem is reading then that's where the solution
>> should be located - not writing.  It has happened quite a few
>> times that something unreadable by Emacs has later become
>> readable.
>
> You mean the print syntax changes to become readable?  But not that
> Emacs can later read some unreadable #<...> syntax, right?

Even when the print syntax becomes readable in later versions, we still
can't write such syntax because earlier Emacs versions should be able
to read the same desktop file.

> That could be useful in general, but solving this particular bug by
> avoiding writing unreadable objects as Juri suggests seems okay too (and
> much less work, hence more likely to actually happen instead of just
> sitting for years).

Do you think this patch covers all possible unreadable cases on writing?

[desktop-text-properties.patch (text/x-diff, inline)]
diff --git a/lisp/desktop.el b/lisp/desktop.el
index 55ec71c..4f98658 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -841,10 +841,12 @@ desktop--v2s
     ((or (numberp value) (null value) (eq t value) (keywordp value))
      (cons 'may value))
     ((stringp value)
-     (let ((copy (copy-sequence value)))
-       (set-text-properties 0 (length copy) nil copy)
-       ;; Get rid of text properties because we cannot read them.
-       (cons 'may copy)))
+     ;; Get rid of unreadable text properties.
+     (if (ignore-errors (read (format "%S" value)))
+         (cons 'may value)
+       (let ((copy (copy-sequence value)))
+         (set-text-properties 0 (length copy) nil copy)
+         (cons 'may copy))))
     ((symbolp value)
      (cons 'must value))
     ((vectorp value)

This bug report was last modified 7 years and 33 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.