From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [Feature Request] Add an dispatcher command (keybinding) for inserting dynamic blocks Date: Thu, 27 Dec 2018 11:59:48 +0100 Message-ID: <874lazb5gb.fsf@nicolasgoaziou.fr> References: <871s7lvn4n.fsf@gmail.com> <3332dc93-afb1-0854-6298-06e0939aff3a@free.fr> <87wop1zcwo.fsf@nicolasgoaziou.fr> <87k1k57xt7.fsf@gmail.com> <877eg1yxy6.fsf@nicolasgoaziou.fr> <874lb4sqnk.fsf@gmail.com> <87ftuoznas.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:35553) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gcTOP-0003E8-JM for emacs-orgmode@gnu.org; Thu, 27 Dec 2018 05:59:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gcTOK-0007nL-KY for emacs-orgmode@gnu.org; Thu, 27 Dec 2018 05:59:57 -0500 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:53063) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gcTOK-0007lB-Dw for emacs-orgmode@gnu.org; Thu, 27 Dec 2018 05:59:52 -0500 In-Reply-To: <87ftuoznas.fsf@gmail.com> (stardiviner's message of "Sun, 23 Dec 2018 15:59:07 +0800") 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: stardiviner Cc: Thierry Banel , emacs-orgmode@gnu.org Hello, stardiviner writes: > The re-generated patch is in attachment. Thank you! > --- > doc/org-manual.org | 9 ++++++--- > etc/ORG-NEWS | 14 ++++++++++++++ > lisp/org-clock.el | 5 +++++ > lisp/org-colview.el | 6 +++++- > lisp/org-keys.el | 6 ++---- > lisp/org.el | 46 +++++++++++++++++++++++++++++++++++++++++++++ You forgot to mark removed functions, e.g., `org-clock-report', as obsolete in "org-compat.el". > Org supports /dynamic blocks/ in Org documents. They are inserted > with begin and end markers like any other code block, but the contents > -are updated automatically by a user function. For example, {{{kbd(C-c > -C-x C-r)}}} inserts a dynamic table that updates the work time (see > -[[*Clocking Work Time]]). > +are updated automatically by a user function. You can use dispatch > +command ~org-dynamic-block-insert-dispatch~, which is bind to > +keybinding {{{kbd(C-c C-x i)}}} by default. which is bound to {{{kbd(C-c C-x i)}}} by default. Don't forget the #+kindex and #+findex entries above. > +(defcustom org-dynamic-block-parameters nil > + "An alist of properties that defines all the Org dynamic blocks." What is the key of the alist? The possible keywords for the plist? This should appear in the docstring. So far, only :function is supported. If there is no plan for extending that, maybe a plain alist, e.g., ("type" . function) should suffice? I.e., isn't mimicking `org-link-set-parameters' a bit too much? WDYT? > +(defun org-dynamic-block-insert-dblock (dblock-type) > + "Select and insert an Org type dynamic block DBLOCK-TYPE. Insert a dynamic block of type DBLOCK-TYPE. > +This is a dispatching function which prompts for the type of > +dynamic block to insert." When used interactively, select the dynamic block types among defined types, per `org-dynamic-block-set-parameters'. Also, once we agree on the design, would you mind writing some tests? Regards, -- Nicolas Goaziou