all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [Feature Request] Add an dispatcher command (keybinding) for inserting dynamic blocks
@ 2018-11-16  1:15 stardiviner
  2018-11-16 17:59 ` Thierry Banel
  0 siblings, 1 reply; 15+ messages in thread
From: stardiviner @ 2018-11-16  1:15 UTC (permalink / raw)
  To: org-mode

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
      

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

end of thread, other threads:[~2019-01-03 12:17 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-16  1:15 [Feature Request] Add an dispatcher command (keybinding) for inserting dynamic blocks stardiviner
2018-11-16 17:59 ` 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

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.