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 8O/CDMkAxl50egAA0tVLHw (envelope-from ) for ; Thu, 21 May 2020 04:17:13 +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 +PynCMkAxl6OfwAAB5/wlQ (envelope-from ) for ; Thu, 21 May 2020 04:17:13 +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 1EA73940391 for ; Thu, 21 May 2020 04:17:12 +0000 (UTC) Received: from localhost ([::1]:51022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbcdp-0002Xt-4y for larch@yhetil.org; Thu, 21 May 2020 00:17:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56502) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbcdS-0002Xj-Gx for emacs-orgmode@gnu.org; Thu, 21 May 2020 00:16:46 -0400 Received: from pb-smtp2.pobox.com ([64.147.108.71]:55895) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbcdQ-0001JL-Gk for emacs-orgmode@gnu.org; Thu, 21 May 2020 00:16:45 -0400 Received: from pb-smtp2.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id D0FC849D5C; Thu, 21 May 2020 00:16:42 -0400 (EDT) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to :subject:in-reply-to:references:date:message-id:mime-version :content-type; s=sasl; bh=urdOfj2QIlF8X4vNzT11JaCJVbM=; b=Pto0Dv vTsnHnkvhIzz+muaii71eRdrbq6rqOCwM+9SS8Jfjwnu/2lGIpiJKzbMhuM0jD4Y LI+jC+qWSPhAx3/oaE84UrRkwpIydBUnqzPYKwLnn9nzBbm5tgwwJNmH7CQ/EvX6 2QT829XrZM+srNjXAE3G4ORg3yvIZqUCYY0c8= Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id C96A749D5B; Thu, 21 May 2020 00:16:42 -0400 (EDT) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=kyleam.com; h=from:to:subject:in-reply-to:references:date:message-id:mime-version:content-type; s=mesmtp; bh=JFXRf9shFtSn3OaiBTmURDohfMaQ8N7kY0iYggBS+Q0=; b=KV+7Qe7QsdgtdHP5xMGH4U1fPzSEMyiBxeo8lKaZE1U1+ZPSwfqs7cHCiWl7iyofc1tDeTzECAgW4HRtU1LJTVKvrUk37Btia0Mq15UuX99SUDDJWiQyhwefe72P+ISwDoTYKjM50+Fbhep2hqpI1jTczOWlETLkCWe0SRjABMY= 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-smtp2.pobox.com (Postfix) with ESMTPSA id 2989949D5A; Thu, 21 May 2020 00:16:42 -0400 (EDT) (envelope-from kyle@kyleam.com) From: Kyle Meyer To: Greg Minshall , emacs-orgmode@gnu.org Subject: [PATCH] ob-core: Display warning on failure to read results In-Reply-To: <2449663.1588516024@apollo2.minshall.org> References: <2449663.1588516024@apollo2.minshall.org> Date: Thu, 21 May 2020 04:16:40 +0000 Message-ID: <87d06xsz13.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: DFF17B9E-9B19-11EA-87D4-D1361DBA3BAF-24757444!pb-smtp2.pobox.com Received-SPF: pass client-ip=64.147.108.71; envelope-from=kyle@kyleam.com; helo=pb-smtp2.pobox.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/21 00:16:42 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: , 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=Pto0Dv v; dkim=pass header.d=kyleam.com header.s=mesmtp header.b=KV+7Qe7Q; 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: iBR8qlQvZqIt Greg Minshall writes: > hi. i'm running R code from an org mode file. i was having a problem > where a code block that *was* returning a value result was not returning > the results into the buffer. > > (after long head-scratching) this appears to be because my code was > returning more lines of results than org-table-convert-region-max-lines. > > but, i was *not* seeing any error message, nothing to indicate to me why > i was getting no results. in the test program below, when trying to > return more than 1000 lines, one sees, in the echo area, "Code block > returned no value". if you go to *Messages*, there you can see an error > message. Thanks for the report and for providing a minimal example. > i think somehow org/babel should make sure the user sees what limitation > s/he is running into. I agree. Here's my suggestion. -- >8 -- Subject: [PATCH] ob-core: Display warning on failure to read results * lisp/ob-core.el (org-babel-import-elisp-from-file): Show handled errors with display-warning rather than a message because the latter is quickly overridden by subsequent messages, making it difficult if not impossible for the user to spot. The scope of the save-window-excursion call would need to be reduced for the display-warning buffer to be shown, but nothing appears to change the window configuration, so just drop the save-window-excursion call. Reported-by: Greg Minshall <2449663.1588516024@apollo2.minshall.org> --- lisp/ob-core.el | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index ee0dc3d72..2a75ae734 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -2941,24 +2941,27 @@ (defun org-babel--string-to-number (string) (defun org-babel-import-elisp-from-file (file-name &optional separator) "Read the results located at FILE-NAME into an elisp table. If the table is trivial, then return it as a scalar." - (save-window-excursion - (let ((result - (with-temp-buffer - (condition-case err - (progn - (org-table-import file-name separator) - (delete-file file-name) - (delq nil - (mapcar (lambda (row) - (and (not (eq row 'hline)) - (mapcar #'org-babel-string-read row))) - (org-table-to-lisp)))) - (error (message "Error reading results: %s" err) nil))))) - (pcase result - (`((,scalar)) scalar) - (`((,_ ,_ . ,_)) result) - (`(,scalar) scalar) - (_ result))))) + (let ((result + (with-temp-buffer + (condition-case err + (progn + (org-table-import file-name separator) + (delete-file file-name) + (delq nil + (mapcar (lambda (row) + (and (not (eq row 'hline)) + (mapcar #'org-babel-string-read row))) + (org-table-to-lisp)))) + (error + (display-warning 'org-babel + (format "Error reading results: %S" err) + :error) + nil))))) + (pcase result + (`((,scalar)) scalar) + (`((,_ ,_ . ,_)) result) + (`(,scalar) scalar) + (_ result)))) (defun org-babel-string-read (cell) "Strip nested \"s from around strings." base-commit: 5e2490bdf29a1eeff91b631425c38309cf368690 -- 2.26.2