emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Could org-mode use `completing-read-function' instead of `org-icompleting-read'?
@ 2015-04-16 13:36 Oleh Krehel
  2015-04-16 14:10 ` Rasmus
  0 siblings, 1 reply; 11+ messages in thread
From: Oleh Krehel @ 2015-04-16 13:36 UTC (permalink / raw)
  To: org mode

Hi all,

I was just trying to customize the completion back end for refiling (ido isn't
great for that, even with the ido-vertical upgrade).  And it's not at all easy,
since ido seems to be hard-wired into org-mode's completion.  Could we just
change to use `completing-read-function' instead of `org-icompleting-read'?

regards,
Oleh

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Could org-mode use `completing-read-function' instead of `org-icompleting-read'?
  2015-04-16 13:36 Could org-mode use `completing-read-function' instead of `org-icompleting-read'? Oleh Krehel
@ 2015-04-16 14:10 ` Rasmus
  2015-04-16 14:31   ` Oleh Krehel
  0 siblings, 1 reply; 11+ messages in thread
From: Rasmus @ 2015-04-16 14:10 UTC (permalink / raw)
  To: emacs-orgmode

Hi Oleh,

Oleh Krehel <ohwoeowho@gmail.com> writes:

> I was just trying to customize the completion back end for refiling (ido isn't
> great for that, even with the ido-vertical upgrade).  And it's not at all easy,
> since ido seems to be hard-wired into org-mode's completion.  Could we just
> change to use `completing-read-function' instead of `org-icompleting-read'?

I think it's nicer to use existing features/variables, but comparability
is also an issue.

Perhaps completing-read-function could be used if boundp in
org-icompleting-read.

Things like org-completion-use-ido as a separate variable rather than
ido-everywhere is also a bit annoying IMO.

Do you want to submit a patch?

—Rasmus

-- 
Send from my Emacs

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Could org-mode use `completing-read-function' instead of `org-icompleting-read'?
  2015-04-16 14:10 ` Rasmus
@ 2015-04-16 14:31   ` Oleh Krehel
  2015-04-16 15:21     ` Rasmus
  0 siblings, 1 reply; 11+ messages in thread
From: Oleh Krehel @ 2015-04-16 14:31 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Hi Rasmus,

On Thu, Apr 16, 2015 at 4:10 PM, Rasmus <rasmus@gmx.us> wrote:
> Hi Oleh,
>
> Oleh Krehel <ohwoeowho@gmail.com> writes:
>
>> I was just trying to customize the completion back end for refiling (ido isn't
>> great for that, even with the ido-vertical upgrade).  And it's not at all easy,
>> since ido seems to be hard-wired into org-mode's completion.  Could we just
>> change to use `completing-read-function' instead of `org-icompleting-read'?
>
> I think it's nicer to use existing features/variables, but comparability
> is also an issue.

Alright, I've made so that if `completing-read-function' is
`completing-read-default', nothing changes.  But when it's set, it
used. So now, e.g. `helm-mode' or `ivy-mode' will automatically work.

Oleh

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Could org-mode use `completing-read-function' instead of `org-icompleting-read'?
  2015-04-16 14:31   ` Oleh Krehel
@ 2015-04-16 15:21     ` Rasmus
  2015-04-16 15:30       ` Oleh Krehel
  0 siblings, 1 reply; 11+ messages in thread
From: Rasmus @ 2015-04-16 15:21 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 993 bytes --]

Hi Oleh,

Oleh Krehel <ohwoeowho@gmail.com> writes:

>>> I was just trying to customize the completion back end for refiling
>>> (ido isn't
>>> great for that, even with the ido-vertical upgrade).  And it's not
>>> at all easy,
>>> since ido seems to be hard-wired into org-mode's completion.  Could we just
>>> change to use `completing-read-function' instead of `org-icompleting-read'?
>>
>> I think it's nicer to use existing features/variables, but comparability
>> is also an issue.
>
> Alright, I've made so that if `completing-read-function' is
> `completing-read-default', nothing changes.  But when it's set, it
> used. So now, e.g. `helm-mode' or `ivy-mode' will automatically work.

