From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#30786: Save text properties in desktop Date: Tue, 03 Apr 2018 18:01:02 -0400 Message-ID: <87po3gne5d.fsf@gmail.com> 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> 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 1522792812 12458 195.159.176.226 (3 Apr 2018 22:00:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 3 Apr 2018 22:00:12 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) Cc: 30786@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Apr 04 00:00: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 1f3TyH-00036n-Pg for geb-bug-gnu-emacs@m.gmane.org; Wed, 04 Apr 2018 00:00:06 +0200 Original-Received: from localhost ([::1]:39337 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f3U0N-0002OV-4s for geb-bug-gnu-emacs@m.gmane.org; Tue, 03 Apr 2018 18:02:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47501) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f3U0F-0002Ni-5a for bug-gnu-emacs@gnu.org; Tue, 03 Apr 2018 18:02:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f3U0B-0007Dh-1G for bug-gnu-emacs@gnu.org; Tue, 03 Apr 2018 18:02:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:57753) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f3U0A-0007DZ-Sz for bug-gnu-emacs@gnu.org; Tue, 03 Apr 2018 18:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1f3U0A-0003EV-Ca for bug-gnu-emacs@gnu.org; Tue, 03 Apr 2018 18:02:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 03 Apr 2018 22:02: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.152279287112369 (code B ref 30786); Tue, 03 Apr 2018 22:02:02 +0000 Original-Received: (at 30786) by debbugs.gnu.org; 3 Apr 2018 22:01:11 +0000 Original-Received: from localhost ([127.0.0.1]:37417 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f3TzL-0003DR-9h for submit@debbugs.gnu.org; Tue, 03 Apr 2018 18:01:11 -0400 Original-Received: from mail-it0-f47.google.com ([209.85.214.47]:50946) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f3TzK-0003DE-3K for 30786@debbugs.gnu.org; Tue, 03 Apr 2018 18:01:10 -0400 Original-Received: by mail-it0-f47.google.com with SMTP id r19-v6so25393898itc.0 for <30786@debbugs.gnu.org>; Tue, 03 Apr 2018 15:01:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=nHzOMnR4K+h0Nub5uCNY/N2vW/hVp0EGfqBAmQlwT/U=; b=lK0K4m7LaT9WXYaVoK+QH8fFquOAqkyw+pvq+KpIVh5+ObyuTlb422uCx8MYL5WQQZ RCpHY2CdksBuw6wOs1cyGWqxu9Zchw4Pi2v6tdnZepXquZl78pdBSH2xqX6m6v87I0iU z0Y2KsHj4vuCVGdG8pgjnhvmTws/sFqg5gq+ah8cMzh2WSO1lp1w52LPXqjxYDmQdotZ ieOaM/l2wxli+dUE+bPa5Si2hx9fZXVN1kluKdhIN6HNl9qSP2oSiS/DwBRPENiJadgk jsPWBGiZCbyNy6yLncuMowfcHBGuhbhRMBk/m5mGrzlVNfWNI4RDjOB9t4br5cYqgQfM SeOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=nHzOMnR4K+h0Nub5uCNY/N2vW/hVp0EGfqBAmQlwT/U=; b=Yug533f+LkQBhat4MBUaH04++7Ae6oBcqP+XXzEw+0QrdI7+QdRBpYEcmZNutyv3a/ ArUozIrhAE+lqyN8myc7otvUMyxH1lAe7A+HG3blpppLdkhDY7y54R6GlbMvNBiwy676 eFHlpXYrLT9XVE0m/HzMj26k9uXXnfIiVf6HqB8qb64KZTT17WkJYGfGMEIlvajzUBcH mLdkuR4kRJVYEHN0rRCbWynolWH8Pc0C7Ggxt3nZh9ZFfyVorDmUoPeJC4cKvIdOfzqy 0CscpdiAgEH/meBwChr5+rhq5r4g0GAINR1kO38U/5IAVCFNEhwCrYkcJb4jx9qFIx2S mJDw== X-Gm-Message-State: ALQs6tAPlYuDUEgVuDOk+6Twciabp+fnlM60gqOUPsc4jftbifwKjYet jnyv1+qqfsZBEsIi++vIAKM= X-Google-Smtp-Source: AIpwx495rJ/W1Wn7lX/lVvxOYCcnsHLGuqMHlDCXIYMZzqGmlVL5OSoEUybsvR8VKnyBhVn92Ip7dg== X-Received: by 2002:a24:39c8:: with SMTP id l191-v6mr6870084ita.81.1522792864506; Tue, 03 Apr 2018 15:01:04 -0700 (PDT) Original-Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id s142-v6sm1030423itb.4.2018.04.03.15.01.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Apr 2018 15:01:03 -0700 (PDT) In-Reply-To: <87efjw59tp.fsf@mail.linkov.net> (Juri Linkov's message of "Tue, 03 Apr 2018 23:11:46 +0300") 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:144870 Archived-At: Juri Linkov writes: >>> 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 =E2=80=98#("foo" 0 3 (bar 42))=E2=80=99 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)) ;=3D> (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.