From: Kyle Meyer <kyle@kyleam.com>
To: Axel Kielhorn <org-mode@axelkielhorn.de>, emacs-orgmode@gnu.org
Subject: [PATCH 4/4] org: Retain prefix arg when dispatching dynamic block commands
Date: Tue, 5 May 2020 00:15:22 -0400 [thread overview]
Message-ID: <20200505041522.30222-5-kyle@kyleam.com> (raw)
In-Reply-To: <20200505041522.30222-1-kyle@kyleam.com>
* lisp/org.el (org-dynamic-block-insert-dblock): Add an interactive-p
argument that is non-nil for interactive calls and signals to call the
dynamic block function interactively.
org-clock-report takes a prefix argument. When it had a regular
binding, this was easy to access. As of 34b71a0ca (Add a dispatcher
command for inserting dynamic blocks, 2018-12-23), its only "binding"
is through the dynamic block dispatcher. Make it possible to supply a
prefix argument in that context too.
---
lisp/org.el | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index bf82a49cc..751223f06 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9652,15 +9652,18 @@ (defun org-dynamic-block-define (type func)
(`nil (push (cons type func) org-dynamic-block-alist))
(def (setcdr def func))))
-(defun org-dynamic-block-insert-dblock (type)
+(defun org-dynamic-block-insert-dblock (type &optional interactive-p)
"Insert a dynamic block of type TYPE.
When used interactively, select the dynamic block types among
-defined types, per `org-dynamic-block-define'."
+defined types, per `org-dynamic-block-define'. If INTERACTIVE-P
+is non-nil, call the dynamic block function interactively."
(interactive (list (completing-read "Dynamic block: "
- (org-dynamic-block-types))))
+ (org-dynamic-block-types))
+ t))
(pcase (org-dynamic-block-function type)
(`nil (error "No such dynamic block: %S" type))
- ((and f (pred functionp)) (funcall f))
+ ((and f (pred functionp))
+ (if interactive-p (call-interactively f) (funcall f)))
(_ (error "Invalid function for dynamic block %S" type))))
(defun org-dblock-update (&optional arg)
--
2.26.1
next prev parent reply other threads:[~2020-05-05 4:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-03 7:05 Manual 7.5.3 Capturing column view outdated Axel Kielhorn
2020-05-05 4:15 ` [PATCH 0/4] dynamic block-related fixes Kyle Meyer
2020-05-05 4:15 ` [PATCH 1/4] manual: Remove stale information about dynamic block bindings Kyle Meyer
2020-05-05 4:15 ` [PATCH 2/4] orgcard: Update binding for org-columns-insert-dblock Kyle Meyer
2020-05-05 7:18 ` Axel Kielhorn
2020-05-05 12:39 ` Kyle Meyer
2020-05-05 4:15 ` [PATCH 3/4] Autoload dynamic block definitions Kyle Meyer
2020-05-05 4:15 ` Kyle Meyer [this message]
2020-05-06 2:48 ` [PATCH 0/4] dynamic block-related fixes Kyle Meyer
2020-05-23 9:26 ` Manual 7.5.3 Capturing column view outdated Bastien
2020-05-23 15:49 ` Kyle Meyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200505041522.30222-5-kyle@kyleam.com \
--to=kyle@kyleam.com \
--cc=emacs-orgmode@gnu.org \
--cc=org-mode@axelkielhorn.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).