From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Newsgroups: gmane.emacs.bugs Subject: bug#7752: 24.0.50; [PATCH] Add completing-read-function Date: Tue, 28 Dec 2010 23:43:25 +0000 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1293580420 11815 80.91.229.12 (28 Dec 2010 23:53:40 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 28 Dec 2010 23:53:40 +0000 (UTC) To: 7752@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Dec 29 00:53:35 2010 Return-path: Envelope-to: geb-bug-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 1PXjMF-0005ex-0n for geb-bug-gnu-emacs@m.gmane.org; Wed, 29 Dec 2010 00:53:35 +0100 Original-Received: from localhost ([127.0.0.1]:49791 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PXjMD-0002Zg-Us for geb-bug-gnu-emacs@m.gmane.org; Tue, 28 Dec 2010 18:53:33 -0500 Original-Received: from [140.186.70.92] (port=50303 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PXjM7-0002ZO-EL for bug-gnu-emacs@gnu.org; Tue, 28 Dec 2010 18:53:28 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PXjM5-0001Xr-Ta for bug-gnu-emacs@gnu.org; Tue, 28 Dec 2010 18:53:27 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52173) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PXjM5-0001Xn-R2 for bug-gnu-emacs@gnu.org; Tue, 28 Dec 2010 18:53:25 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1PXj6E-0007ZA-MN; Tue, 28 Dec 2010 18:37:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Leo Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: monnier@iro.umontreal.ca, drew.adams@oracle.com, bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 Dec 2010 23:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 7752 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: Stefan Monnier , "Drew Adams" Original-Received: via spool by submit@debbugs.gnu.org id=B.129357942029071 (code B ref -1); Tue, 28 Dec 2010 23:37:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 28 Dec 2010 23:37:00 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PXj6B-0007Yq-4I for submit@debbugs.gnu.org; Tue, 28 Dec 2010 18:36:59 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PXj68-0007Yc-M2 for submit@debbugs.gnu.org; Tue, 28 Dec 2010 18:36:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PXjCh-00082m-0H for submit@debbugs.gnu.org; Tue, 28 Dec 2010 18:43:48 -0500 Original-Received: from lists.gnu.org ([199.232.76.165]:37079) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PXjCg-00082i-SH for submit@debbugs.gnu.org; Tue, 28 Dec 2010 18:43:42 -0500 Original-Received: from [140.186.70.92] (port=38314 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PXjCb-0001Xx-FD for bug-gnu-emacs@gnu.org; Tue, 28 Dec 2010 18:43:42 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PXjCW-00081a-25 for bug-gnu-emacs@gnu.org; Tue, 28 Dec 2010 18:43:37 -0500 Original-Received: from mail-ww0-f49.google.com ([74.125.82.49]:55695) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PXjCV-00081N-Kd for bug-gnu-emacs@gnu.org; Tue, 28 Dec 2010 18:43:31 -0500 Original-Received: by wwb17 with SMTP id 17so9985760wwb.30 for ; Tue, 28 Dec 2010 15:43:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:x-debbugs-cc :date:message-id:mime-version:content-type; bh=irqAkXq7VY4tLWwRCcBAP/EzeNJJLKM2tetzOSxG9bk=; b=QaEpnMukhSaaVmHza4busAFL+6DUu6UChkm1OK1lNTr3hTAU2wC3l4n3osmQxfEMmX u0NPPWSsAyqnePqsVAEZhQSyEN+eUzzLmvjqGIzk76gT6ne2nuVN5055FHR+PU85Xurx v5oyaa7Ee7Ly/IksnQRPsGj/TrvH7YrQJtXQw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:x-debbugs-cc:date:message-id:mime-version :content-type; b=uFDjrmG6KxRpy8eYy1YHNjw5l5Jd0AT9QW7xIGcTt1b/2psJXNJ1kJ4KYtqwWNwO1o YDTKlx0UOivvWTYrmjGMBXjHrqId4E0OOU0rBkFJ1h72JsYk4pzoCAWFy64f8yZAu+0J AnyNXT4otKZBafF8gmtKzlXgedcbGyouiHCgc= Original-Received: by 10.227.127.199 with SMTP id h7mr8446585wbs.35.1293579809354; Tue, 28 Dec 2010 15:43:29 -0800 (PST) Original-Received: from Victoria.local (cpc1-cmbg13-0-0-cust596.5-4.cable.virginmedia.com [86.9.122.85]) by mx.google.com with ESMTPS id 11sm9667454wbi.0.2010.12.28.15.43.27 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 28 Dec 2010 15:43:28 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 28 Dec 2010 18:37:02 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:42902 Archived-At: --=-=-= The attached patch (against 24) adds completing-read-function for customising the behaviour of completing-read. See also the discussion in emacs-devel: http://thread.gmane.org/gmane.emacs.devel/134000 (I am in the process of setting up an Emacs bzr repo and familiarising myself with bzr. I expect to be able to commit this myself in the beginning of February.) Leo --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-New-variable-completing-read-function.patch Content-Description: 0001-New-variable-completing-read-function.patch >From 6370abee847415199be3bb86503af408c160b2b9 Mon Sep 17 00:00:00 2001 From: Leo Date: Tue, 28 Dec 2010 23:30:48 +0000 Subject: [PATCH] New variable completing-read-function that can be used to customize completing-read. --- lisp/ChangeLog | 5 +++++ lisp/ido.el | 8 ++++---- src/ChangeLog | 6 ++++++ src/minibuf.c | 33 ++++++++++++++++++++++++++++++++- 4 files changed, 47 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f9443cf..a778f94 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-12-28 Leo + + * ido.el (ido-read-internal): Fix. + (ido-completing-read): Fix compatibility with completing-read. + 2010-12-28 Chong Yidong * tool-bar.el (tool-bar-setup): Remove :enable conditions, which diff --git a/lisp/ido.el b/lisp/ido.el index 84ae931..ff38ae7 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -1984,7 +1984,7 @@ If INITIAL is non-nil, it specifies the initial input string." (setq ido-exit nil) (setq ido-final-text (catch 'ido - (completing-read + (completing-read-default (ido-make-prompt item prompt) '(("dummy" . 1)) nil nil ; table predicate require-match (prog1 ido-text-init (setq ido-text-init nil)) ;initial-contents @@ -4741,13 +4741,13 @@ See `read-directory-name' for additional parameters." (concat ido-current-directory filename))))) ;;;###autoload -(defun ido-completing-read (prompt choices &optional predicate require-match initial-input hist def) +(defun ido-completing-read (prompt choices &optional predicate require-match initial-input hist def inherit-input-method) "Ido replacement for the built-in `completing-read'. Read a string in the minibuffer with ido-style completion. PROMPT is a string to prompt with; normally it ends in a colon and a space. CHOICES is a list of strings which are the possible completions. -PREDICATE is currently ignored; it is included to be compatible - with `completing-read'. +PREDICATE and INHERIT-INPUT-METHOD is currently ignored; it is included + to be compatible with `completing-read'. If REQUIRE-MATCH is non-nil, the user is not allowed to exit unless the input is (or completes to) an element of CHOICES or is null. If the input is null, `ido-completing-read' returns DEF, or an empty diff --git a/src/ChangeLog b/src/ChangeLog index 96e697a..02c60a2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-12-28 Leo + + * minibuf.c (completing-read-function): New variable. + (completing-read-default): Rename from completing-read. + (completing-read): Call completing-read-function. + 2010-12-28 Andreas Schwab * xterm.h (x_alloc_lighter_color_for_widget): Restore declaration. diff --git a/src/minibuf.c b/src/minibuf.c index 0f3def6..ee6b56b 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -130,6 +130,7 @@ Lisp_Object Vminibuffer_completion_table, Qminibuffer_completion_table; Lisp_Object Vminibuffer_completion_predicate, Qminibuffer_completion_predicate; Lisp_Object Vminibuffer_completion_confirm, Qminibuffer_completion_confirm; Lisp_Object Vminibuffer_completing_file_name; +Lisp_Object Qcompleting_read_default, Vcompleting_read_function; Lisp_Object Quser_variable_p; @@ -1726,7 +1727,27 @@ If INHERIT-INPUT-METHOD is non-nil, the minibuffer inherits the current input method and the setting of `enable-multibyte-characters'. Completion ignores case if the ambient value of - `completion-ignore-case' is non-nil. */) + `completion-ignore-case' is non-nil. + +See also `completing-read-function'. */) + (Lisp_Object prompt, Lisp_Object collection, Lisp_Object predicate, Lisp_Object require_match, Lisp_Object initial_input, Lisp_Object hist, Lisp_Object def, Lisp_Object inherit_input_method) +{ + Lisp_Object args[9]; + args[0] = Vcompleting_read_function; + args[1] = prompt; + args[2] = collection; + args[3] = predicate; + args[4] = require_match; + args[5] = initial_input; + args[6] = hist; + args[7] = def; + args[8] = inherit_input_method; + return Ffuncall (9, args); +} + +DEFUN ("completing-read-default", Fcompleting_read_default, Scompleting_read_default, 2, 8, 0, + doc: /* Default method for reading from the minibuffer with completion. +See `completing-read' for the meaning of the arguments. */) (Lisp_Object prompt, Lisp_Object collection, Lisp_Object predicate, Lisp_Object require_match, Lisp_Object initial_input, Lisp_Object hist, Lisp_Object def, Lisp_Object inherit_input_method) { Lisp_Object val, histvar, histpos, position; @@ -2024,6 +2045,9 @@ syms_of_minibuf (void) minibuf_save_list = Qnil; staticpro (&minibuf_save_list); + Qcompleting_read_default = intern_c_string ("completing-read-default"); + staticpro (&Qcompleting_read_default); + Qcompletion_ignore_case = intern_c_string ("completion-ignore-case"); staticpro (&Qcompletion_ignore_case); @@ -2163,6 +2187,12 @@ If the value is `confirm-after-completion', the user may exit with an doc: /* Non-nil means completing file names. */); Vminibuffer_completing_file_name = Qnil; + DEFVAR_LISP ("completing-read-function", + &Vcompleting_read_function, + doc: /* The function called by `completing-read' to do the work. +It should accept the same arguments as `completing-read'. */); + Vcompleting_read_function = Qcompleting_read_default; + DEFVAR_LISP ("minibuffer-help-form", &Vminibuffer_help_form, doc: /* Value that `help-form' takes on inside the minibuffer. */); Vminibuffer_help_form = Qnil; @@ -2238,5 +2268,6 @@ properties. */); defsubr (&Stest_completion); defsubr (&Sassoc_string); defsubr (&Scompleting_read); + defsubr (&Scompleting_read_default); } -- 1.7.3.4 --=-=-=--