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 sBU3F6u5yV7MAwAA0tVLHw (envelope-from ) for ; Sun, 24 May 2020 00:02:51 +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 oBQfE6u5yV4/SgAAB5/wlQ (envelope-from ) for ; Sun, 24 May 2020 00:02:51 +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 BAA889401AD for ; Sun, 24 May 2020 00:02:50 +0000 (UTC) Received: from localhost ([::1]:59742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jce6K-0003Gz-0U for larch@yhetil.org; Sat, 23 May 2020 20:02:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47864) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jce60-0003Gs-T8 for emacs-orgmode@gnu.org; Sat, 23 May 2020 20:02:28 -0400 Received: from mail-il1-x142.google.com ([2607:f8b0:4864:20::142]:34754) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jce5z-0007CJ-NM for emacs-orgmode@gnu.org; Sat, 23 May 2020 20:02:28 -0400 Received: by mail-il1-x142.google.com with SMTP id 4so14418247ilg.1 for ; Sat, 23 May 2020 17:02:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JtMOWcBUSAt3cSqlvsO7b/y7objQS3rzcvLJSj31f+M=; b=evsCYyqdKBIf0p4C8kpwLZGyI5AdI54G8IUMb9R2FWItxTLG/VYn0MAaroblxzbFMS bV+Wk73/2KzXIp14Xw/BKNvZL01wutqDFkA6yK5WxFV0rTXdBVuU2Xmr26TXfFbHgMMq cUUhWYM2vO/P+0KHk8g62xOi2ElqWAh0SAvf4Lw8CaUhqUsndWCzF8bvLQtua8MYkPX5 Cxv3e/BviSTUjEJlEJX/XvWThZM4dD8W04hrlGwQ4hbRZeqi5lWYG/qyHf1VsQUjI0p2 t9nogferypN0/l18WvN++eMAAtVIm63MMi1WJnPsU15FKry4I8MKZV06soE5UEag4N45 wwcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JtMOWcBUSAt3cSqlvsO7b/y7objQS3rzcvLJSj31f+M=; b=iEdbB+PbACzyXM8/Mhk+kXsB6Xwbh7Nw9LJi+QxsHWxv+/leTA/FTXFwXUOhsbAwTn 1ojeYRC1BZmd9Ewul7sfZ0llG3oEYPOkwv0CerUT5UToSNaOZARrxg6rNSwPkFNMy7Xa UhrXeLBLvpZA5pszJmiWDQtaVacC2yAjTVA/tUB1tN/N0TuzU0GlgPHEArISQqVssgNg WwYzieMtfzAZRo8JxgTACqP9O/h1oqMzeVZ0iiuMMNdwJAjEQ6JyNsA6XXwOBjgAZkJf y/xsfVG4NDS78K2W7nMB7d98W6+Bg1uRB6DvfydaGyAVZFw6ULJIw7Y/tNR6R5hQp6Pv 1Zjg== X-Gm-Message-State: AOAM531PDqAis1FLcUxfMZ6YvlLyFB9MP9wHkYvorJxDSpaciGmkZl8Q rr+r/aOh+r59KS1qjmbMPFtIdSMUrFG5nn+XQWxqdA== X-Google-Smtp-Source: ABdhPJxhlpLq58kUS7SBZas98IaTnl3OODjHb4xdZ0kzrrZEOYgwl5MzgfFOe9rX6801SOj3ECzXY5e9drSGspyN9C0= X-Received: by 2002:a92:c211:: with SMTP id j17mr7547901ilo.85.1590278546151; Sat, 23 May 2020 17:02:26 -0700 (PDT) MIME-Version: 1.0 References: <87o8qjduhs.fsf@kyleam.com> In-Reply-To: <87o8qjduhs.fsf@kyleam.com> From: Nick Daly Date: Sat, 23 May 2020 19:02:14 -0500 Message-ID: Subject: Re: [PATCH] ob-haskell: Line Continuations Mangle Block Output To: Kyle Meyer Content-Type: multipart/mixed; boundary="000000000000d67f2905a65993a5" Received-SPF: pass client-ip=2607:f8b0:4864:20::142; envelope-from=nick.m.daly@gmail.com; helo=mail-il1-x142.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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=gmail.com header.s=20161025 header.b=evsCYyqd; dmarc=pass (policy=none) header.from=gmail.com; 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: -0.11 X-TUID: tDUh1lCIkvLn --000000000000d67f2905a65993a5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Kyle, thanks for the thoughtful analysis. On Wed, May 20, 2020 at 12:51 AM Kyle Meyer wrote: > 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? After a bit of tinkering, I realized there are two things going on here, only one of which I fully understand: 1. My core functional issue is that =3Dcomint-prompt-regexp=3D isn't set up to handle the "Prelude| " entries or the repeated prompts. The other patches I submitted were unnecessary. 2. The =3Dcomint-prompt-regexp=3D gets default values from somewhere I don't understand and can't find with a quick source grep. In ob-haskell, we set =3Dcomint-prompt-regexp=3D to the (undefined) haskell-prompt plus "or optional-lambda": (defvar haskell-prompt-regexp) (defun org-babel-execute:haskell (body params) ... (setq-local comint-prompt-regexp (concat haskell-prompt-regexp "\\|^=CE=BB?> ")))) That causes an evaluation error that prevents the first source block evaluation but, strangely, that also results in this mess in the *haskell* buffer on subsequent evaluations: : "^\\*?[[:upper:]][\\._[:alnum:]]*\\(?: \\*?[[:upper:]][\\._[:alnum:]]*\\)*\\( =CE=BB\\)?> " =3Dcomint-prompt-regexp=3D's variable documentation calls out much simpler regexps that do basically the same thing as the one above and handles the repeated "Prelude| " entries. This one is based off the Canonical Lisp example: : "^[^>\n]+\\(> \\)?" I've attached a patch against git master that results in fewer undefined variable errors and depends less default-variable magic. Now, =3Dhaskell-prompt-regexp=3D and =3Dcomint-prompt-regexp=3D are explici= tly set using defaults that can be M-x customized, and the default value handles the repeated "Prelude| " entries without breaking the original "=CE=BB> " prompt handling. Thanks, Nick --000000000000d67f2905a65993a5 Content-Type: text/x-patch; charset="UTF-8"; name="ob-haskell-trim-prelude-3.diff" Content-Disposition: attachment; filename="ob-haskell-trim-prelude-3.diff" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_kakaorxy0 ZGlmZiAtLWdpdCBhL2xpc3Avb2ItaGFza2VsbC5lbCBiL2xpc3Avb2ItaGFza2VsbC5lbAppbmRl eCBiZWExNjI1MjguLjg5M2U0MjIwYyAxMDA2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XN1bHQtdHlwZSBwYXJhbXMpKSkKICAgICAgICAgIChmdWxsLWJvZHkgKG9yZy1iYWJlbC1l eHBhbmQtYm9keTpnZW5lcmljCg== --000000000000d67f2905a65993a5--