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: Mon, 02 Apr 2018 22:41:13 +0300 [thread overview]
Message-ID: <877eppv8yu.fsf@mail.linkov.net> (raw)
In-Reply-To: <87vadzwffx.fsf@gmail.com> (Noam Postavsky's message of "Tue, 13 Mar 2018 22:37:06 -0400")
[-- Attachment #1: Type: text/plain, Size: 1162 bytes --]
>>> 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?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: desktop-text-properties.patch --]
[-- Type: text/x-diff, Size: 794 bytes --]
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)
next prev parent reply other threads:[~2018-04-02 19:41 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 [this message]
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
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877eppv8yu.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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).