From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id iKBhIPeNvmDujQAAgWs5BA (envelope-from ) for ; Mon, 07 Jun 2021 23:21:59 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id CAKPG/eNvmBaCwAAbx9fmQ (envelope-from ) for ; Mon, 07 Jun 2021 21:21:59 +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 A6A7CB457 for ; Mon, 7 Jun 2021 23:21:58 +0200 (CEST) Received: from localhost ([::1]:37360 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lqMh3-000833-00 for larch@yhetil.org; Mon, 07 Jun 2021 17:21:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqMgf-00082b-0V for emacs-orgmode@gnu.org; Mon, 07 Jun 2021 17:21:33 -0400 Received: from mail-oi1-x233.google.com ([2607:f8b0:4864:20::233]:41563) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lqMgd-0008Mt-39 for emacs-orgmode@gnu.org; Mon, 07 Jun 2021 17:21:32 -0400 Received: by mail-oi1-x233.google.com with SMTP id t40so6494150oiw.8 for ; Mon, 07 Jun 2021 14:21:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to; bh=0YoSsGbjOfFcnOQ+uCNrUJNlit7j0N0IzLABNwb976k=; b=kXozZJwI9jrtTBTkI47RdnkqiGTogxk3iyuhC1aDRi7vsNvWIxcOI+z7x+tc73tSx2 B5mAGUcKxKa/3a+srHlvQfi/aMBAPqnOAN2eg4Bme30PtyhdAHEwiuwDoMET4vZ7jcvM HtuBwirRapVwwazy5TjNntMyQdZcuBBr0Q7xzmDfXrrpZUXNwlILBWSd4hRe/ghdVHyS 4MPS77fJxUE2UY5+H14xX8q+IBIsRd3l9HEDNx0HgTZ6isuO7d3tHScU0ZE4Srw8RXKF MDOobPVBd3lrhSs28QDoRUR2uG+oxEFVDHMixTWocE7yTqidiMCXfcqAoIuhGd5ftv36 lHKw== 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:reply-to :from:date:message-id:subject:to; bh=0YoSsGbjOfFcnOQ+uCNrUJNlit7j0N0IzLABNwb976k=; b=neNk9truE+RAXfQzJGiONCzCbKCqj4nWd/9r+P1FauX1+RMkwOJ/69pC6Uj5im3y8l ZtWcPvmmJzNfTJUAc17I7sUEd+tyvhMI2T5PXw1PPg/BdjPKDvg1GXbWBwJQI4O2FFeO PfwNqorojqya63VQY8E3Zu1PPd3zdhtCheAj2CgdGNQOR1UeAdR5l9K2DHYpGZqedYDX Czptc5QyUsfdzZQMEDfx9hHQKCHePR8ezn7kCpXF5rr+b6VS6w5N9jVHB724+jGaJOwU n1Mu1XqqFq2I31nc6vlHgRY6DbdqXxBIWYtpIynN0bUBgiIJvtDPsvxZ6EgVJrbxis7K nVdA== X-Gm-Message-State: AOAM530HQspweSsZvIiATGW1h8d4pulTAPSDnfT1ORuOu4gwZP3iBMkj CUAC5pJHQhafNKnfunOr9FU14hLhqbzFKNRrfjh6g5H17Zw= X-Google-Smtp-Source: ABdhPJzEovVqsKMF0ENAARkbOXlLTdMm1WbjRGoXjjwYT83Va9tuiFTYFhwszGQ9tc330/FkwhySGDPI9Fl8kx7NXbc= X-Received: by 2002:a05:6808:486:: with SMTP id z6mr662625oid.153.1623100889332; Mon, 07 Jun 2021 14:21:29 -0700 (PDT) MIME-Version: 1.0 References: <4a32c014-cc70-f71d-aadf-f830bf5b8af8@nicksavage.ca> In-Reply-To: From: George Mauer Date: Mon, 7 Jun 2021 16:21:17 -0500 Message-ID: Subject: Re: Hiding results using :post To: org-mode-email Content-Type: multipart/alternative; boundary="000000000000f1825505c4339fde" Received-SPF: pass client-ip=2607:f8b0:4864:20::233; envelope-from=gmauer@gmail.com; helo=mail-oi1-x233.google.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_SBL_A=0.1 autolearn=ham autolearn_force=no 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: , Reply-To: gmauer@gmail.com Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1623100918; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=0YoSsGbjOfFcnOQ+uCNrUJNlit7j0N0IzLABNwb976k=; b=HlQiMJQ+ef4SX5pdpoRjfx5HGCckA8SgAvmiThq2cWKaEaX+JzcA21C2bRvE3wKbwGdBBm m2yA+plqPkwcXb2AAepMuCy9MFXn82dFde6aq5HHetkcksVBy6sJI1vWrCNw4W2aCOr3ur Pbx44XM6/nk+aelSgnObKpUF2NqCOKa65tm2Kh2I7m0RpGi//ftWbrur3tGqX7f4zmulki Z2EtRCAZUOxKHBpF4dFytmKV4GegZ0ekwJtqRiftH75ee4YNy4zCF0hpOrisk53kiU9PGs QdUWEaVtP8DInVdBtpLwdGPcPXapo+VfPWpPdfSzjIipAmJ0fu65xhwOcjLXhQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1623100918; a=rsa-sha256; cv=none; b=KPxPsoBRMH9CeldYP1x0bAkOqUWgZFryitGK/BIz4KP18da2cy2eY5jjAwv5gYTMKIzucY 70mexa6PK3j7HxTl5/OAyEHolKrKsi64a9iXP8qroWtSI7IfYUqCrceaN4ax9+GMDO6Sfv 94Yzo8OGL3w+UOd3CVwKYCEIrV1cEqSy+2FyCUVXQOTi0o2JNWccN1b/7VBtSHN4RRps3H qWt5BFpr9LdAlObEYMeN0hALK2d2vaxMMwGzZ4+yrp/Pir31nuo8MD7CihyvYibxSn9c+B 0Up6rUqqzdEoG/Rclz7LdsTOWeI2oumTc35MMNCoDwKN5Kp8SCXze2bY0awmzA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=kXozZJwI; 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-Migadu-Spam-Score: -3.12 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=kXozZJwI; 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-Migadu-Queue-Id: A6A7CB457 X-Spam-Score: -3.12 X-Migadu-Scanner: scn0.migadu.com X-TUID: 6EFt+3PKb34H --000000000000f1825505c4339fde Content-Type: text/plain; charset="UTF-8" Woah woah. What is the jupyter-python language, John? On Mon, Jun 7, 2021, 15:44 John Kitchin wrote: > This is doable with a hook and advice I think. The hook will hide the > results if you use :results hide in the header. > > I had to use the advice to remove the results before hand, so that you > toggle the visibility off. This is pretty lightly tested. you could > eliminate > > (defun hide-results (&optional &rest args) > (let ((results (cdr (assoc :results (third (org-babel-get-src-block-info > 'light)))))) > (when (string-match "hide" results) > (org-babel-hide-result-toggle t)))) > > (add-hook 'org-babel-after-execute-hook 'hide-results) > > (advice-add 'org-babel-execute-src-block :before (lambda (&rest args) > (org-babel-remove-result))) > > I guess there are other ways that might work too. > > #+BEGIN_SRC jupyter-python :results hide > print(5) > #+END_SRC > > #+RESULTS: > : 5 > > > John > > ----------------------------------- > Professor John Kitchin (he/him/his) > Doherty Hall A207F > Department of Chemical Engineering > Carnegie Mellon University > Pittsburgh, PA 15213 > 412-268-7803 > @johnkitchin > http://kitchingroup.cheme.cmu.edu > > > > On Mon, Jun 7, 2021 at 10:03 AM Nick Savage wrote: > >> My initial thoughts are that this is very possible. This might be an >> area where we could add a new defcustom on always hiding the results to >> allow the user to choose it. Without looking at the code, I think it >> would be pretty straight forward to make an excursion to the results >> line, toggle showing it, then going back to where the point was. >> >> I can take a crack at a patch in the next day or so if no one else wants >> to or gets there first. >> >> On 6/7/21 8:51 AM, Roger Mason wrote: >> > Hello, >> > >> > I'd like to be able to hide results, for example when I expect the >> > them to span many lines. I know I can hit =tab= on the #+RESULTS: line, >> > but I'd like to be able to set this automatically. >> > >> > My most recent effort: >> > >> > #+name: hideresults >> > #+begin_src emacs-lisp :results none :exports none >> > (add-to-invisibility-spec '(org-babel-hide-result . t)) >> > #+end_src >> > >> > run like this >> > >> > #+header: :engine postgresql :dbhost "localhost" :dbuser "rmason" >> :database "test" :colnames yes >> > #+header: :post hideresults >> > #+name: pgquery >> > #+begin_src sql >> > select timestamp,nempty0 from settings where timestamp like '%20210528%' >> > #+end_src >> > >> > produces >> > >> > #+RESULTS: pgquery >> > : nil >> > >> > I'm sure there is a way to do this, but I need some pointers as to how. >> > >> > Thanks for any help. >> > >> > Roger >> > >> > Org mode version 9.2.3 (release_9.2.3-390-gfb5091 @ >> > /home/rmason/.emacs.d/org-git/lisp/) >> > >> > GNU Emacs 27.2 (build 1, amd64-portbld-freebsd11.4, X toolkit, cairo >> version 1.16.0, Xaw3d scroll bars) >> > >> >> --000000000000f1825505c4339fde Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Woah woah. What is the=C2=A0jupyter-python language, John= ?

On Mon, Jun 7, 2021, 15:44 John Kitchin <jkitchin@andrew.cmu.edu> wrote:
This is doable with a hook and advice I t= hink. The hook will hide the results if you use :results hide in the header= .

I had to use the advice to remove the results before h= and, so that you toggle the visibility off. This is pretty lightly tested. = you could eliminate=C2=A0

(defun hide-results (&= optional &rest args)
=C2=A0 (let ((results (cdr (assoc :results (thi= rd (org-babel-get-src-block-info 'light))))))
=C2=A0 =C2=A0 (when (s= tring-match "hide" results)
=C2=A0 =C2=A0 =C2=A0 (org-babel-hi= de-result-toggle t))))

(add-hook 'org-babel-after-execute-hook &= #39;hide-results)

(advice-add 'org-babel-execute-src-block :befo= re (lambda (&rest args) (org-babel-remove-result)))

<= /div>
I guess there are other ways that might work too.

#= +BEGIN_SRC jupyter-python :results hide
print(5)
#+END_SRC

#+R= ESULTS:
: 5


John

-----------------------------------
Professor John Kitch= in (he/him/his)
Doherty Hall A207F
Department of Chemical Engineering=
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803


On Mon, Jun 7, 20= 21 at 10:03 AM Nick Savage <nick@nicksavage.ca> wrote:
<= blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l= eft:1px solid rgb(204,204,204);padding-left:1ex">My initial thoughts are th= at this is very possible. This might be an
area where we could add a new defcustom on always hiding the results to allow the user to choose it. Without looking at the code, I think it
would be pretty straight forward to make an excursion to the results
line, toggle showing it, then going back to where the point was.

I can take a crack at a patch in the next day or so if no one else wants to or gets there first.

On 6/7/21 8:51 AM, Roger Mason wrote:
> Hello,
>
> I'd like to be able to hide results, for example when I expect the=
> them to span many lines.=C2=A0 I know I can hit =3Dtab=3D on the #+RES= ULTS: line,
> but I'd like to be able to set this automatically.
>
> My most recent effort:
>
> #+name: hideresults
> #+begin_src emacs-lisp :results none :exports none
> (add-to-invisibility-spec '(org-babel-hide-result . t))
> #+end_src
>
> run like this
>
> #+header: :engine postgresql :dbhost "localhost"=C2=A0 :dbus= er "rmason" :database "test" :colnames yes
> #+header: :post hideresults
> #+name: pgquery
> #+begin_src sql
> select timestamp,nempty0 from settings where timestamp like '%2021= 0528%'
> #+end_src
>
> produces
>
> #+RESULTS: pgquery
> : nil
>
> I'm sure there is a way to do this, but I need some pointers as to= how.
>
> Thanks for any help.
>
> Roger
>
> Org mode version 9.2.3 (release_9.2.3-390-gfb5091 @
> /home/rmason/.emacs.d/org-git/lisp/)
>
> GNU Emacs 27.2 (build 1, amd64-portbld-freebsd11.4, X toolkit, cairo v= ersion 1.16.0, Xaw3d scroll bars)
>

--000000000000f1825505c4339fde--