From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: Using ido-completions in other packages Date: Fri, 04 Jun 2010 12:57:18 +0200 Message-ID: <87hbljqd4h.fsf@thinkpad.tsdh.de> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1275649112 19762 80.91.229.12 (4 Jun 2010 10:58:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 4 Jun 2010 10:58:32 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jun 04 12:58:27 2010 connect(): No such file or directory Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OKUbW-000071-4N for geh-help-gnu-emacs@m.gmane.org; Fri, 04 Jun 2010 12:58:23 +0200 Original-Received: from localhost ([127.0.0.1]:56227 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OKUbN-0003NR-DO for geh-help-gnu-emacs@m.gmane.org; Fri, 04 Jun 2010 06:58:13 -0400 Original-Received: from [140.186.70.92] (port=51028 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OKUan-0003NM-E0 for help-gnu-emacs@gnu.org; Fri, 04 Jun 2010 06:57:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OKUai-0005fV-Bn for help-gnu-emacs@gnu.org; Fri, 04 Jun 2010 06:57:37 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:56655) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OKUai-0005fB-5C for help-gnu-emacs@gnu.org; Fri, 04 Jun 2010 06:57:32 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OKUae-0008IF-9r for help-gnu-emacs@gnu.org; Fri, 04 Jun 2010 12:57:28 +0200 Original-Received: from tsdh.uni-koblenz.de ([141.26.67.142]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 04 Jun 2010 12:57:28 +0200 Original-Received: from tassilo by tsdh.uni-koblenz.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 04 Jun 2010 12:57:28 +0200 X-Injected-Via-Gmane: http://gmane.org/ connect(): No such file or directory Original-Lines: 41 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: tsdh.uni-koblenz.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:/lutQC2bTbOX+AgigcYeBJSMHps= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:73823 Archived-At: Andrea Crotti writes: Hi Andrea, > I've looked in the code but I don't see what I could substitute, maybe > substituting some functions or advising something else would do the > trick? Basically, if you want to use ido-completion in some code, you would use `ido-comleting-read' instead of `completing-read'. For example, in some home-brewn mode I have something like that: --8<---------------cut here---------------start------------->8--- (if (and (featurep 'ido) ido-mode) ;; ido is available and enabled, so use it. (ido-completing-read "Command: " commands) ;; fallback to normal completion with the ;; most frequently used command as default. (completing-read (concat "Command (defaults to `" (car commands) "'): ") commands nil t nil nil (car commands))) --8<---------------cut here---------------end--------------->8--- You could try to make `completing-read' point to `ido-completing-read': (fset 'completing-read 'ido-completing-read) But that might error in some cases, cause `completing-read' has one optional parameter more than `ido-completing-read'. You might want to create a function `andrea-completing-read' with the exact signature of `completing-read' which just delegates to `ido-completing-read' and throws away the additional parameter, and then do (fset 'completing-read 'andrea-completing-read) In any case: This method is a hammer, so be warned. ;-) Bye, Tassilo