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: Sun, 08 Apr 2018 23:13:13 +0300 Organization: LINKOV.NET Message-ID: <87tvslpszy.fsf@mail.linkov.net> References: <87k1uhnehk.fsf@mail.linkov.net> <87o9jsydtz.fsf@gmail.com> <877eqfabjv.fsf@mail.linkov.net> <87vadzwffx.fsf@gmail.com> <877eppv8yu.fsf@mail.linkov.net> <87370dp9eu.fsf@gmail.com> <87efjw59tp.fsf@mail.linkov.net> <87po3gne5d.fsf@gmail.com> <878ta2zqpt.fsf@mail.linkov.net> <877epjnozr.fsf@gmail.com> <87o9iuzqvi.fsf@mail.linkov.net> <87zi2emphv.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1523218450 31892 195.159.176.226 (8 Apr 2018 20:14:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 8 Apr 2018 20:14:10 +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 Sun Apr 08 22:14:06 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 1f5GhR-0008BL-W2 for geb-bug-gnu-emacs@m.gmane.org; Sun, 08 Apr 2018 22:14:06 +0200 Original-Received: from localhost ([::1]:52926 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5GjX-0004li-OR for geb-bug-gnu-emacs@m.gmane.org; Sun, 08 Apr 2018 16:16:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52354) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5GjM-0004k1-1u for bug-gnu-emacs@gnu.org; Sun, 08 Apr 2018 16:16:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5GjK-0001DS-U2 for bug-gnu-emacs@gnu.org; Sun, 08 Apr 2018 16:16:04 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34959) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f5GjK-0001DF-P0 for bug-gnu-emacs@gnu.org; Sun, 08 Apr 2018 16:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1f5GjK-0002Nk-Ce for bug-gnu-emacs@gnu.org; Sun, 08 Apr 2018 16:16: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: Sun, 08 Apr 2018 20:16: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.15232185189102 (code B ref 30786); Sun, 08 Apr 2018 20:16:02 +0000 Original-Received: (at 30786) by debbugs.gnu.org; 8 Apr 2018 20:15:18 +0000 Original-Received: from localhost ([127.0.0.1]:42856 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f5Gic-0002Mk-AP for submit@debbugs.gnu.org; Sun, 08 Apr 2018 16:15:18 -0400 Original-Received: from sub3.mail.dreamhost.com ([69.163.253.7]:46737 helo=homiemail-a11.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f5Gia-0002Mc-ML for 30786@debbugs.gnu.org; Sun, 08 Apr 2018 16:15:17 -0400 Original-Received: from homiemail-a11.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a11.g.dreamhost.com (Postfix) with ESMTP id D4CE3314C06D; Sun, 8 Apr 2018 13:15:15 -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 B835F314C069; Sun, 8 Apr 2018 13:15:14 -0700 (PDT) In-Reply-To: <87zi2emphv.fsf@gmail.com> (Noam Postavsky's message of "Sat, 07 Apr 2018 21:54:52 -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:145032 Archived-At: >>>>>>>> + ;; 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 >>>> =E2=80=98desktop-file-version=E2=80=99 doing this every time when su= pport 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 o= f >>> desktop-file-version, right? >> >> This won't help for the counterexample that you demonstrated earlier w= ith >> (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.