emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [Feature Request] Add an dispatcher command (keybinding) for ins


From: Nicolas Goaziou
Subject: Re: [O] [Feature Request] Add an dispatcher command (keybinding) for inserting dynamic blocks
Date: Sat, 22 Dec 2018 23:54:25 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Hello,

stardiviner <address@hidden> 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:address@hidden
>  
>  * 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]