unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Thorsten Jolitz <tjolitz@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Is there something between `prin1-to-string' and `princ'?
Date: Wed, 25 Sep 2013 16:59:09 +0200	[thread overview]
Message-ID: <87txh9rlqa.fsf@gmail.com> (raw)
In-Reply-To: 87ob7h125c.fsf@informatimago.com

"Pascal J. Bourguignon" <pjb@informatimago.com> 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




  parent reply	other threads:[~2013-09-25 14:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.2838.1380105265.10748.help-gnu-emacs@gnu.org>
2013-09-25 13:06 ` Is there something between `prin1-to-string' and `princ'? Pascal J. Bourguignon
2013-09-25 13:23   ` Thorsten Jolitz
2013-09-25 14:59   ` Thorsten Jolitz [this message]
2013-09-25 10:33 Thorsten Jolitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87txh9rlqa.fsf@gmail.com \
    --to=tjolitz@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).