From d6c3ab08b42a78dc521be678fdfc45b4552a9784 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Mon, 19 Feb 2024 13:18:10 +0300 Subject: [PATCH 1/2] org-dynamic-block-insert-dblock: Do not call non-commands interactively * lisp/org.el (org-dynamic-block-insert-dblock): When insert command for a dynamic block is not interactive, do not try to call it interactively. Reported-by: chris Link: https://orgmode.org/list/5790810.DvuYhMxLoT@nixos --- lisp/org.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 231ed094b..719471088 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8796,7 +8796,7 @@ is non-nil, call the dynamic block function interactively." (pcase (org-dynamic-block-function type) (`nil (error "No such dynamic block: %S" type)) ((and f (pred functionp)) - (if interactive-p (call-interactively f) (funcall f))) + (if (and interactive-p (commandp f)) (call-interactively f) (funcall f))) (_ (error "Invalid function for dynamic block %S" type)))) (defun org-dblock-update (&optional arg) From d5b98bcfb5ddaf89213c4b784c34fdcd3bb7ebfe Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Mon, 19 Feb 2024 13:19:11 +0300 Subject: [PATCH 2/2] org-dynamic-block-define: Clarify that FUNC must accept zero arguments * lisp/org.el (org-dynamic-block-define): Update the docstring. Reported-by: chris Link: https://orgmode.org/list/5790810.DvuYhMxLoT@nixos --- lisp/org.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 719471088..0fd5b2762 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8780,7 +8780,7 @@ TYPE is the dynamic block type, as a string." (defun org-dynamic-block-define (type func) "Define dynamic block TYPE with FUNC. TYPE is a string. FUNC is the function creating the dynamic -block of such type." +block of such type. FUNC must be able to accept zero arguments." (pcase (assoc type org-dynamic-block-alist) (`nil (push (cons type func) org-dynamic-block-alist)) (def (setcdr def func))))