From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 2DabN1SQvmA+kgAAgWs5BA (envelope-from ) for ; Mon, 07 Jun 2021 23:32:04 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id CFUGM1SQvmDsDgAAbx9fmQ (envelope-from ) for ; Mon, 07 Jun 2021 21:32:04 +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 AF7A1227B0 for ; Mon, 7 Jun 2021 23:32:03 +0200 (CEST) Received: from localhost ([::1]:46016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lqMqo-0005kq-Nl for larch@yhetil.org; Mon, 07 Jun 2021 17:32:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49968) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqMpx-0005kO-8M for emacs-orgmode@gnu.org; Mon, 07 Jun 2021 17:31:11 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:45614) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lqMpr-0004RQ-SO for emacs-orgmode@gnu.org; Mon, 07 Jun 2021 17:31:08 -0400 Received: by mail-wr1-x42a.google.com with SMTP id z8so19165578wrp.12 for ; Mon, 07 Jun 2021 14:31:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=andrew-cmu-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nE60OKBbtcWsTX30UwYUNyAY+ARODBLrGAHc7vY6Hp4=; b=oBUf7ASitkSRw9RAOTp2TY9KAeFvYK7rwfbnkbsXxX5eR2REPp9jCl1uEgCxk2WNbz yuzlOmTmQ1k0YUjzcWr59/pTyWEWL2tQZfouWxRvxzKDsquJF89F1f6Ad3jVxlgVEBY0 nQKaXw4VDYsqmrBzPmrrRnPdPpRPEwM4b0qI0i/zzBdWCrI10WLaqAZ8efNl47fDrltg ENyNUwqhJ6ltELzEr3+lIoj+pIpbq+qAApqwSC6EO66y4ggitc3AxTyqu192wgy6pqwu wOQoOzwG8BPhUZ/EG6lQ2xdYBuXIWelBFl8IRyJFJFcxk++naA2Z25uuAvvyhOz7XF7U PnkA== 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=nE60OKBbtcWsTX30UwYUNyAY+ARODBLrGAHc7vY6Hp4=; b=r4RVYtLKfUg062BK10J6wxG2C6v9mKPiMQ/GplqzVwWgeihLWupB3ufmbEV1MEoiXD wip3XBKYwYA64muLTH6wqT5OTQQruXIr9bcXOeoZF0Ivu/+KAUi5EPoUAdWi1ledxp+W PBJHIR3tENUq1e37N4hvANrbYJkyxkWBC6+xBT7cH21eaJL5Kesq6VK58i3rkeWYXMP3 ldYm5nEGJw5U6XLifDp+mXUClnoTT1IIFZkcg31SbUzeMh3awFKf/kJcA4qPYZeDASlA RtsXK35jE1fypQwqTvGbwTr6H8uUfcHv7m+2JlFlsPjXeEm3DFhkgbUXDn0kxX4YXZd5 2Jpg== X-Gm-Message-State: AOAM530yILOpMULhK4H1hW7x4SYavhr18XV4AKONiyR1ps4dwx0lCmrG jCw8Rcl8eVQ8pI3UILe8NTHziSVOBjatGKJE8NM= X-Google-Smtp-Source: ABdhPJwrC3hesB+dbIceH+Hcr6aL1ZaVxd4icgpeariA+ZNDGOwU7UbyDhg5EKItm6r/FwiXdod9AyCFRA42IDSJJLk= X-Received: by 2002:adf:f211:: with SMTP id p17mr18789930wro.173.1623101462084; Mon, 07 Jun 2021 14:31:02 -0700 (PDT) MIME-Version: 1.0 References: <4a32c014-cc70-f71d-aadf-f830bf5b8af8@nicksavage.ca> In-Reply-To: From: John Kitchin Date: Mon, 7 Jun 2021 17:30:51 -0400 Message-ID: Subject: Re: Hiding results using :post To: gmauer@gmail.com Content-Type: multipart/alternative; boundary="00000000000014febf05c433c245" Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=johnrkitchin@gmail.com; helo=mail-wr1-x42a.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, 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=no 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: , Cc: org-mode-email 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=1623101523; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=nE60OKBbtcWsTX30UwYUNyAY+ARODBLrGAHc7vY6Hp4=; b=TT9kt9fZSrwcWWsDuzvi8PfOR2DT/ri+COuPx6if1NwQ5hei1FZeTs9q2iXDg3AEzuOsUr UTV9LS4HHP3NUBZftGvLdKzaE3XQze5pomdQKQ5YRSE2nCdmCp3R1vkvMHbrkHaJEOd1zS v6SnO4U85gu/LIvfjRKb2UPrMR0ps910T0ItRHjPMGpiHTsOJFgik4Zesp+E3+HTjfzwLL q3yM4EVcwfGdz6HVG6Eqb+2VVkl/nkv4w1/FQwuglNwGsOZh232NX/D141bBcJ9sSAQs/1 Q9imvKO04IfC+JYhpIxEmkP9+a4DTyEL4XA/Ltqr0nxOzSDvijZmVX0S70Yorg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1623101523; a=rsa-sha256; cv=none; b=ZzfxlHsKv/TNIvhf+JnRCpCA0mNOzlJSK3aIXO23t+jBmuXk25G4XsR+T6JJi+enADcLR0 prxQJdysAA0h908fTBoFLf94ekHvdErrrrJQ2uMrhincPnq7aMkg2hCuwTmt06wwvgZw+q LbstMhrUiZ+/glyjIYKTLwag5RWXMAtk9tZEehb5MYiHNgdPdiIWq4sf5KhaNrGspAVS8g 2BXMlR3y0RbPNaxIcXON7t7l67kGTAkkPBgrd4QBnc2jRMIkdB+pyvdRfbEWfanNu06lcd IUiPkcMfxgG8G0GqYvDMHqCyLfOfyGI1qUk8nzTIqWj3Q9yaLs9x67neSlKqNw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=andrew-cmu-edu.20150623.gappssmtp.com header.s=20150623 header.b=oBUf7ASi; 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: -2.52 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=andrew-cmu-edu.20150623.gappssmtp.com header.s=20150623 header.b=oBUf7ASi; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=andrew.cmu.edu (policy=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-Migadu-Queue-Id: AF7A1227B0 X-Spam-Score: -2.52 X-Migadu-Scanner: scn1.migadu.com X-TUID: wSyYwgEJQJZd --00000000000014febf05c433c245 Content-Type: text/plain; charset="UTF-8" it is the name of blocks that use emacs-jupyter ( https://github.com/nnicandro/emacs-jupyter) (instead of ob-ipython). Basically it is a connection between org-src blocks and a jupyter kernel (it does not have to be python, it can be julia, R, etc.) I am trying it out this summer. I think that code should work on most src-blocks though. 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 5:21 PM George Mauer wrote: > 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) >>> > >>> >>> --00000000000014febf05c433c245 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
it is the name of blocks that use emacs-jupyter (https://github.com/nnicandr= o/emacs-jupyter)=C2=A0 (instead of ob-ipython). Basically it is a conne= ction between org-src blocks and a jupyter kernel (it does not have to be p= ython, it can be julia, R, etc.) I am trying it out this summer.

I think that code should work on most src-blocks though.
<= br clear=3D"all">
John
-----------------------------------
Professor John Kitchin (he/him/his)=
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Me= llon University
Pittsburgh, PA 15213
412-268-7803


On Mon, Jun 7, 2021 at 5:21 PM George Mauer <gmauer@gmail.com> 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">
Woah woa= h. What is the=C2=A0jupyter-python language, John?

On Mon, Jun 7, 2021, 15:4= 4 John Kitchin <jkitchin@andrew.cmu.edu> 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 resul= ts before hand, so that you toggle the visibility off. This is pretty light= ly tested. you could eliminate=C2=A0

(defun hide-res= ults (&optional &rest args)
=C2=A0 (let ((results (cdr (assoc :r= esults (third (org-babel-get-src-block-info 'light))))))
=C2=A0 =C2= =A0 (when (string-match "hide" results)
=C2=A0 =C2=A0 =C2=A0 (= org-babel-hide-result-toggle t))))

(add-hook 'org-babel-after-ex= ecute-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_SR= C

#+RESULTS:
: 5


=
John

-------= ----------------------------
Professor John Kitchin (he/him/his)
Dohe= rty Hall A207F
Department of Chemical Engineering
Carnegie Mellon Uni= versity
Pittsburgh, PA 15213
412-268-7803


On Mon, Jun 7, 2021 at 10:03 AM Nick Sav= age <nick@nicksavage.ca> wrote:
My initial thoughts are that this is very possibl= e. 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)
>

--00000000000014febf05c433c245--