* Unclear org-icompleting-read interface
@ 2015-06-25 13:15 Oleh Krehel
2015-06-25 13:51 ` Nicolas Goaziou
0 siblings, 1 reply; 6+ messages in thread
From: Oleh Krehel @ 2015-06-25 13:15 UTC (permalink / raw)
To: emacs-orgmode
Hi all,
The current `org-icompleting-read' is defined as taking only `&rest
args', which can be as many as 8, all of them without a name.
I propose to update the definition to:
(cl-defun org-icompleting-read (prompt collection
&key predicate require-match
initial-input hist def inherit-input-method)
;; ...
)
Let me know if you like the idea. If so, there are 43 calls to
`org-icompleting-read' in the source that need to be updated. Some of
them should as they are, since usually only the first two arguments are
used.
This change would make the calls to `org-icompleting-read' much easier
to read.
regards,
Oleh
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Unclear org-icompleting-read interface
2015-06-25 13:15 Unclear org-icompleting-read interface Oleh Krehel
@ 2015-06-25 13:51 ` Nicolas Goaziou
2015-06-25 14:23 ` Oleh Krehel
2015-06-25 14:36 ` Rasmus
0 siblings, 2 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2015-06-25 13:51 UTC (permalink / raw)
To: Oleh Krehel; +Cc: emacs-orgmode
Hello,
Oleh Krehel <ohwoeowho@gmail.com> writes:
> The current `org-icompleting-read' is defined as taking only `&rest
> args', which can be as many as 8, all of them without a name.
>
> I propose to update the definition to:
>
> (cl-defun org-icompleting-read (prompt collection
> &key predicate require-match
> initial-input hist def inherit-input-method)
> ;; ...
> )
I'd rather not use cl-defun in code base, which is slightly more
difficult to understand, and hardly unavoidable. Moreover,
`org-icompleting-read' is not harder to read as `completing-read'
anyway.
> This change would make the calls to `org-icompleting-read' much easier
> to read.
While we're at it, I suggest instead to make `org-icompleting-read' an
obsolete alias for `completing-read' in Org 8.4.
`partial-completing-mode' is obsolete since Emacs 24.1.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Unclear org-icompleting-read interface
2015-06-25 13:51 ` Nicolas Goaziou
@ 2015-06-25 14:23 ` Oleh Krehel
2015-06-25 14:36 ` Rasmus
1 sibling, 0 replies; 6+ messages in thread
From: Oleh Krehel @ 2015-06-25 14:23 UTC (permalink / raw)
To: emacs-orgmode
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Moreover,
> `org-icompleting-read' is not harder to read as `completing-read'
> anyway.
I disagree on this. `completing-read' at least declares its own argument
list. So it's possible to distinguish which argument is which, albeit
with some effort for a large amount of arguments.
For example, in this case there are 5 args, the first two I know by
heart. Not the other three.
(setq prop (org-icompleting-read
"Property: " (mapcar 'list (org-buffer-property-keys t nil t))
nil nil prop))
And the arglist: "&rest args", instead of "prompt collection predicate
require-match initial-input hist def inherit-input-method".
Here's how it would look like for a `cl-defun' variant:
(org-icompleting-read
"Property: " (mapcar 'list (org-buffer-property-keys t nil t))
:initial-input prop)
Down to 3 arguments from 5, and the last one is very easy to understand,
even without eldoc.
In any case this also solves the problem of the argument list:
(define-obsolete-function-alias
'org-icompleting-read 'completing-read)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Unclear org-icompleting-read interface
2015-06-25 13:51 ` Nicolas Goaziou
2015-06-25 14:23 ` Oleh Krehel
@ 2015-06-25 14:36 ` Rasmus
2015-06-25 16:30 ` Nicolas Goaziou
1 sibling, 1 reply; 6+ messages in thread
From: Rasmus @ 2015-06-25 14:36 UTC (permalink / raw)
To: emacs-orgmode
Hi,
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Oleh Krehel <ohwoeowho@gmail.com> writes:
>
>> The current `org-icompleting-read' is defined as taking only `&rest
>> args', which can be as many as 8, all of them without a name.
>>
>> I propose to update the definition to:
>>
>> (cl-defun org-icompleting-read (prompt collection
>> &key predicate require-match
>> initial-input hist def inherit-input-method)
>> ;; ...
>> )
>
> I'd rather not use cl-defun in code base, which is slightly more
> difficult to understand, and hardly unavoidable. Moreover,
> `org-icompleting-read' is not harder to read as `completing-read'
> anyway.
I agree. It's confusing how the docstring and the λ is written, but it's
just a "front-end" for completing-read. A reference to completing-read
should be added to the docstring.
>> This change would make the calls to `org-icompleting-read' much easier
>> to read.
>
> While we're at it, I suggest instead to make `org-icompleting-read' an
> obsolete alias for `completing-read' in Org 8.4.
> `partial-completing-mode' is obsolete since Emacs 24.1.
That was my "feeling" about org-icompleting-read as well last time I
looked at it (also a message by Oleh). For org 8.4 we can also get rid of
all the iswitchb stuff. Good times ahead...
Rasmus
--
This is the kind of tedious nonsense up with which I will not put
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Unclear org-icompleting-read interface
2015-06-25 14:36 ` Rasmus
@ 2015-06-25 16:30 ` Nicolas Goaziou
2015-06-25 16:39 ` Rasmus
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2015-06-25 16:30 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode
Hello,
Rasmus <rasmus@gmx.us> writes:
> I agree. It's confusing how the docstring and the λ is written, but it's
> just a "front-end" for completing-read. A reference to completing-read
> should be added to the docstring.
Isn't it already the case?
> That was my "feeling" about org-icompleting-read as well last time I
> looked at it (also a message by Oleh). For org 8.4 we can also get rid of
> all the iswitchb stuff. Good times ahead...
Indeed. Can't wait...
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Unclear org-icompleting-read interface
2015-06-25 16:30 ` Nicolas Goaziou
@ 2015-06-25 16:39 ` Rasmus
0 siblings, 0 replies; 6+ messages in thread
From: Rasmus @ 2015-06-25 16:39 UTC (permalink / raw)
To: emacs-orgmode
Hi,
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Rasmus <rasmus@gmx.us> writes:
>
>> I agree. It's confusing how the docstring and the λ is written, but it's
>> just a "front-end" for completing-read. A reference to completing-read
>> should be added to the docstring.
>
> Isn't it already the case?
I don't know. I have been saying stupid things recently. Lack of sleep
is probably the reason, but I like to think that somehow my org version is
messed up.
org-icompleting-read is a compiled Lisp function in /usr/share/emacs/site-lisp/org/
(org-icompleting-read &rest ARGS)
Completing-read using ‘ido-mode’ or ‘iswitchb’ speedups if available.
A lot of older org functions have terrible documentation. I had to study
the code, several calls of org-icompleting-read, and completion-read to
understand what it was doing.
>> That was my "feeling" about org-icompleting-read as well last time I
>> looked at it (also a message by Oleh). For org 8.4 we can also get rid of
>> all the iswitchb stuff. Good times ahead...
>
> Indeed. Can't wait...
Me to. I hope I will have more time in Eternal September.
Rasmus
--
May the Force be with you
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-06-25 16:50 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-25 13:15 Unclear org-icompleting-read interface Oleh Krehel
2015-06-25 13:51 ` Nicolas Goaziou
2015-06-25 14:23 ` Oleh Krehel
2015-06-25 14:36 ` Rasmus
2015-06-25 16:30 ` Nicolas Goaziou
2015-06-25 16:39 ` Rasmus
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).