all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#14978: 24.3.50; `savehist-printable' implementation question for strings
@ 2013-07-28 23:37 Drew Adams
  2013-07-31  2:31 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Drew Adams @ 2013-07-28 23:37 UTC (permalink / raw)
  To: 14978

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@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'





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#14978: 24.3.50; `savehist-printable' implementation question for strings
  2013-07-28 23:37 bug#14978: 24.3.50; `savehist-printable' implementation question for strings Drew Adams
@ 2013-07-31  2:31 ` Stefan Monnier
  2013-07-31  4:56   ` Drew Adams
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2013-07-31  2:31 UTC (permalink / raw)
  To: Drew Adams; +Cc: 14978

> 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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#14978: 24.3.50; `savehist-printable' implementation question for strings
  2013-07-31  2:31 ` Stefan Monnier
@ 2013-07-31  4:56   ` Drew Adams
  2013-07-31 13:59     ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Drew Adams @ 2013-07-31  4:56 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 14978

> > 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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#14978: 24.3.50; `savehist-printable' implementation question for strings
  2013-07-31  4:56   ` Drew Adams
@ 2013-07-31 13:59     ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2013-07-31 13:59 UTC (permalink / raw)
  To: Drew Adams; +Cc: 14978

>> > 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





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-07-31 13:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-28 23:37 bug#14978: 24.3.50; `savehist-printable' implementation question for strings Drew Adams
2013-07-31  2:31 ` Stefan Monnier
2013-07-31  4:56   ` Drew Adams
2013-07-31 13:59     ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.