[Top][All Lists]

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

bug#30786: Save text properties in desktop

From: Juri Linkov
Subject: bug#30786: Save text properties in desktop
Date: Sun, 08 Apr 2018 23:13:13 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

>>>>>>>> +     ;; 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))))
>>>> 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.
>>> You would also have to strip text properties according to the value of
>>> desktop-file-version, right?
>> This won't help for the counterexample that you demonstrated earlier with
>> (put-text-property 1 2 'foo (point-marker)).  Whereas this patch does.
> Sorry, I don't think I explained my point very well above.
> Using `read' to check readability can only test which objects are
> readable in the current Emacs version.  So if we rely on that, then we
> can only reliably produce desktop files compatible with the current
> version.  Which means the only thing that desktop-file-version helps
> with is giving a slightly better error message, yes?
> (I don't think this is necessarily a deal-breaker, as long as it's well
> documented)

Yes, just better error handling (like what in bug#24982 was asked to do),
nothing more, so it's not a deal-breaker.

Currently I see no better way than in the aforementioned patch.
At least it provides 100% guarantee of readability of the desktop file
in the same version that wrote it.

But earlier versions will have an incompatibility problem anyway.
Let's suppose that Emacs 27 will support reading point-markers and writes
them to the desktop file for good.  Then naturally Emacs 26 will fail
to read such desktop files either way: explicitly by comparing
version numbers, or implicitly by inability to parse the new syntax.

reply via email to

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