all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Noam Postavsky <npostavs@gmail.com>
Cc: 30786@debbugs.gnu.org
Subject: bug#30786: Save text properties in desktop
Date: Wed, 04 Apr 2018 23:01:02 +0300	[thread overview]
Message-ID: <878ta2zqpt.fsf@mail.linkov.net> (raw)
In-Reply-To: <87po3gne5d.fsf@gmail.com> (Noam Postavsky's message of "Tue, 03 Apr 2018 18:01:02 -0400")

>>>> 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.





  reply	other threads:[~2018-04-04 20:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-12 21:57 bug#30786: Save text properties in desktop Juri Linkov
2018-03-13  1:16 ` Noam Postavsky
2018-03-13 21:52   ` Juri Linkov
2018-03-14  1:09     ` Drew Adams
2018-03-14  2:37       ` Noam Postavsky
2018-03-14 20:09         ` Drew Adams
2018-04-02 19:41         ` Juri Linkov
2018-04-02 21:48           ` Noam Postavsky
2018-04-03 20:11             ` Juri Linkov
2018-04-03 22:01               ` Noam Postavsky
2018-04-04 20:01                 ` Juri Linkov [this message]
2018-04-07 13:08                   ` Noam Postavsky
2018-04-07 20:46                     ` Juri Linkov
2018-04-08  1:54                       ` Noam Postavsky
2018-04-08 20:13                         ` Juri Linkov
2018-04-19 20:32                           ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878ta2zqpt.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=30786@debbugs.gnu.org \
    --cc=npostavs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.