help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Is there something between `prin1-to-string' and `princ'?


From: Thorsten Jolitz
Subject: Re: Is there something between `prin1-to-string' and `princ'?
Date: Wed, 25 Sep 2013 16:59:09 +0200
User-agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux)

"Pascal J. Bourguignon" <address@hidden> writes:

> (defun sexp-remove-string-properties (sexp)
>    (cond
>       ((stringp sexp) (substring-no-properties sexp))
>       ((atom sexp) sexp)
>       (t (cons (sexp-remove-string-properties (car sexp))
>                (sexp-remove-string-properties (cdr sexp))))))
>
> (prin1-to-string
>   (sexp-remove-string-properties    
>     '(:category "tmp2" :title (#("C2 " 0 3 (:parent nil))))))
> --> "(:category \"tmp2\" :title (\"C2 \"))"

A classic solution, but - unfortunately - applied to a (not even very
big) real world Org-mode parse-tree the debugger is entered immediately
(without showing a backtrace really). I think recursion becomes to deep
and max number of allowed symbols is exceeded rapidly.

Although this asks for a recursive solution, I would need one that works
on really big sexp's (like parse-trees of moderate to big .org files). 

Is that possible, or do I de facto need some kind of iterative solution
here for the real world? 

-- 
cheers,
Thorsten




reply via email to

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