From mboxrd@z Thu Jan 1 00:00:00 1970 From: stardiviner Subject: [Feature Request] Add an dispatcher command (keybinding) for inserting dynamic blocks Date: Fri, 16 Nov 2018 09:15:20 +0800 Message-ID: <871s7lvn4n.fsf@gmail.com> Reply-To: numbchild@gmail.com Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57932) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNSjK-0002Ma-EW for emacs-orgmode@gnu.org; Thu, 15 Nov 2018 20:15:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNSjH-00072t-3G for emacs-orgmode@gnu.org; Thu, 15 Nov 2018 20:15:30 -0500 Received: from [61.175.244.13] (port=47908 helo=dark.localdomain) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNSjF-00070z-2i for emacs-orgmode@gnu.org; Thu, 15 Nov 2018 20:15:26 -0500 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" 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