From mboxrd@z Thu Jan 1 00:00:00 1970 From: stardiviner Subject: Re: [Feature Request] Add an dispatcher command (keybinding) for inserting dynamic blocks Date: Sun, 23 Dec 2018 14:26:54 +0800 Message-ID: <875zvksqq9.fsf@gmail.com> References: <871s7lvn4n.fsf@gmail.com> <3332dc93-afb1-0854-6298-06e0939aff3a@free.fr> <87wop1zcwo.fsf@nicolasgoaziou.fr> <87k1k57xt7.fsf@gmail.com> <877eg1yxy6.fsf@nicolasgoaziou.fr> 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]:37530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gaxDk-00079i-Hf for emacs-orgmode@gnu.org; Sun, 23 Dec 2018 01:26:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gaxDg-0008Kw-CX for emacs-orgmode@gnu.org; Sun, 23 Dec 2018 01:26:40 -0500 Received: from [61.175.244.13] (port=54104 helo=dark.localdomain) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gaxDe-000878-MY for emacs-orgmode@gnu.org; Sun, 23 Dec 2018 01:26:36 -0500 In-reply-to: <877eg1yxy6.fsf@nicolasgoaziou.fr> 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: Nicolas Goaziou Cc: Thierry Banel , emacs-orgmode@gnu.org Nicolas Goaziou writes: > Hello, > > stardiviner writes: > >> I add code patch in attachment. Nicolas, can you review it? > > Thank you. Some comments follow. > >> After running test with "make test", I got some failed test might >> related to my code changing. But I checked out the tests, have not >> found anywhere invoking the renamed functions. > > They are not related. I run `make test` (after adding my commit) again on `next` branch. Got failed tests: 12 unexpected results: FAILED ob-D/inhomogeneous_table FAILED ob-D/list-list-var FAILED ob-D/list-var FAILED ob-D/vector-var FAILED test-org-clock/clocktable/lang FAILED test-org-colview/columns-move-left FAILED test-org-colview/columns-move-right FAILED test-org-colview/columns-new FAILED test-org-colview/columns-next-allowed-value FAILED test-org-colview/columns-scope FAILED test-org-colview/columns-width FAILED test-org-colview/dblock All are not related to my commit. about test-org-{clock,colview}/* tests, they are failed because of void functions. > >> Ran 814 tests, 808 results as expected, 6 unexpected (2018-12-20 09:57:41+0800) >> 9 expected failures >> >> 6 unexpected results: >> FAILED ob-D/inhomogeneous_table >> FAILED ob-D/list-list-var >> FAILED ob-D/list-var >> FAILED ob-D/vector-var > > I don't use D, so I cannot help here. > >> FAILED test-org-clock/clocktable/lang >> FAILED test-org-colview/columns-width > > This is probably due to a non-default variable leaking in the test. The > full error may help. > >> * lisp/org.el (org-dynamic-block-insert-dispatch): The dispatch command >> for inserting dynamic blocks. > > "New function." is enough. Fixed. >> >> (org-dynamic-block-parameters, org-dynamic-block-functions, >> org-dynamic-block-types, org-dynamic-block-set-parameters, >> org-dynamic-block-get-parameter): New custom option, and new functions >> about dynamic blocks. > > New variables... New functons, etc. Fixed > >> +are updated automatically by a user function. You can use dispatch > > You need two spaces at the end of sentences. Fixed > >> +command ~org-dynamic-block-insert-dispatch~ which is bind to >> +keybinding {{{kbd(C-c C-x i)}}} by default. > > command ~org-dynamic-block-insert-dispatch~, which is bound to > {{{kbd(C-c C-x i)}}} by default. Fixed > >> +For example, {{{kbd(C-c C-x i)}}} + ~clocktable~ inserts a dynamic > > For example, {{{kbd(C-c C-x i c l o c k t a b l e RET)}}} Fixed > >> +table that updates the work time (see [[*Clocking Work Time]]). >> >> Dynamic blocks can have names and function parameters. The syntax is >> similar to source code block specifications: >> diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS >> index 811e98147..5bce606f9 100644 >> --- a/etc/ORG-NEWS >> +++ b/etc/ORG-NEWS >> @@ -12,6 +12,11 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org. >> >> * Version 9.2 >> ** Incompatible changes >> +*** Renamed some dynamic block generate functions name >> + >> +- Renamed ~org-clock-report~ to ~org-insert-dblock:clocktable~ >> +- Renamed ~org-columns-insert-dblock~ to ~org-insert-dblock:columnview~ >> + > > This change will not go in Org 9.2. You need to apply it on top of 9.3, > aka, "next" branch. Fixed > >> +*** ~org-dynamic-block-insert-dispatch~ >> + >> +Use default keybinding =[C-c C-x i]= to run command > > == Fixed > >> -(defun org-clock-report (&optional arg) >> +(defun org-insert-dblock:clocktable (&optional arg) >> "Update or create a table containing a report about clocked time. > > This function is in the wrong namespace. It should be `org-clock-*'. Fixed. I restored original function names. > >> ;;;###autoload >> -(defun org-columns-insert-dblock () >> +(defun org-insert-dblock:columnview () > > Ditto. Fixed > >> -(define-obsolete-function-alias 'org-insert-columns-dblock >> - 'org-columns-insert-dblock "Org 9.0") > > Since you replaced `org-columns-insert-dblock', you need to update the > alias, not remove it. Fixed. I restored original function names. > > You also need to introduce other aliases for the functions you renamed. > >> +(defcustom org-dynamic-block-parameters >> + '(("columnview" :function org-insert-dblock:columnview) >> + ("clocktable" :function org-insert-dblock:clocktable)) > > Why loading them by default? Org clock may not be available. It seems > better to initialize to nil and use `org-dynamic-blocks-set-parameter' > to fill in the variable in "org-clock.el". Fixed > >> + "An alist of properties that defines all the Org dynamic blocks." >> + :type '(alist :tag "dynamic block name" >> + :value-type plist) >> + :group 'org-block >> + :package-version '(Org . "9.1")) > > It should be "9.3". > > Also, it is missing, e.g., :safe #'listp. Fixed > >> +(defun org-dynamic-block-get-parameter (type key) >> + "Get TYPE dynamic block property for KEY. >> +TYPE is a string and KEY is a plist keyword." >> + (plist-get >> + (cdr (assoc type org-dynamic-block-parameters)) >> + key)) >> + >> +(defun org-dynamic-block-set-parameters (type &rest parameters) >> + "Set dynamic block TYPE properties to PARAMETERS. >> +PARAMETERS should be :key val pairs. Use it like `org-link-set-parameters'." > > Missing a space. Also, the second sentence is not helpful. Instead what > are the supported keywords? Fixed > >> +(defun org-dynamic-block-insert-dispatch (dblock-type) > > I don't think "dispatch" should be in the function name. I use `org-dynamic-block-insert-dblock` now. > >> + "Select and insert an Org type dynamic block. >> +This is a dispatching function which prompts for the type of >> +dynamic block to insert. It dispatches to functions which names > > Missing space. Fixed > >> +matches the pattern `org-insert-dblock:*'" > > I don't think it is true. It dispatches functions listed as :function > value. Fixed > > > Regards, Ask one off-topic question. How to configure Emacs to auto insert two spaces after sentence? What is the "next" branch? Is it like "develop" related to "master" branch? -- [ 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