all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: stardiviner <numbchild@gmail.com>
To: org-mode <emacs-orgmode@gnu.org>
Subject: [Feature Request] Add an dispatcher command (keybinding) for inserting dynamic blocks
Date: Fri, 16 Nov 2018 09:15:20 +0800	[thread overview]
Message-ID: <871s7lvn4n.fsf@gmail.com> (raw)

In package `orgtbl-aggregate` has bellowing command to insert different dynamic blocks.

#+begin_src emacs-lisp
(defun org-insert-dblock ()
  "Inserts an org table dynamic block.
This is a dispatching function which prompts for the type
of dynamic block to insert. It dispatches to functions
which names matches the pattern `org-insert-dblock:*'"
  (interactive)
  (let ((fun
	 (intern
	  (format
	   "org-insert-dblock:%s" 
	   (org-icompleting-read
	    "Kind of dynamic block: "
	    (mapcar (lambda (x)
		      (replace-regexp-in-string
		       "^org-insert-dblock:"
		       ""
		       (symbol-name x)))
		    (apropos-internal "^org-insert-dblock:")))))))
    (if (functionp fun)
	(funcall fun)
      (message "No such dynamic block: %s" fun))))
#+end_src

This command matches Org Mode API style.

I hope Org Mode can have this built-in. Because there are some other dynamic blocks. They can use this dispatcher function.

For example org-gantt dynamic block, I write a function manually:

#+begin_src emacs-lisp
(defun org-insert-dblock:org-gantt ()
  "Insert org-gantt dynamic block."
  (interactive)
  (org-create-dblock
   (list :name "org-gantt"
         :file "data/images/project-gantt-chart.png"
         :imagemagick t
         :tikz-options "scale=1.5, every node/.style={scale=1.5}"
         :weekend-style "{draw=blue!10, line width=1pt}"
         :workday-style "{draw=blue!5, line width=.75pt}"
         :show-progress 'if-value
         :progress-source 'cookie-clocksum
         :no-date-headlines 'inactive
         :parameters "y unit title=.7cm, y unit chart=.9cm"
         :tags-group-style '(("test"."group label font=\\color{blue}")
                             ("toast"."group label font=\\color{green}"))
         :tags-bar-style '(("test"."bar label font=\\color{blue}")
                           ("toast"."bar label font=\\color{green}")))))
#+end_src

-- 
[ stardiviner ]
       I try to make every word tell the meaning what I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      

             reply	other threads:[~2018-11-16  1:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-16  1:15 stardiviner [this message]
2018-11-16 17:59 ` [Feature Request] Add an dispatcher command (keybinding) for inserting dynamic blocks Thierry Banel
2018-11-25 10:09   ` Nicolas Goaziou
2018-12-03  6:43     ` stardiviner
2018-12-20  2:10     ` stardiviner
2018-12-22 22:54       ` Nicolas Goaziou
2018-12-23  6:26         ` stardiviner
2018-12-23  6:28         ` stardiviner
2018-12-23  7:59           ` stardiviner
2018-12-27 10:59             ` Nicolas Goaziou
2018-12-27 15:25               ` stardiviner
2018-12-30  9:27                 ` Nicolas Goaziou
2019-01-02  0:12                   ` stardiviner
2019-01-02 14:57                     ` Nicolas Goaziou
2019-01-03 12:19                       ` stardiviner

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871s7lvn4n.fsf@gmail.com \
    --to=numbchild@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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 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.