From mboxrd@z Thu Jan  1 00:00:00 1970
From: "Berry, Charles" <ccberry@ucsd.edu>
Subject: Re: where to place caption so babel results include caption?
Date: Wed, 6 Nov 2019 16:05:39 +0000
Message-ID: <5A52F11B-774A-46A3-B507-70883FB181A8@ucsd.edu>
References: <871ruls518.fsf@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Return-path: <emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org>
Received: from eggs.gnu.org ([2001:470:142:3::10]:54261)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <ccberry@ucsd.edu>) id 1iSNom-0001og-RL
 for emacs-orgmode@gnu.org; Wed, 06 Nov 2019 11:06:02 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <ccberry@ucsd.edu>) id 1iSNol-0002zM-4J
 for emacs-orgmode@gnu.org; Wed, 06 Nov 2019 11:06:00 -0500
Received: from mx0b-00395d01.pphosted.com ([148.163.137.170]:14954)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <ccberry@ucsd.edu>) id 1iSNok-0002xJ-Jm
 for emacs-orgmode@gnu.org; Wed, 06 Nov 2019 11:05:59 -0500
In-Reply-To: <871ruls518.fsf@gmail.com>
Content-Language: en-US
Content-ID: <0A53B48D16E2484AB9683E207D21F0A5@AD.UCSD.EDU>
List-Id: "General discussions about Org-mode." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org
Sender: "Emacs-orgmode"
 <emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org>
To: Ken Mankoff <mankoff@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>



> On Nov 6, 2019, at 1:55 AM, Ken Mankoff <mankoff@gmail.com> wrote:
>=20
> Hello,
>=20
> If I have a babel block that generates a table and I'd like latex attribu=
tes associated with that table, it seems to work well if I do this:
>=20
> #+NAME: foo
> #+BEGIN_SRC bash :results table
> echo "${RANDOM}|${RANDOM}|"
> echo "${RANDOM}|${RANDOM}|"
> #+END_SRC
>=20
> #+caption: foo
> #+latex_attr: :placement [!h]
> #+RESULTS: foo
> | 17326 | 29919 |
> | 30565 |  9548 |
>=20
>=20
> And I can re-run the babel block and CAPTION and ATTR_LATEX remain.
>=20
> But if I want to clean with =3D[C-u] C-c C-v k=3D or (org-babel-remove-re=
sult-one-or-many) and regenerate =3DC-c C-v C-b=3D or (org-babel-execute-bu=
ffer), then this happens:
>=20
>=20
> #+RESULTS: foo
> | 17225 | 29253 |
> | 18433 | 27388 |
>=20
> #+caption: foo
> #+latex_attr: :placement [!h]
>=20
> If I place CAPTION and LATEX_ATTR above the babel block it isn't exported=
 correctly. Is there some way to have this work?
>=20


Maybe use something like

M-: (org-babel-map-src-blocks nil (org-babel-insert-result "" '("replace"))=
) RET

to scrub the existing result values without removing the '#+RESULTS' line.

??

HTH,

Chuck=