From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: jpw@pobox.com (John Paul Wallington) Newsgroups: gmane.emacs.devel Subject: Re: add `read-buffer-completion-ignore-case' ? Date: Mon, 09 Jun 2008 13:10:55 +0100 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1213013551 5476 80.91.229.12 (9 Jun 2008 12:12:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 9 Jun 2008 12:12:31 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 09 14:13:14 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1K5gEq-0006w2-Om for ged-emacs-devel@m.gmane.org; Mon, 09 Jun 2008 14:12:41 +0200 Original-Received: from localhost ([127.0.0.1]:56734 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K5gE3-0003ya-Au for ged-emacs-devel@m.gmane.org; Mon, 09 Jun 2008 08:11:51 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K5gDQ-0003t2-6K for emacs-devel@gnu.org; Mon, 09 Jun 2008 08:11:12 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K5gDO-0003sA-FE for emacs-devel@gnu.org; Mon, 09 Jun 2008 08:11:11 -0400 Original-Received: from [199.232.76.173] (port=41551 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K5gDO-0003s4-5l for emacs-devel@gnu.org; Mon, 09 Jun 2008 08:11:10 -0400 Original-Received: from a-sasl-fastnet.sasl.smtp.pobox.com ([207.106.133.19]:47029 helo=sasl.smtp.pobox.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K5gDN-00077S-PE for emacs-devel@gnu.org; Mon, 09 Jun 2008 08:11:09 -0400 Original-Received: from localhost.localdomain (localhost [127.0.0.1]) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTP id 278DC366B for ; Mon, 9 Jun 2008 08:11:07 -0400 (EDT) Original-Received: from mini.local (host81-158-23-41.range81-158.btcentralplus.com [81.158.23.41]) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTPA id 7BF4E366A for ; Mon, 9 Jun 2008 08:11:04 -0400 (EDT) X-URL: http://www.shootybangbang.com/ X-Attribution: JPW X-NSA-Fodder: passwd MDA Glock import ISEC New World Order Al-Qaeda Panama X-Face: #uahb@^mo@bA"{q'"a4y[w$n3/V:haD\; YenWcT7)kXYx3/>#[DD9ExVe}; 9FG6X`l!Dm"V peub=u!&&?}s~{TOPtGdH)KA}/qCr; d"Gr*'9_V1PE@+K'tk2/Iq@PBKtJ+]&,CP9_Fl8'*R]LCR0| 6q; Xey'`:DX+)S.]p[KP^sNe`8B\W6(Nw{o5i)y+I!h=0bU5L`Tj`~Q0!G"t(s7o7eh)J\>P>,!~/w $$jGEVa%H%8(jTv In-Reply-To: (John Paul Wallington's message of "Sun, 08 Jun 2008 22:28:30 +0100") User-Agent: Microsoft Gnus Express, Build 513.230 X-Pobox-Relay-ID: 23AD45EE-361D-11DD-9F3D-F9737025C2AA-02562057!a-sasl-fastnet.pobox.com X-detected-kernel: by monty-python.gnu.org: Solaris 10 (beta) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:98796 Archived-At: I wrote: > Is it okay to install the following change? > > It adds a customizable variable, `read-buffer-completion-ignore-case', > that specifies the case-sensitivity of completion for `read-buffer'. > Its default value is nil, meaning that `read-buffer' is case-sensitive > when completing buffer names. > > 2008-06-08 John Paul Wallington > > * minibuf.c (read_buffer_completion_ignore_case): New variable. > (syms_of_minibuf): Declare and initialise it. > (Fread_buffer): Bind `completion-ignore-case' to respect it. > Mention it and `read-buffer-function' in docstring. > > --- minibuf.c.~1.353.~ 2008-06-05 20:28:48.000000000 +0100 > +++ minibuf.c 2008-06-08 22:10:01.000000000 +0100 [...] Doh. That patch didn't work, 'cos I forgot to unbind_to at the end. Here's a revised one: --- minibuf.c.~1.353.~ 2008-06-05 20:28:48.000000000 +0100 +++ minibuf.c 2008-06-09 12:57:35.000000000 +0100 @@ -109,6 +109,9 @@ /* Function to call to read a buffer name. */ Lisp_Object Vread_buffer_function; +/* Nonzero means completion ignores case when reading buffer name. */ +int read_buffer_completion_ignore_case; + /* Nonzero means completion ignores case. */ int completion_ignore_case; @@ -1178,17 +1181,25 @@ If DEF is a list of default values, return its first element. If optional third arg REQUIRE-MATCH is non-nil, only existing buffer names are allowed. -The argument PROMPT should be a string ending with a colon and a space. */) +The argument PROMPT should be a string ending with a colon and a space. + +See also `read-buffer-completion-ignore-case' and `read-buffer-function'. */) (prompt, def, require_match) Lisp_Object prompt, def, require_match; { Lisp_Object args[4]; + Lisp_Object tem; unsigned char *s; int len; + int count = SPECPDL_INDEX (); + if (BUFFERP (def)) def = XBUFFER (def)->name; - + + specbind (Qcompletion_ignore_case, + read_buffer_completion_ignore_case ? Qt : Qnil); + if (NILP (Vread_buffer_function)) { if (!NILP (def)) @@ -1218,9 +1229,9 @@ prompt = Fformat (3, args); } - return Fcompleting_read (prompt, intern ("internal-complete-buffer"), - Qnil, require_match, Qnil, Qbuffer_name_history, - def, Qnil); + tem = Fcompleting_read (prompt, intern ("internal-complete-buffer"), + Qnil, require_match, Qnil, Qbuffer_name_history, + def, Qnil); } else { @@ -1228,8 +1239,9 @@ args[1] = prompt; args[2] = def; args[3] = require_match; - return Ffuncall(4, args); + tem = Ffuncall(4, args); } + return unbind_to (count, tem); } static Lisp_Object @@ -2117,6 +2129,10 @@ doc: /* If this is non-nil, `read-buffer' does its work by calling this function. */); Vread_buffer_function = Qnil; + DEFVAR_BOOL ("read-buffer-completion-ignore-case", &read_buffer_completion_ignore_case, + doc: /* *Non-nil means when reading a buffer name completion ignores case. */); + read_buffer_completion_ignore_case = 0; + DEFVAR_LISP ("minibuffer-setup-hook", &Vminibuffer_setup_hook, doc: /* Normal hook run just after entry to minibuffer. */); Vminibuffer_setup_hook = Qnil;