From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id ENUjH4fFxF53PwAA0tVLHw (envelope-from ) for ; Wed, 20 May 2020 05:52:07 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 4Ov6GofFxF76KwAAB5/wlQ (envelope-from ) for ; Wed, 20 May 2020 05:52:07 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A02F69410FB for ; Wed, 20 May 2020 05:52:06 +0000 (UTC) Received: from localhost ([::1]:53966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbHe9-0005rR-9N for larch@yhetil.org; Wed, 20 May 2020 01:52:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53952) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbHdd-0005rI-Si for emacs-orgmode@gnu.org; Wed, 20 May 2020 01:51:33 -0400 Received: from pb-smtp1.pobox.com ([64.147.108.70]:58372) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbHdb-0007nf-JJ for emacs-orgmode@gnu.org; Wed, 20 May 2020 01:51:32 -0400 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id CC9CB59F09; Wed, 20 May 2020 01:51:28 -0400 (EDT) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:in-reply-to:references:date:message-id:mime-version :content-type; s=sasl; bh=IG+wQaAn0ljAPGfXzm6emhhUjbo=; b=YfjhEO NGZ96WZ+a3yM3wmeaD5rbqhWrRpI81dcQpg1kpZgLy1sZMPoRypBEyr+tNCAqBgn GECYSwaV8ueAS2ensOdQweRRFNRAGKvXstCMMhjFfJPq2A5UCnvQMmoG0RpEJj1x 6V81CuFX8pdqDtbcXdrywsFxSDNTTtBAC7HQE= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id BE7D759F08; Wed, 20 May 2020 01:51:28 -0400 (EDT) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=kyleam.com; h=from:to:cc:subject:in-reply-to:references:date:message-id:mime-version:content-type; s=mesmtp; bh=CV1MAe6GjRoWN91etm8w9y3qvIg3HSXWsQZMZ4Wr6RA=; b=t6FpCaUnkkD2t66d2rBM3RcqhDENo0HEe9wjN44gdhHEgQ8wVnj0Gq4aPBPEMtBLEMb/PgnyOGSH+ftWVKxwjEl2zoYYbwlrvCkia/4v2/0UdNsfzP+jjL6vmdr51zjnfz1/8NmtALmNl8wIhYgBDCK2nUX0+DkcaRVnedEd6uY= Received: from localhost (unknown [45.33.91.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 1618859F07; Wed, 20 May 2020 01:51:28 -0400 (EDT) (envelope-from kyle@kyleam.com) From: Kyle Meyer To: Nick Daly Subject: Re: [PATCH] ob-haskell: Line Continuations Mangle Block Output In-Reply-To: References: Date: Wed, 20 May 2020 05:51:27 +0000 Message-ID: <87o8qjduhs.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: F29A3D1A-9A5D-11EA-BBF4-C28CBED8090B-24757444!pb-smtp1.pobox.com Received-SPF: pass client-ip=64.147.108.70; envelope-from=kyle@kyleam.com; helo=pb-smtp1.pobox.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/20 01:51:28 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Org Mode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=pobox.com header.s=sasl header.b=YfjhEO N; dkim=pass header.d=kyleam.com header.s=mesmtp header.b=t6FpCaUn; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -1.21 X-TUID: hG+0fRz4uzCr Nick Daly writes: > Attached is an updated patch that makes output trimming work with > blocks that do and don't produce results. The old patch creates a > =let: Wrong type argument: arrayp, nil= error when evaluating blocks > that don't produce output. This necessarily incorporates yesterday's > patch. Thanks for the patch. > diff --git a/lisp/ob-haskell.el b/lisp/ob-haskell.el > index bea162528..cb581fe3b 100644 > --- a/lisp/ob-haskell.el > +++ b/lisp/ob-haskell.el > @@ -83,12 +83,16 @@ > (cdr (member org-babel-haskell-eoe > (reverse (mapcar #'org-trim raw))))))) > (org-babel-reassemble-table > - (let ((result > + (let* ((result > (pcase result-type > (`output (mapconcat #'identity (reverse results) "\n")) > - (`value (car results))))) > + (`value (car results)))) > + (result > + (if (stringp result) > + (replace-regexp-in-string "Prelude[|>] " "" result) > + result))) Oy, it's pretty nasty that those leak through. I know ob-python (and probably other languages) also suffers from similar brittleness. It'd be nice of course to figure out how to prevent the prompts leakage in the first place, but, short of that, I think we should at least make the regexp stricter so that it matches just the start of the string. And that (stringp result) check is for the same reason as the one from your first patch from yesterday which is now included ... > (org-babel-result-cond (cdr (assq :result-params params)) > - result (org-babel-script-escape result))) > + result (if (stringp result) (org-babel-script-escape result)))) ... here. I believe result is nil in the problematic case, so this could be (and result (org-babel-script-escape result)) However, based on stepping through the example in your patch from yesterday, I think these two issues might be more closely related than you realize. In the (cdr (member org-babel-haskell-eoe (reverse (mapcar #'org-trim raw)))) bit visible as a context line above, this is what I see for raw when I step through org-babel-execute:haskell: ("Prelude| Prelude| Prelude| Prelude> \"org-babel-haskell-eoe\"" "") So it looks like the member call above is returning nil because the prompt markers are corrupting the element. If that's the case, it seems like the output cleansing should happen upstream of that call. What do you think?