[Top][All Lists]

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

"push" creating circular objects

From: Charles Sebold
Subject: "push" creating circular objects
Date: Wed, 20 Aug 2008 08:25:09 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (windows-nt)

This is killing me.

I'm running GNU Emacs 22.2.1 (i386-mingw-nt5.1.2600), the one that's
distributed from the FSF website.  I've also verified this with 21.3,
21.4, and 22.1 from Debian sarge, etch, and lenny.  I've done this with
"-q -no-site-file".

Here's the code in question:

(defun Textile-list-context (textile-list-tag)
  "Return list of HTML tags corresponding to list context (ol, ul)."
  (let ((my-list nil))
    (dolist (this-tag (delete "" (split-string textile-list-tag "")))
       ((string= this-tag "#")
        (push "ol" my-list))
       ((string= this-tag "*")
        (push "ul" my-list))))

What gets passed in is a string, like "** ", and the function ought to
iterate through each character, cons an "ol" onto my-list for "#"
characters or a "ul" for "*" characters, ignore everything else, and
return my-list when it's done.

In the scratch buffer, it works.  In my program, it creates a circular
list, represented as (#1="ul" #1#) as I edebug this.

Why is it doing that?  Bypassing the push macro and using something like
(setq my-list (cons "ol" my-list)) doesn't help.  And I can't figure out
why I can't get it to do this from the scratch buffer with what appears
to be the same string.  The Edebug output looks identical, until the
second push of "ul" onto the list, at which point it becomes circular.
Charles Sebold                                      20th of August, 2008

reply via email to

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