From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Tang Subject: [PATCH] org-babel-execute-buffer "No surrounding element" error Date: Thu, 31 Aug 2017 03:02:44 +0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Lp6DBUXHaMkr64Mn58Ga68nGA1sj0tgdW" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37527) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn8Gl-0000ph-Ip for emacs-orgmode@gnu.org; Wed, 30 Aug 2017 15:03:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dn8Gi-00042N-WA for emacs-orgmode@gnu.org; Wed, 30 Aug 2017 15:03:19 -0400 Received: from mail.that.world ([45.79.9.173]:33080) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dn8Gi-00041u-H4 for emacs-orgmode@gnu.org; Wed, 30 Aug 2017 15:03:16 -0400 Received: from [192.168.1.127] (li1676-178.members.linode.com [172.104.66.178]) (Authenticated sender: sorpaas) by mail.that.world (Postfix) with ESMTPSA id 41865141573 for ; Wed, 30 Aug 2017 19:03:10 +0000 (UTC) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Lp6DBUXHaMkr64Mn58Ga68nGA1sj0tgdW Content-Type: multipart/mixed; boundary="jJrNf05Px3Hbaag2a9QRa35A7tkD60Fl3"; protected-headers="v1" From: Wei Tang To: emacs-orgmode@gnu.org Message-ID: Subject: [PATCH] org-babel-execute-buffer "No surrounding element" error --jJrNf05Px3Hbaag2a9QRa35A7tkD60Fl3 Content-Type: multipart/mixed; boundary="------------17DA05924AE2124212A608F5" Content-Language: en-US This is a multi-part message in MIME format. --------------17DA05924AE2124212A608F5 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable I was trying to use org-babel-execute-buffer to update all org-babel code block results for a org document. It works fine when the code block is visible, but when it's hidden, I got the "user-error: No surrounding element" error and nothing was executed. Adding `(outline-show-all)` fixed this issue for me. Does this look like a good solution? -- Wei --------------17DA05924AE2124212A608F5 Content-Type: text/x-patch; name="0001-ob-core.el-Fix-No-surrounding-element-error.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-ob-core.el-Fix-No-surrounding-element-error.patch" =46rom 3b535fa389518b7d7c280952990bc56ddbe01206 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 31 Aug 2017 02:39:54 +0800 Subject: [PATCH] ob-core.el: Fix "No surrounding element" error * ob-core.el (org-babel-execute-buffer): Show all outlines before execution. Without this, when outlines are hidden, executing (org-babel-execute-buffer) gives "No surrounding element" error. TINYCHANGE --- lisp/ob-core.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index d25908d41..a69d4a66b 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -1197,6 +1197,7 @@ the current buffer." (interactive "P") (org-babel-eval-wipe-error-buffer) (org-save-outline-visibility t + (outline-show-all) (org-babel-map-executables nil (if (memq (org-element-type (org-element-context)) '(babel-call inline-babel-call)) --=20 2.14.1 --------------17DA05924AE2124212A608F5-- --jJrNf05Px3Hbaag2a9QRa35A7tkD60Fl3-- --Lp6DBUXHaMkr64Mn58Ga68nGA1sj0tgdW Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEE7HdConzDr1h1sMT4ctl4tIazYFsFAlmnC9QACgkQctl4tIaz YFuKiBAAlFiPmb8RjcOX79g9FrrwYpK1IEaJNvzLCQ7JZsDuz85CaAv8hs9JD9hK bEaDt9GZsmAxNH03cWnMWDcqP8Fmw3i45gCRNygQLDaLkVVMjSEZ3R1RZjuhJ6gp 9ePiTl8HCA0Dm88q9PfF8Ad5Yvyx4oKsjvWyBNmFTfrAftANVm/+R/LmjvPUkemh vbzjkPtjfALxXU5mOICAQrrNEYgtPDpK3Khl5uIdyk+6PQnjMUQvJXpXEoV6qQ7B 11C7MLcL6iyNK1Ich64RiuUG5YWENZvqcQmwF7ZsLDfZIJ9PQ1BrULsCJEESScfU NbQKjOPfjdMMBlo1UUk3I9cIhmDkrwqF8BbcPyCHfFKHz6/t/5UQkQ303cTOQzT3 HQdvabSVOzOE9ppkU39YXp7qn7aNX5QpYmt+1VU3MLEhz0lNq7EzJZxajTjZFsEm DJUzFMozCxF+WOCPXFVX6N6AlWQhyNA3gz5gyOBDHYEr8p/pmRCvw17unQVGfKdE zmqLj4+sSQSfVhGGmiLp3MV65JUf/JCmLU8bI7bXocymK/LwaHqdfPD7ptxbMM3l as1JvrvXzFlPbXEaLdUdq4cknbtF9VXeHZNvp/biSNW85HmbP5RRWCeRYnFBDKxE F74gCDi2GpAMqJGtD8rjMBzbxk6Fo3flJc/mFFWmnvYji/BaiA8= =zSAn -----END PGP SIGNATURE----- --Lp6DBUXHaMkr64Mn58Ga68nGA1sj0tgdW--