emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

New `read-buffer-completion-ignore-case' variable? [was Re: Release plan


From: John Paul Wallington
Subject: New `read-buffer-completion-ignore-case' variable? [was Re: Release plans]
Date: Thu, 31 Jul 2008 01:56:44 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.990 (windows-nt)

Chong Yidong <address@hidden> writes:

>> Just a reminder: we will begin the feature freeze for Emacs 23.1 at the
>> end of this month.
>
> If anyone on this list has a patch that is still waiting for approval or
> further comments, now would be a good time to ping.

Rats.  I wish I had noticed this earlier:- I'm just catching up with
my emacs-devel backlog.  How about this patch?  I've been running with
it for awhile.  Maybe the default value should be t for Windows
systems?


2008-07-30  John Paul Wallington  <address@hidden>

        * 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.


Index: src/minibuf.c
===================================================================
RCS file: /sources/emacs/emacs/src/minibuf.c,v
retrieving revision 1.354
diff -u -r1.354 minibuf.c
--- src/minibuf.c       10 Jun 2008 18:41:01 -0000      1.354
+++ src/minibuf.c       30 Jul 2008 00:34:44 -0000
@@ -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
@@ -2111,6 +2123,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;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]