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: `print' inside Emacs vs `print' to stdout (with Emacsclient) Date: Wed, 23 Oct 2013 12:24:40 +0200 Message-ID: <87zjq01dzr.fsf@gmail.com> References: <87vc0o2zrf.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1382523918 17824 80.91.229.3 (23 Oct 2013 10:25:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 23 Oct 2013 10:25:18 +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 Oct 23 12:25:22 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 1VYvcw-0003Zo-2E for geh-help-gnu-emacs@m.gmane.org; Wed, 23 Oct 2013 12:25:22 +0200 Original-Received: from localhost ([::1]:48578 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VYvcv-0002sl-Kf for geh-help-gnu-emacs@m.gmane.org; Wed, 23 Oct 2013 06:25:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34716) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VYvcc-0002nw-UT for help-gnu-emacs@gnu.org; Wed, 23 Oct 2013 06:25:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VYvcU-0007Qz-EC for help-gnu-emacs@gnu.org; Wed, 23 Oct 2013 06:25:02 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:56136) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VYvcU-0007Qu-32 for help-gnu-emacs@gnu.org; Wed, 23 Oct 2013 06:24:54 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VYvcS-0003HU-Fq for help-gnu-emacs@gnu.org; Wed, 23 Oct 2013 12:24:52 +0200 Original-Received: from e178191122.adsl.alicedsl.de ([85.178.191.122]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 23 Oct 2013 12:24:52 +0200 Original-Received: from tjolitz by e178191122.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 23 Oct 2013 12:24:52 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 112 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: e178191122.adsl.alicedsl.de User-Agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:i+wph98Lxy2SHfHYJwmrwxcY0F4= 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:94169 Archived-At: Thorsten Jolitz writes: Hi List, > What I would really need is being able to just `print' a structure to > stdout in an emacsclient call and receive as input of another program on > stdin exactly what would be printed in the Emacs *Messages* buffer when > evaluating the print commands in an emacs-lisp-mode buffer. > > Is there any way to achieve this? following up to my own post, I wonder how printing does work in the *Messages* buffer? Looking at the examples below, I see that - with `print-circle' set to t - `print' and `(message "%S" ...)' produce the output I want to receive in another program. And what I want is the first part of the output, the unquoted lisp structure, not the second (string) part. I wonder how this first part (the return value of `org-element-parse-buffer' I would guess) is captured and printed unquoted in the *Messages* buffer _with_ the 'circular' labels and references? To send something via stdout to another program, one must print something, so what I receive in the other program is always the the output - either unquoted but without the 'circular' labels and references, or quoted and including them. How can I send the raw lisp structure with print-circle information to another program (instead of a string)? ################################### ,------------------------------- | (print | (org-element-parse-buffer)))) `------------------------------- #2=(org-data nil #1=(headline (:raw-value "A" :begin 1 :end 7 :pre-blank 0 :hiddenp outline :contents-begin 5 :contents-end 7 :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 0 :footnote-section-p nil :archivedp nil :commentedp nil :quotedp nil :CATEGORY nil :title (#("A" 0 1 (:parent #1#))) :parent #2#) #3=(section (:begin 5 :end 7 :contents-begin 5 :contents-end 7 :post-blank 0 :parent #1#) #4=(paragraph (:begin 5 :end 7 :contents-begin 5 :contents-end 7 :post-blank 0 :post-affiliated 5 :parent #3#) #("B\n" 0 2 (:parent #4#)))))) (org-data nil (headline (:raw-value "A" :begin 1 :end 7 :pre-blank 0 :hiddenp outline :contents-begin 5 ...) (section (:begin 5 :end 7 :contents-begin 5 :contents-end 7 :post-blank 0 :parent #1) (paragraph ... #("B " 0 2 ...))))) ################################## ,------------------------------- | (message "%S" | (org-element-parse-buffer)))) `------------------------------- #2=(org-data nil #1=(headline (:raw-value "A" :begin 1 :end 7 :pre-blank 0 :hiddenp outline :contents-begin 5 :contents-end 7 :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 0 :footnote-section-p nil :archivedp nil :commentedp nil :quotedp nil :CATEGORY nil :title (#("A" 0 1 (:parent #1#))) :parent #2#) #3=(section (:begin 5 :end 7 :contents-begin 5 :contents-end 7 :post-blank 0 :parent #1#) #4=(paragraph (:begin 5 :end 7 :contents-begin 5 :contents-end 7 :post-blank 0 :post-affiliated 5 :parent #3#) #("B\n" 0 2 (:parent #4#)))))) "#2=(org-data nil #1=(headline (:raw-value \"A\" :begin 1 :end 7 :pre-blank 0 :hiddenp outline :contents-begin 5 :contents-end 7 :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 0 :footnote-section-p nil :archivedp nil :commentedp nil :quotedp nil :CATEGORY nil :title (#(\"A\" 0 1 (:parent #1#))) :parent #2#) #3=(section (:begin 5 :end 7 :contents-begin 5 :contents-end 7 :post-blank 0 :parent #1#) #4=(paragraph (:begin 5 :end 7 :contents-begin 5 :contents-end 7 :post-blank 0 :post-affiliated 5 :parent #3#) #(\"B\\n\" 0 2 (:parent #4#))))))" ################################## ,------------------------------- | (message "%s" | (org-element-parse-buffer)))) `------------------------------- #2=(org-data nil #1=(headline (:raw-value A :begin 1 :end 7 :pre-blank 0 :hiddenp outline :contents-begin 5 :contents-end 7 :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 0 :footnote-section-p nil :archivedp nil :commentedp nil :quotedp nil :CATEGORY nil :title (A) :parent #2#) #3=(section (:begin 5 :end 7 :contents-begin 5 :contents-end 7 :post-blank 0 :parent #1#) #4=(paragraph (:begin 5 :end 7 :contents-begin 5 :contents-end 7 :post-blank 0 :post-affiliated 5 :parent #3#) B )))) "#2=(org-data nil #1=(headline (:raw-value A :begin 1 :end 7 :pre-blank 0 :hiddenp outline :contents-begin 5 :contents-end 7 :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 0 :footnote-section-p nil :archivedp nil :commentedp nil :quotedp nil :CATEGORY nil :title (A) :parent #2#) #3=(section (:begin 5 :end 7 :contents-begin 5 :contents-end 7 :post-blank 0 :parent #1#) #4=(paragraph (:begin 5 :end 7 :contents-begin 5 :contents-end 7 :post-blank 0 :post-affiliated 5 :parent #3#) B ))))" #################################### -- cheers, Thorsten