GNU bug report logs - #14978
24.3.50; `savehist-printable' implementation question for strings

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Sun, 28 Jul 2013 23:38:02 UTC

Severity: minor

Found in version 24.3.50

Done: Drew Adams <drew.adams <at> oracle.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 14978 in the body.
You can then email your comments to 14978 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#14978; Package emacs. (Sun, 28 Jul 2013 23:38:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Drew Adams <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 28 Jul 2013 23:38:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; `savehist-printable' implementation question for strings
Date: Sun, 28 Jul 2013 16:37:10 -0700 (PDT)
The code does this:

;; String without properties
((and (stringp value)
      (equal-including-properties value (substring-no-properties value))))

1. Doesn't this do the same thing as that `equal-including-properties'
   test:

   (and (null (text-properties-at 0 value))
        (= 0 (next-property-change 0 value)))

   If it does do the same thing, is it more efficient or less?

   (The reason I ask whether it does the same thing is for use in an
   older Emacs release where the functions in the original test are
   not available.)

2. Is it really necessary to exclude all text properties from a printed
   string in order for it to be Lisp-readable?  If not, can we improve
   this code so it is not unnecessarily restrictive?

I'm guessing that for #2 the answer is yes, it is necessary, because a
text property can have any Lisp value, including a circular list value,
but it's not clear to me what the problems are.


In GNU Emacs 24.3.50.1 (i686-pc-mingw32)
 of 2013-07-21 on ODIEONE
Bzr revision: 113485 lekktu <at> gmail.com-20130722012547-e3b7qxn1dba5vf20
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/Devel/emacs/binary --enable-checking=yes,glyphs
 CFLAGS=-O0 -g3 LDFLAGS=-Lc:/Devel/emacs/lib
 CPPFLAGS=-Ic:/Devel/emacs/include'




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14978; Package emacs. (Wed, 31 Jul 2013 02:32:02 GMT) Full text and rfc822 format available.

Message #8 received at 14978 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 14978 <at> debbugs.gnu.org
Subject: Re: bug#14978: 24.3.50;
 `savehist-printable' implementation question for strings
Date: Tue, 30 Jul 2013 22:31:17 -0400
> 1. Doesn't this do the same thing as that `equal-including-properties'
>    test:

>    (and (null (text-properties-at 0 value))
>         (= 0 (next-property-change 0 value)))

I think so, yes.

>    If it does do the same thing, is it more efficient or less?

Yours might be more efficient because it avoids memory allocation.
But they probably each are more efficient in some circumstances.

> 2. Is it really necessary to exclude all text properties from a printed
>    string in order for it to be Lisp-readable?  If not, can we improve
>    this code so it is not unnecessarily restrictive?

You'd have to make sure all the properties are themselves readable.

> I'm guessing that for #2 the answer is yes, it is necessary, because a
> text property can have any Lisp value,

That's right.

> including a circular list value,

Actually circular values should be handled fine; problems come when you
bump into objects like markers, buffers, windows, processes, ...


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14978; Package emacs. (Wed, 31 Jul 2013 04:57:02 GMT) Full text and rfc822 format available.

Message #11 received at 14978 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 14978 <at> debbugs.gnu.org
Subject: RE: bug#14978: 24.3.50; `savehist-printable' implementation question
 for strings
Date: Tue, 30 Jul 2013 21:56:15 -0700 (PDT)
> > including a circular list value,
> 
> Actually circular values should be handled fine

Yes, but only if you bind (or set) `read-circle' to non-nil when
reading, no?

Anyway, thanks for confirming my guesses.  I have closed the bug.




bug closed, send any further explanations to 14978 <at> debbugs.gnu.org and Drew Adams <drew.adams <at> oracle.com> Request was from Drew Adams <drew.adams <at> oracle.com> to control <at> debbugs.gnu.org. (Wed, 31 Jul 2013 05:02:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14978; Package emacs. (Wed, 31 Jul 2013 14:00:04 GMT) Full text and rfc822 format available.

Message #16 received at 14978 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 14978 <at> debbugs.gnu.org
Subject: Re: bug#14978: 24.3.50;
 `savehist-printable' implementation question for strings
Date: Wed, 31 Jul 2013 09:59:03 -0400
>> > including a circular list value,
>> Actually circular values should be handled fine
> Yes, but only if you bind (or set) `read-circle' to non-nil when
> reading, no?

That's right, except that it's non-nil by default.  So it works unless
you bind it to nil.


        Stefan




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 29 Aug 2013 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 17 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.