emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: stardiviner <numbchild@gmail.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: Thierry Banel <tbanelwebmin@free.fr>, emacs-orgmode@gnu.org
Subject: Re: [Feature Request] Add an dispatcher command (keybinding) for inserting dynamic blocks
Date: Sun, 23 Dec 2018 14:26:54 +0800	[thread overview]
Message-ID: <875zvksqq9.fsf@gmail.com> (raw)
In-Reply-To: <877eg1yxy6.fsf@nicolasgoaziou.fr>


Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> 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.

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
>
> =<C-c C-x i>=

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

  reply	other threads:[~2018-12-23  6:26 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
2018-12-23  6:26         ` stardiviner [this message]
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=875zvksqq9.fsf@gmail.com \
    --to=numbchild@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    --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).