gizmomogwai / org-kanban

Kanban table for org-mode
MIT License
238 stars 18 forks source link

implement universal arguments handling for initialize #6

Closed Trevoke closed 6 years ago

Trevoke commented 6 years ago

Hey!

I did not write tests for this, but I wanted to show you how this might look in elisp.

This way, you have:

  1. M-x org-kanban/initialize placing the kanban at the bottom
  2. C-u M-x org-kanban/initialize placing the kanban at the top (below the #+TODO line)

For reference, C-h f interactive will show you the various arguments you can pass to interactive.

I wasn't sure how you wanted to create a private function, usually I see them as package--function-name, but then again I usually see package-function-name for public functions, so I tried // for your package.

gizmomogwai commented 6 years ago

Thanks for the pull request. I copied the elisp function namespacing from expand region (there er/ is used as prefix) which i like a little more than er- ... Problem is, that this gives usually warning with elisp linters, but still ... I never thought about the private function thing, as there is no real way in enforcing this to my knowledge ... but the -- or // makes totally sense. Do you really think that its necessary to have a function that puts the kanban board at the top or the bottom? I would suggest to have to the default put it to the current point and only in the ctrl-u 1 case to the top or in ctrl-u 0 case to the bottom. What do you think of that?

gizmomogwai commented 6 years ago

could you also put the two commits together? i think there is no point in the one with the message ...

gizmomogwai commented 6 years ago

I read again about interactive "P" ... If you are allright with this, I would suggest to use C-u to put the kanban at the beginning, C-u C-u to put it at the end, and leave the default to put it at the point?

Trevoke commented 6 years ago

That sounds good.

There is indeed no way to enforce private functions, the double character is the convention. expand-region is actually fairly unconventional, the / is not the most common elisp style. I wrote a minor mode over here you can use if you want to look at some hopefully simple elisp: https://github.com/Trevoke/sqlup-mode.el/blob/master/sqlup-mode.el

I actually think it would be nice to have functions that specify initialize-here, initialize-at-beginning and initialize-at-end, so it can be used in scripts -- and then have initialize be the function that can take the universal argument, and default to here.. Give me a minute. :)

On Sun, Apr 8, 2018 at 11:46 AM, Christian Köstlin <notifications@github.com

wrote:

I read again about interactive "P" ... If you are allright with this, I would suggest to use C-u to put the kanban at the beginning, C-u C-u to put it at the end, and leave the default to put it at the point?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gizmomogwai/org-kanban/pull/6#issuecomment-379560070, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEJSeOupXoW0PPXpbZBkhPVeu_VJ0knks5tmjC_gaJpZM4TLhky .

Trevoke commented 6 years ago

Okay, that's done. What do you think?

org-kanban/initialize can be called through a script and manually, and the others can be called directly as well.

Trevoke commented 6 years ago

What do you think of that now?