The change is no good IMO.  For the fix to work one needs to set
org-completion-use-ido.  If this is non-nil it would be weird if ido is
not used.

I don't know how to use helm of ivy.  But I think the attached patch is
better.  Would that work with helm and ivy?

—Rasmus

-- 
Send from my Emacs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org.el-Small-refactor.patch --]
[-- Type: text/x-diff, Size: 2389 bytes --]

From 3836d34a10218cfe6a84d9479cbb587a2797a271 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Thu, 16 Apr 2015 17:15:16 +0200
Subject: [PATCH] org.el: Small refactor

* org.el (org-icompleting-read): Support completing-read-default.
---
 lisp/org.el | 42 +++++++++++++++++++-----------------------
 1 file changed, 19 insertions(+), 23 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 659536d..fbd5ca7 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10502,29 +10502,25 @@ from."
 (defun org-icompleting-read (&rest args)
   "Completing-read using `ido-mode' or `iswitchb' speedups if available."
   (org-without-partial-completion
-   (if (and org-completion-use-ido
-            (fboundp 'ido-completing-read)
-            (boundp 'ido-mode) ido-mode
-            (listp (second args)))
-       (let ((ido-enter-matching-directory nil))
-         (apply (if (eq completing-read-function
-                        'completing-read-default)
-                    'ido-completing-read
-                  completing-read-function)
-                (concat (car args))
-                (if (consp (car (nth 1 args)))
-                    (mapcar 'car (nth 1 args))
-                  (nth 1 args))
-                (cddr args)))
-     (if (and org-completion-use-iswitchb
-              (boundp 'iswitchb-mode) iswitchb-mode
-              (listp (second args)))
-         (apply 'org-iswitchb-completing-read (concat (car args))
-                (if (consp (car (nth 1 args)))
-                    (mapcar 'car (nth 1 args))
-                  (nth 1 args))
-                (cddr args))
-       (apply 'completing-read args)))))
+   (let ((ido-enter-matching-directory nil))
+     (apply
+      (cond ((and org-completion-use-ido
+		  (fboundp 'ido-completing-read)
+		  (boundp 'ido-mode) ido-mode
+		  (listp (second args)))
+	     'ido-completing-read)
+	    ((and org-completion-use-iswitchb
+		  (boundp 'iswitchb-mode) iswitchb-mode
+		  (listp (second args)))
+	     'org-iswitchb-completing-read)
+	    (t (or (and (boundp 'completing-read-function)
+			completing-read-function)
+		   'completing-read)))
+      (concat (car args))
+      (if (consp (car (nth 1 args)))
+	  (mapcar 'car (nth 1 args))
+	(nth 1 args))
+      (cddr args)))))
 
 (defun org-extract-attributes (s)
   "Extract the attributes cookie from a string and set as text property."
-- 
2.3.5


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: Could org-mode use `completing-read-function' instead of `org-icompleting-read'?
  2015-04-16 15:21     ` Rasmus
@ 2015-04-16 15:30       ` Oleh Krehel
  2015-04-16 15:35         ` Oleh Krehel
  2015-04-16 15:47         ` Rasmus
  0 siblings, 2 replies; 11+ messages in thread
From: Oleh Krehel @ 2015-04-16 15:30 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

On Thu, Apr 16, 2015 at 5:21 PM, Rasmus <rasmus@gmx.us> wrote:
> Hi Oleh,
>
> Oleh Krehel <ohwoeowho@gmail.com> writes:
>
>>>> I was just trying to customize the completion back end for refiling
>>>> (ido isn't
>>>> great for that, even with the ido-vertical upgrade).  And it's not
>>>> at all easy,
>>>> since ido seems to be hard-wired into org-mode's completion.  Could we just
>>>> change to use `completing-read-function' instead of `org-icompleting-read'?
>>>
>>> I think it's nicer to use existing features/variables, but comparability
>>> is also an issue.
>>
>> Alright, I've made so that if `completing-read-function' is
>> `completing-read-default', nothing changes.  But when it's set, it
>> used. So now, e.g. `helm-mode' or `ivy-mode' will automatically work.
>
> The change is no good IMO.  For the fix to work one needs to set
> org-completion-use-ido.  If this is non-nil it would be weird if ido is
> not used.
>

> I don't know how to use helm of ivy.  But I think the attached patch is
> better.  Would that work with helm and ivy?

I could live with it, but basically `org-completion-use-ido` says "I
don't care if you've temporarily disabled `ido-mode' or not, I'll use
ido anyway". This isn't a good approach, especially considering that
`ido-mode' is already a convenient minor mode.
Maybe `org-completion-use-ido' should be completely removed, and ido completion
should be used automatically when `ido-mode' is on.

Oleh

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Could org-mode use `completing-read-function' instead of `org-icompleting-read'?
  2015-04-16 15:30       ` Oleh Krehel
@ 2015-04-16 15:35         ` Oleh Krehel
  2015-04-16 17:45           ` Marcin Borkowski
  2015-04-16 15:47         ` Rasmus
  1 sibling, 1 reply; 11+ messages in thread
From: Oleh Krehel @ 2015-04-16 15:35 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

>> I don't know how to use helm of ivy.  But I think the attached patch is
>> better.  Would that work with helm and ivy?

Yes, both work fine.

> I could live with it, but basically `org-completion-use-ido` says "I
> don't care if you've temporarily disabled `ido-mode' or not, I'll use
> ido anyway". This isn't a good approach, especially considering that
> `ido-mode' is already a convenient minor mode.
> Maybe `org-completion-use-ido' should be completely removed, and ido completion
> should be used automatically when `ido-mode' is on.

Oops, just noticed that `ido-mode' is actually in the condition.
All is fine then.

Except that iswitchb is obsolete. Should we remove it?

Oleh

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Could org-mode use `completing-read-function' instead of `org-icompleting-read'?
  2015-04-16 15:30       ` Oleh Krehel
  2015-04-16 15:35         ` Oleh Krehel
@ 2015-04-16 15:47         ` Rasmus
  1 sibling, 0 replies; 11+ messages in thread
From: Rasmus @ 2015-04-16 15:47 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

Oleh Krehel <ohwoeowho@gmail.com> writes:

>> I don't know how to use helm of ivy.  But I think the attached patch is
>> better.  Would that work with helm and ivy?
>
> I could live with it, but basically `org-completion-use-ido` says "I
> don't care if you've temporarily disabled `ido-mode' or not, I'll use
> ido anyway". This isn't a good approach, especially considering that
> `ido-mode' is already a convenient minor mode.
> Maybe `org-completion-use-ido' should be completely removed, and ido completion
> should be used automatically when `ido-mode' is on.

Ideally it should just depend on the whatever default functions set.
E.g. for me read-file-name-function => ido-read-file-name on my system.

Perhaps org-completion-use-ido can be made obsolete and just read
ido-everywhere.

Oleh Krehel <ohwoeowho@gmail.com> writes:

>>> I don't know how to use helm of ivy.  But I think the attached patch is
>>> better.  Would that work with helm and ivy?
>
> Yes, both work fine.
>
>> I could live with it, but basically `org-completion-use-ido` says "I
>> don't care if you've temporarily disabled `ido-mode' or not, I'll use
>> ido anyway". This isn't a good approach, especially considering that
>> `ido-mode' is already a convenient minor mode.
>> Maybe `org-completion-use-ido' should be completely removed, and ido
>> completion
>> should be used automatically when `ido-mode' is on.
>
> Oops, just noticed that `ido-mode' is actually in the condition.
> All is fine then.
>
> Except that iswitchb is obsolete. Should we remove it?

The target release of Org 8.3 is something like Emacs23 (or maybe 24.3?).
In either case we can't obsolete it until 8.4 since iswitchb is obsolete
from 24.4...

—Rasmus

-- 
Send from my Emacs

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Could org-mode use `completing-read-function' instead of `org-icompleting-read'?
  2015-04-16 15:35         ` Oleh Krehel
@ 2015-04-16 17:45           ` Marcin Borkowski
  2015-04-16 18:02             ` Oleh Krehel
  2015-04-16 18:05             ` Rasmus
  0 siblings, 2 replies; 11+ messages in thread
From: Marcin Borkowski @ 2015-04-16 17:45 UTC (permalink / raw)
  To: Rasmus, emacs-orgmode


On 2015-04-16, at 17:35, Oleh Krehel <ohwoeowho@gmail.com> wrote:

>>> I don't know how to use helm of ivy.  But I think the attached patch is
>>> better.  Would that work with helm and ivy?
>
> Yes, both work fine.

Just my 2 cents: what about us Icicles users?  (Apparently, all two of
us, which saddens me...)

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Could org-mode use `completing-read-function' instead of `org-icompleting-read'?
  2015-04-16 17:45           ` Marcin Borkowski
@ 2015-04-16 18:02             ` Oleh Krehel
  2015-04-16 18:05             ` Rasmus
  1 sibling, 0 replies; 11+ messages in thread
From: Oleh Krehel @ 2015-04-16 18:02 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: emacs-orgmode, Rasmus

Hi Marcin,

On Thu, Apr 16, 2015 at 7:45 PM, Marcin Borkowski <mbork@mbork.pl> wrote:
>
> On 2015-04-16, at 17:35, Oleh Krehel <ohwoeowho@gmail.com> wrote:
>
>>>> I don't know how to use helm of ivy.  But I think the attached patch is
>>>> better.  Would that work with helm and ivy?
>>
>> Yes, both work fine.
>
> Just my 2 cents: what about us Icicles users?  (Apparently, all two of
> us, which saddens me...)

Icicles works fine. And any new future package that adheres to the
interface should work too.

Oleh

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Could org-mode use `completing-read-function' instead of `org-icompleting-read'?
  2015-04-16 17:45           ` Marcin Borkowski
  2015-04-16 18:02             ` Oleh Krehel
@ 2015-04-16 18:05             ` Rasmus
  2015-04-16 22:25               ` Marcin Borkowski
  1 sibling, 1 reply; 11+ messages in thread
From: Rasmus @ 2015-04-16 18:05 UTC (permalink / raw)
  To: mbork; +Cc: emacs-orgmode

Hi Marcin,

Marcin Borkowski <mbork@mbork.pl> writes:

> Just my 2 cents: what about us Icicles users?

I'm sure you will tell us :)

IMO Org should use whatever Emacs is already using by default.  Variables
for default chooser programs exist.  If Icicles does not work using the
standard variables perhaps you should get in touch with Drew.  If Org does
not respect some default variable, IMO it's a bug.

Cheers,
Rasmus

-- 
Send from my Emacs

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Could org-mode use `completing-read-function' instead of `org-icompleting-read'?
  2015-04-16 18:05             ` Rasmus
@ 2015-04-16 22:25               ` Marcin Borkowski
  0 siblings, 0 replies; 11+ messages in thread
From: Marcin Borkowski @ 2015-04-16 22:25 UTC (permalink / raw)
  To: emacs-orgmode


On 2015-04-16, at 20:05, Rasmus <rasmus@gmx.us> wrote:

> Hi Marcin,
>
> Marcin Borkowski <mbork@mbork.pl> writes:
>
>> Just my 2 cents: what about us Icicles users?
>
> I'm sure you will tell us :)
>
> IMO Org should use whatever Emacs is already using by default.  Variables
> for default chooser programs exist.  If Icicles does not work using the
> standard variables perhaps you should get in touch with Drew.  If Org does
> not respect some default variable, IMO it's a bug.

I don't have time to do experiments now, but AFAIK, Icicles blends with
the default interface, so - as Oleh pointed out - it should work fine.

> Cheers,
> Rasmus

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-04-16 22:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-16 13:36 Could org-mode use `completing-read-function' instead of `org-icompleting-read'? Oleh Krehel
2015-04-16 14:10 ` Rasmus
2015-04-16 14:31   ` Oleh Krehel
2015-04-16 15:21     ` Rasmus
2015-04-16 15:30       ` Oleh Krehel
2015-04-16 15:35         ` Oleh Krehel
2015-04-16 17:45           ` Marcin Borkowski
2015-04-16 18:02             ` Oleh Krehel
2015-04-16 18:05             ` Rasmus
2015-04-16 22:25               ` Marcin Borkowski
2015-04-16 15:47         ` 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).