From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eike Subject: [PATCH] ob-core: check argument to goto-char Date: Sat, 30 Apr 2016 13:05:40 +0200 Message-ID: <87d1p79x17.fsf@eknet.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41866) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1awSit-0000ai-6j for emacs-orgmode@gnu.org; Sat, 30 Apr 2016 07:06:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1awSih-0000oA-C9 for emacs-orgmode@gnu.org; Sat, 30 Apr 2016 07:06:01 -0400 Received: from eknet.org ([188.40.107.134]:34026) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1awSih-0000ll-5b for emacs-orgmode@gnu.org; Sat, 30 Apr 2016 07:05:55 -0400 Received: from 84-73-243-201.dclient.hispeed.ch ([84.73.243.201] helo=ithaka.eknet.org) by eknet.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1awSiU-0005fL-IO for emacs-orgmode@gnu.org; Sat, 30 Apr 2016 11:05:43 +0000 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 --=-=-= Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" --==-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, I have some code that uses `org-babel-insert-result' and I've found that evaluating for example (org-babel-insert-result "a") results in an error. The reason is that `goto-char' is called with a nil argument. I simply put the snippet in a `when' clause, but since the function is quite large I'm not so sure if it's now doing always the correct thing. At least my org files seem still to work=E2=80=A6. I've added the patch in case it is ok to be applied. Maybe someone can have a look at it. Thanks and regards Eike --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iF4EAREIAAYFAlckkYQACgkQ8KbRdVp5FfT3ogEAwAtx7hJoMYAmhl32cWAw8n7o +us+BM4VtMV02Sh4O2QBALG8kAWV6dzMz0vOLkdGm+rCuqLDW76dxbObIxvs+7Ze =pKYL -----END PGP SIGNATURE----- --==-=-=-- --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-ob-core-check-argument-to-goto-char.patch >From fd2182dd3edfb4887cb272a5c93c72660eac0efe Mon Sep 17 00:00:00 2001 From: Eike Kettner Date: Sat, 30 Apr 2016 12:59:41 +0200 Subject: [PATCH] ob-core: check argument to `goto-char' The argument to `goto-char' must not be nil, which occurs if `org-element-property' is called with nil element argument. --- lisp/ob-core.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 71c7aea..088f744 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -2210,8 +2210,10 @@ INFO may provide the values of these header arguments (in the (progn (when outside-scope (widen)) (if existing-result (goto-char existing-result) - (goto-char (org-element-property :end inline)) - (skip-chars-backward " \t")) + (let ((end (org-element-property :end inline))) + (when end + (goto-char end) + (skip-chars-backward " \t")))) (unless inline (setq indent (org-get-indentation)) (forward-line 1)) -- 2.7.4 --=-=-= Content-Type: text/plain -- gpg: AD7AC35E finger print: 137F BB0B 1639 D25F DC5D E59C B412 C5F5 AD7A C35E --=-=-=--