GNU bug report logs -
#30786
Save text properties in desktop
Previous Next
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
View this message in rfc822 format
>>>> Do you think this patch covers all possible unreadable cases on writing?
>>>>
>>>> + ;; 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))))
>>>
>>> I think it won't cover the case where an object's print syntax is only
>>> readable by the current Emacs version, and not an earlier one. To
>>> handle that you'll need to call desktop--v2s recursively, like in the
>>> vectorp and consp branches.
>>
>> I don't understand how calling desktop--v2s recursively will ensure its
>> readability in earlier versions? For example, if Emacs 27 will write to
>> the desktop file ‘#("foo" 0 3 (bar 42))’ how Emacs 19 can read it?
>
> Ah, I wasn't thinking of the #(...) specifically, rather about the
> values of text properties, e.g.,
>
> (cl-defstruct foo f1 f2)
> (desktop--v2s (make-foo :f1 1 :f2 2)) ;=> (may . "Unprintable entity")
>
> So desktop--v2s considers structs as unprintable, unlike read, hence
> using desktop--v2s recursively instead of read will catch properties
> that would otherwise be unreadable in Emacs 25.
>
> If we want to support Emacs versions that don't even know about #(...)
> then we can't write string properties at all, I guess.
If we can afford continuing incrementing the desktop file version in
‘desktop-file-version’ doing this every time when support for reading more
syntaxes is added, thus preventing incompatibilities, then the patch above
would be the most reliable solution.
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.