From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thorsten Jolitz Newsgroups: gmane.emacs.help Subject: Re: Is there something between `prin1-to-string' and `princ'? Date: Wed, 25 Sep 2013 16:59:09 +0200 Message-ID: <87txh9rlqa.fsf@gmail.com> References: <87ob7h125c.fsf@informatimago.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1380121184 15185 80.91.229.3 (25 Sep 2013 14:59:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 25 Sep 2013 14:59:44 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Sep 25 16:59:47 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VOqZ7-0006k4-4D for geh-help-gnu-emacs@m.gmane.org; Wed, 25 Sep 2013 16:59:45 +0200 Original-Received: from localhost ([::1]:53209 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOqZ6-0007wS-NG for geh-help-gnu-emacs@m.gmane.org; Wed, 25 Sep 2013 10:59:44 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57164) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOqYp-0007qX-Bi for help-gnu-emacs@gnu.org; Wed, 25 Sep 2013 10:59:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VOqYj-0006AD-Gn for help-gnu-emacs@gnu.org; Wed, 25 Sep 2013 10:59:27 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:33387) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOqYj-0006A1-AI for help-gnu-emacs@gnu.org; Wed, 25 Sep 2013 10:59:21 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VOqYh-0006RI-46 for help-gnu-emacs@gnu.org; Wed, 25 Sep 2013 16:59:19 +0200 Original-Received: from g231232115.adsl.alicedsl.de ([92.231.232.115]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 25 Sep 2013 16:59:19 +0200 Original-Received: from tjolitz by g231232115.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 25 Sep 2013 16:59:19 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 28 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: g231232115.adsl.alicedsl.de User-Agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:A/XXy9MPwFiZ0/F7RenXNVdl05U= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:93569 Archived-At: "Pascal J. Bourguignon" 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