emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: display property strangeness


From: Nick Roberts
Subject: Re: display property strangeness
Date: Mon, 14 Mar 2005 02:17:23 +1300

 > > (defun foo ()
 > >   (interactive)
 > >   (let ((pos '(1 2 3)))
 > >     (while pos
 > >       (put-text-property (car pos) (1+ (car pos)) 'display "A")
 > >       (setq pos (cdr pos)))))
 > >
 > > (defun bar ()
 > >   (interactive)
 > >   (progn (put-text-property 1 2 'display "A")
 > >          (put-text-property 2 3 'display "A")
 > >          (put-text-property 3 4 'display "A")))
 > 
 > 
 > In the former case all display properites are the same (`eq') string.
 > In the latter case there are three different (`equal') strings.

You may be right, in that the Lisp interpreter regards "A" to be the same
object in the first function.  What right does it have to do this, though?
The predicate eq determines if two lisp objects are the same, but the value of
the display property here is a string constant. I'm probably out of my depth
here, but I would call that a bug in the interpreter.

If I do something similar with dotimes I get a different result (possibly
because dotimes is a macro):

(setq fred "fred")
"fred"

(dotimes (i 4)
 (store-substring fred i "a"))
nil

fred
"aaaa"

(eq (substring fred 0 1) (substring fred 1 2))
nil

Nick




reply via email to

[Prev in Thread] Current Thread [Next in Thread]