From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: Could org-mode use `completing-read-function' instead of `org-icompleting-read'? Date: Thu, 16 Apr 2015 17:21:12 +0200 Message-ID: <87egnkt7yv.fsf@gmx.us> References: <87egnk17wg.fsf@gmx.us> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39265) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yilbd-0007me-TV for emacs-orgmode@gnu.org; Thu, 16 Apr 2015 11:21:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yilba-00021U-IW for emacs-orgmode@gnu.org; Thu, 16 Apr 2015 11:21:29 -0400 Received: from plane.gmane.org ([80.91.229.3]:35220) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yilba-000218-BR for emacs-orgmode@gnu.org; Thu, 16 Apr 2015 11:21:26 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YilbY-0000DQ-8R for emacs-orgmode@gnu.org; Thu, 16 Apr 2015 17:21:24 +0200 Received: from 46.166.188.202 ([46.166.188.202]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 Apr 2015 17:21:24 +0200 Received: from rasmus by 46.166.188.202 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 Apr 2015 17:21:24 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi Oleh, Oleh Krehel 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 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-org.el-Small-refactor.patch >From 3836d34a10218cfe6a84d9479cbb587a2797a271 Mon Sep 17 00:00:00 2001 From: Rasmus 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 --=-=-=--