all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] org-babel-insert-result: Fix wrong-type-argument markerp nil
@ 2022-11-08 18:17 Bruno Barbier
  2022-11-09  2:33 ` Ihor Radchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Bruno Barbier @ 2022-11-08 18:17 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 85 bytes --]


Hi,

Here is a small patch for a corner case in `org-babel-insert-result'.

Bruno



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch org-babel-insert-result: Fix wrong-type-argument markerp nil --]
[-- Type: text/x-diff, Size: 1092 bytes --]

From 288e2631ef60eeaee32f1107754aeb521247d54b Mon Sep 17 00:00:00 2001
From: Bruno BARBIER <brubar.cs@gmail.com>
Date: Sun, 6 Nov 2022 13:57:40 +0100
Subject: [PATCH] org-babel-insert-result: Fix wrong-type-argument markerp nil

lisp/ob-core.el (org-babel-insert-result): Don't reset the marker
`end' if it is not defined.
---
 lisp/ob-core.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 22d60cfe6..91938d7e5 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2596,7 +2596,7 @@ (defun org-babel-insert-result (result &optional result-params info hash lang ex
                           (message "Code block returned no value%s." time-info)
                         (message "Code block produced no output%s." time-info))
                     (message "Code block evaluation complete%s." time-info))))
-	    (set-marker end nil)
+	    (when end (set-marker end nil))
 	    (when outside-scope (narrow-to-region visible-beg visible-end))
 	    (set-marker visible-beg nil)
 	    (set-marker visible-end nil)))))))
-- 
2.37.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] org-babel-insert-result: Fix wrong-type-argument markerp nil
  2022-11-08 18:17 [PATCH] org-babel-insert-result: Fix wrong-type-argument markerp nil Bruno Barbier
@ 2022-11-09  2:33 ` Ihor Radchenko
  2022-11-09  6:37   ` Bruno Barbier
  0 siblings, 1 reply; 6+ messages in thread
From: Ihor Radchenko @ 2022-11-09  2:33 UTC (permalink / raw)
  To: Bruno Barbier; +Cc: emacs-orgmode

Bruno Barbier <perso.bruno.barbier@free.fr> writes:

> Here is a small patch for a corner case in `org-babel-insert-result'.

Thanks, but could you please explain a bit more about this corner case?

> lisp/ob-core.el (org-babel-insert-result): Don't reset the marker
> `end' if it is not defined.

`end' must be always defined because
(setq end (copy-marker (point) t))
must be executed.

Nothing must ever set `end' to nil. Otherwise, a couple of other places
in code will also be broken.

Your patch, if addressing a valid scenario, is not treating the root
cause; just the symptom.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] org-babel-insert-result: Fix wrong-type-argument markerp nil
  2022-11-09  2:33 ` Ihor Radchenko
@ 2022-11-09  6:37   ` Bruno Barbier
  2022-11-09  6:42     ` Ihor Radchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Bruno Barbier @ 2022-11-09  6:37 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode



Ihor Radchenko <yantar92@posteo.net> writes:

> Bruno Barbier <perso.bruno.barbier@free.fr> writes:
>
>> Here is a small patch for a corner case in `org-babel-insert-result'.
>
> Thanks, but could you please explain a bit more about this corner case?

> `end' must be always defined because
> (setq end (copy-marker (point) t))
> must be executed.

If the body of the unwind-protect throw an error, the variable 'end'
might still be nil. It's set to nil when declared with the 'let' form.

>
> Your patch, if addressing a valid scenario, is not treating the root
> cause; just the symptom.

You're right. I was investigating an other bug. That
'wrong-type-argument markerp nil' was just hiding the real bug to me.

Bruno


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] org-babel-insert-result: Fix wrong-type-argument markerp nil
  2022-11-09  6:37   ` Bruno Barbier
@ 2022-11-09  6:42     ` Ihor Radchenko
  2022-11-09  6:44       ` Ihor Radchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Ihor Radchenko @ 2022-11-09  6:42 UTC (permalink / raw)
  To: Bruno Barbier; +Cc: emacs-orgmode

Bruno Barbier <perso.bruno.barbier@free.fr> writes:

>> Thanks, but could you please explain a bit more about this corner case?
>
>> `end' must be always defined because
>> (setq end (copy-marker (point) t))
>> must be executed.
>
> If the body of the unwind-protect throw an error, the variable 'end'
> might still be nil. It's set to nil when declared with the 'let' form.

Good point. Then, I agree that the patch can be merged as is.
Applied onto main amending the commit message.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=7f72807aead9c350d85513702deb04722b65a25b

>> Your patch, if addressing a valid scenario, is not treating the root
>> cause; just the symptom.
>
> You're right. I was investigating an other bug. That
> 'wrong-type-argument markerp nil' was just hiding the real bug to me.

Let us know once you gather enough details.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] org-babel-insert-result: Fix wrong-type-argument markerp nil
  2022-11-09  6:42     ` Ihor Radchenko
@ 2022-11-09  6:44       ` Ihor Radchenko
  2022-11-09  6:59         ` Bruno Barbier
  0 siblings, 1 reply; 6+ messages in thread
From: Ihor Radchenko @ 2022-11-09  6:44 UTC (permalink / raw)
  To: Bruno Barbier; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=7f72807aead9c350d85513702deb04722b65a25b

Oops. The right link is
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=620a96dd682191f49cbe83dee516bb566b9d0127

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] org-babel-insert-result: Fix wrong-type-argument markerp nil
  2022-11-09  6:44       ` Ihor Radchenko
@ 2022-11-09  6:59         ` Bruno Barbier
  0 siblings, 0 replies; 6+ messages in thread
From: Bruno Barbier @ 2022-11-09  6:59 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=620a96dd682191f49cbe83dee516bb566b9d0127


Thanks Ihor.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-11-09  6:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-08 18:17 [PATCH] org-babel-insert-result: Fix wrong-type-argument markerp nil Bruno Barbier
2022-11-09  2:33 ` Ihor Radchenko
2022-11-09  6:37   ` Bruno Barbier
2022-11-09  6:42     ` Ihor Radchenko
2022-11-09  6:44       ` Ihor Radchenko
2022-11-09  6:59         ` Bruno Barbier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.