From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: stardiviner <numbchild@gmail.com>
Cc: Thierry Banel <tbanelwebmin@free.fr>, emacs-orgmode@gnu.org
Subject: Re: [Feature Request] Add an dispatcher command (keybinding) for inserting dynamic blocks
Date: Sat, 22 Dec 2018 23:54:25 +0100 [thread overview]
Message-ID: <877eg1yxy6.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <87k1k57xt7.fsf@gmail.com> (stardiviner's message of "Thu, 20 Dec 2018 10:10:28 +0800")
Hello,
stardiviner <numbchild@gmail.com> 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.
> 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.
>
> (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.
> +are updated automatically by a user function. You can use dispatch
You need two spaces at the end of sentences.
> +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.
> +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)}}}
> +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.
> +*** ~org-dynamic-block-insert-dispatch~
> +
> +Use default keybinding =[C-c C-x i]= to run command
=<C-c C-x i>=
> -(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-*'.
> ;;;###autoload
> -(defun org-columns-insert-dblock ()
> +(defun org-insert-dblock:columnview ()
Ditto.
> -(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.
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".
> + "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.
> +(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?
> +(defun org-dynamic-block-insert-dispatch (dblock-type)
I don't think "dispatch" should be in the function name.
> + "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.
> +matches the pattern `org-insert-dblock:*'"
I don't think it is true. It dispatches functions listed as :function
value.
Regards,
--
Nicolas Goaziou
next prev parent reply other threads:[~2018-12-22 22:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877eg1yxy6.fsf@nicolasgoaziou.fr \
--to=mail@nicolasgoaziou.fr \
--cc=emacs-orgmode@gnu.org \
--cc=numbchild@gmail.com \
--cc=tbanelwebmin@free.fr \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).