From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: New pp Date: Sat, 11 Mar 2017 11:40:10 -0500 Message-ID: References: <87pokampa4.fsf@ericabrahamsen.net> <87innrc03h.fsf@users.sourceforge.net> <87k27w8j2l.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1489250421 25503 195.159.176.226 (11 Mar 2017 16:40:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 11 Mar 2017 16:40:21 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: Emacs developers To: Noam Postavsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Mar 11 17:40:17 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cmk3z-00063T-QP for ged-emacs-devel@m.gmane.org; Sat, 11 Mar 2017 17:40:15 +0100 Original-Received: from localhost ([::1]:43940 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cmk45-0003Mu-Om for ged-emacs-devel@m.gmane.org; Sat, 11 Mar 2017 11:40:21 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48265) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cmk40-0003Mn-1u for emacs-devel@gnu.org; Sat, 11 Mar 2017 11:40:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cmk3w-0004FE-5s for emacs-devel@gnu.org; Sat, 11 Mar 2017 11:40:16 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:45114) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cmk3w-0004Ey-0U for emacs-devel@gnu.org; Sat, 11 Mar 2017 11:40:12 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0ATCQDHJ8RY/3OXCkxdGgEBAQECAQEBAQgBAQEBg1FBihOFeJBdKQGXH4YcBAICgkBEFAECAQEBAQEBAWsohRYBBAFWIwULCw4mEhQYDSSKCwi0H4pdAQEIAiaLPYo5BZBai2ecfIZikX+BRDYhgQQjFggshRgdggEiii4BAQE X-IPAS-Result: A0ATCQDHJ8RY/3OXCkxdGgEBAQECAQEBAQgBAQEBg1FBihOFeJBdKQGXH4YcBAICgkBEFAECAQEBAQEBAWsohRYBBAFWIwULCw4mEhQYDSSKCwi0H4pdAQEIAiaLPYo5BZBai2ecfIZikX+BRDYhgQQjFggshRgdggEiii4BAQE X-IronPort-AV: E=Sophos;i="5.36,147,1486443600"; d="scan'208";a="295035286" Original-Received: from 76-10-151-115.dsl.teksavvy.com (HELO pastel.home) ([76.10.151.115]) by smtp.teksavvy.com with ESMTP; 11 Mar 2017 11:40:10 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id BFC076184D; Sat, 11 Mar 2017 11:40:10 -0500 (EST) In-Reply-To: (Noam Postavsky's message of "Sat, 11 Mar 2017 11:05:26 -0500") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:212911 Archived-At: >> Hmm... but if we use such a pseudo-stream here, doesn't it break all >> calls to `princ' within other cl-print-object methods (i.e. forcing us >> the override pretty much all existing cl-print-object methods with >> a pprint-specific one)? > It doesn't break anything, AFAIK, it just means that you don't get > control over newlines vs spaces. But from my reading of the code, we may sometimes end up calling `princ' with a pp-state object, and I expect it won't know what to do with it. > Oh wait, did you possibly miss a close paren? Might be clearer this way: > (cl-defmethod cl-print-object (object (pprint-state (head :pprint))) > (pp--scan (cl-prin1-to-string object) > (cdr pprint-state)) > object) No, the problem is when we run for example the (cl-defmethod cl-print-object ((object vector) stream) method (which AFAIK takes precedence over the (cl-defmethod cl-print-object (object (pprint-state (head :pprint))) method, so it will receive a pp-state stream and pass it on to `princ`). Stefan