[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "push" creating circular objects
From: |
weber |
Subject: |
Re: "push" creating circular objects |
Date: |
Wed, 20 Aug 2008 14:47:12 -0700 (PDT) |
User-agent: |
G2/1.0 |
On Aug 20, 4:07 pm, Charles Sebold <cseb...@gmail.com> wrote:
> On 20 Aug 2008, Charles Sebold wrote:
>
> > I just changed it from push to append, with no change in behavior:
>
> Now I tried something even more radical, a completely different approach
> to the problem, just to see what happens.
>
> (defun Textile-list-context (textile-list-tag)
> "Return list of HTML tags corresponding to list context (ol, ul)."
> (let ((my-list (delete " " (delete "" (split-string textile-list-tag "")))))
> (mapcar (lambda (x)
> (cond
> ((string= x "#")
> "ol")
> ((string= x "*")
> "ul")
> (t
> nil))) my-list)))
>
> _It still returns a circular list._
>
> And it still does the right thing, when I call it from a scratch buffer.
>
> Clearly there is something deep about lists that I don't get right now.
> --
> Charles Sebold 20th of August, 2008
It works for me on the scratch. As a sidenot, this is how I normally
write these things:
(defun Textile-list-context (str)
(let ((my-list nil))
(with-temp-buffer
(insert str)
(goto-char (point-min))
(while (not (eobp))
(cond
((looking-at "#")
(push "ol" my-list))
((looking-at "\*")
(push "ul" my-list)))
(forward-char 1)))
my-list))
HTH,
hugo
Re: "push" creating circular objects, John Paul Wallington, 2008/08/21