From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#30786: Save text properties in desktop Date: Mon, 02 Apr 2018 22:41:13 +0300 Organization: LINKOV.NET Message-ID: <877eppv8yu.fsf@mail.linkov.net> References: <87k1uhnehk.fsf@mail.linkov.net> <87o9jsydtz.fsf@gmail.com> <877eqfabjv.fsf@mail.linkov.net> <87vadzwffx.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1522698855 9410 195.159.176.226 (2 Apr 2018 19:54:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 2 Apr 2018 19:54:15 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 30786@debbugs.gnu.org To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Apr 02 21:54:10 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f35Ws-0002LB-DX for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Apr 2018 21:54:10 +0200 Original-Received: from localhost ([::1]:59406 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f35Yw-00019T-7S for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Apr 2018 15:56:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34034) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f35Yj-000184-8F for bug-gnu-emacs@gnu.org; Mon, 02 Apr 2018 15:56:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f35Yh-00069I-0S for bug-gnu-emacs@gnu.org; Mon, 02 Apr 2018 15:56:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55763) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f35Yg-00068c-Jl for bug-gnu-emacs@gnu.org; Mon, 02 Apr 2018 15:56:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1f35Yg-0003ml-AS for bug-gnu-emacs@gnu.org; Mon, 02 Apr 2018 15:56:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Apr 2018 19:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30786 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 30786-submit@debbugs.gnu.org id=B30786.152269894714518 (code B ref 30786); Mon, 02 Apr 2018 19:56:02 +0000 Original-Received: (at 30786) by debbugs.gnu.org; 2 Apr 2018 19:55:47 +0000 Original-Received: from localhost ([127.0.0.1]:35425 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f35YQ-0003m5-U5 for submit@debbugs.gnu.org; Mon, 02 Apr 2018 15:55:47 -0400 Original-Received: from sub3.mail.dreamhost.com ([69.163.253.7]:36410 helo=homiemail-a11.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f35YP-0003lx-5o for 30786@debbugs.gnu.org; Mon, 02 Apr 2018 15:55:45 -0400 Original-Received: from homiemail-a11.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a11.g.dreamhost.com (Postfix) with ESMTP id 95F51314C069; Mon, 2 Apr 2018 12:55:44 -0700 (PDT) Original-Received: from localhost.linkov.net (m91-129-105-236.cust.tele2.ee [91.129.105.236]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by homiemail-a11.g.dreamhost.com (Postfix) with ESMTPSA id 7BE04314C066; Mon, 2 Apr 2018 12:55:43 -0700 (PDT) In-Reply-To: <87vadzwffx.fsf@gmail.com> (Noam Postavsky's message of "Tue, 13 Mar 2018 22:37:06 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:144803 Archived-At: --=-=-= Content-Type: text/plain >>> 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? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=desktop-text-properties.patch 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) --=-=-=--