unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* add read-file-name-completion-ignore-case user variable ?
@ 2004-06-24 22:24 John Paul Wallington
  2004-06-25  9:20 ` David Kastrup
  2004-07-04  3:55 ` John Paul Wallington
  0 siblings, 2 replies; 6+ messages in thread
From: John Paul Wallington @ 2004-06-24 22:24 UTC (permalink / raw)


Stef's change of 2004-03-17 to `read-file-name' to set
completion-ignore-case for case-insensitive systems is hard for users
to configure -- Viktor Haag pointed this out on the gnu.emacs.help
newsgroup.

How about having a `read-file-name-completion-ignore-case' user
variable rather than hard-coding a value according to system type?
We could still set its default value according to system type.

2004-06-24  John Paul Wallington  <jpw@gnu.org>

	* fileio.c (read_file_name_completion_ignore_case): New variable.
	(syms_of_fileio): Declare and initialise it.
	(Fread_file_name): Bind completion_ignore_case to respect it.

Index: fileio.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/fileio.c,v
retrieving revision 1.505
diff -u -r1.505 fileio.c
--- fileio.c	22 May 2004 22:17:17 -0000	1.505
+++ fileio.c	24 Jun 2004 22:24:35 -0000
@@ -206,6 +206,9 @@
 /* Current predicate used by read_file_name_internal.  */
 Lisp_Object Vread_file_name_predicate;
 
+/* Nonzero means completion ignores case when reading file name*/
+int read_file_name_completion_ignore_case;
+
 /* Nonzero means, when reading a filename in the minibuffer,
  start out by inserting the default directory into the minibuffer. */
 int insert_default_directory;
@@ -6284,10 +6287,8 @@
     }
 
   count = SPECPDL_INDEX ();
-#if defined VMS || defined DOS_NT || defined MAC_OSX
-  specbind (intern ("completion-ignore-case"), Qt);
-#endif
-
+  specbind (intern ("completion-ignore-case"),
+	    read_file_name_completion_ignore_case ? Qt : Qnil);
   specbind (intern ("minibuffer-completing-file-name"), Qt);
   specbind (intern ("read-file-name-predicate"),
 	    (NILP (predicate) ? Qfile_exists_p : predicate));
@@ -6523,6 +6524,10 @@
 	       doc: /* Current predicate used by `read-file-name-internal'.  */);
   Vread_file_name_predicate = Qnil;
 
+  DEFVAR_BOOL ("read-file-name-completion-ignore-case", &read_file_name_completion_ignore_case,
+	       doc: /* *Non-nil means when reading a file name completion ignores case.  */);
+  read_file_name_completion_ignore_case = 0;
+
   DEFVAR_BOOL ("insert-default-directory", &insert_default_directory,
 	       doc: /* *Non-nil means when reading a filename start with default dir in minibuffer.
 If the initial minibuffer contents are non-empty, you can usually

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: add read-file-name-completion-ignore-case user variable ?
  2004-06-24 22:24 add read-file-name-completion-ignore-case user variable ? John Paul Wallington
@ 2004-06-25  9:20 ` David Kastrup
  2004-06-25  9:31   ` David Kastrup
  2004-07-04  3:55 ` John Paul Wallington
  1 sibling, 1 reply; 6+ messages in thread
From: David Kastrup @ 2004-06-25  9:20 UTC (permalink / raw)
  Cc: emacs-devel

John Paul Wallington <jpw@gnu.org> writes:

> Stef's change of 2004-03-17 to `read-file-name' to set
> completion-ignore-case for case-insensitive systems is hard for users
> to configure -- Viktor Haag pointed this out on the gnu.emacs.help
> newsgroup.
> 
> How about having a `read-file-name-completion-ignore-case' user
> variable rather than hard-coding a value according to system type?
> We could still set its default value according to system type.

Which your change does not seem to do.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: add read-file-name-completion-ignore-case user variable ?
  2004-06-25  9:20 ` David Kastrup
@ 2004-06-25  9:31   ` David Kastrup
  2004-06-25 10:28     ` John Paul Wallington
  0 siblings, 1 reply; 6+ messages in thread
From: David Kastrup @ 2004-06-25  9:31 UTC (permalink / raw)
  Cc: emacs-devel

David Kastrup <dak@gnu.org> writes:

> John Paul Wallington <jpw@gnu.org> writes:
> 
> > Stef's change of 2004-03-17 to `read-file-name' to set
> > completion-ignore-case for case-insensitive systems is hard for users
> > to configure -- Viktor Haag pointed this out on the gnu.emacs.help
> > newsgroup.
> > 
> > How about having a `read-file-name-completion-ignore-case' user
> > variable rather than hard-coding a value according to system type?
> > We could still set its default value according to system type.
> 
> Which your change does not seem to do.

Anyway, I am not sure this is the right approach.  After all, case
insensitivity is not as much an operating system, but a file system
feature.  When doing file name completion on a Windows partition
mounted on a typical Linux root file system, the "natural" behavior
would be case sensitive completion in the path components up to the
mount point, and case insensitive after that.

I doubt, however, that it would be easy to access the relevant
information from the OS.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: add read-file-name-completion-ignore-case user variable ?
  2004-06-25  9:31   ` David Kastrup
@ 2004-06-25 10:28     ` John Paul Wallington
  0 siblings, 0 replies; 6+ messages in thread
From: John Paul Wallington @ 2004-06-25 10:28 UTC (permalink / raw)
  Cc: emacs-devel

> > > How about having a `read-file-name-completion-ignore-case' user
> > > variable rather than hard-coding a value according to system type?
> > > We could still set its default value according to system type.
> > 
> > Which your change does not seem to do.

Yeah.  I think this would be a neat feature to add but am not sure
whether the default value should be t for any system type.
 
> Anyway, I am not sure this is the right approach.  After all, case
> insensitivity is not as much an operating system, but a file system
> feature.  When doing file name completion on a Windows partition
> mounted on a typical Linux root file system, the "natural" behavior
> would be case sensitive completion in the path components up to the
> mount point, and case insensitive after that.

As you note, case insensitivity doesn't map cleanly to system type.
For example, Mac OS X's standard filesystem HFS+ is case-insensitive
whilst preserving the case of filenames but it can use traditional
case-sensitive UFS instead/as well and it supports NFS too.

Also, rhe users' preference for case sensitivity/insensitivity in
completions when reading a file name need not correspond to the
characteristics of particular filesystems.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: add read-file-name-completion-ignore-case user variable ?
  2004-06-24 22:24 add read-file-name-completion-ignore-case user variable ? John Paul Wallington
  2004-06-25  9:20 ` David Kastrup
@ 2004-07-04  3:55 ` John Paul Wallington
  2004-07-04 17:47   ` Steven Tamm
  1 sibling, 1 reply; 6+ messages in thread
From: John Paul Wallington @ 2004-07-04  3:55 UTC (permalink / raw)


I wrote:

> Stef's change of 2004-03-17 to `read-file-name' to set
> completion-ignore-case for case-insensitive systems is hard for users
> to configure -- Viktor Haag pointed this out on the gnu.emacs.help
> newsgroup.
>
> How about having a `read-file-name-completion-ignore-case' user
> variable rather than hard-coding a value according to system type?
> We could still set its default value according to system type.

Does anyone object to the following patch?
If not, I shall install it.


2004-07-04  John Paul Wallington  <jpw@gnu.org>

	* fileio.c (read_file_name_completion_ignore_case): New variable.
	(syms_of_fileio): Declare and initialise it.
	(Fread_file_name): Bind `completion-ignore-case' to respect it.

Index: fileio.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/fileio.c,v
retrieving revision 1.505
diff -u -r1.505 fileio.c
--- fileio.c	22 May 2004 22:17:17 -0000	1.505
+++ fileio.c	4 Jul 2004 03:56:48 -0000
@@ -206,6 +206,9 @@
 /* Current predicate used by read_file_name_internal.  */
 Lisp_Object Vread_file_name_predicate;
 
+/* Nonzero means completion ignores case when reading file name.  */
+int read_file_name_completion_ignore_case;
+
 /* Nonzero means, when reading a filename in the minibuffer,
  start out by inserting the default directory into the minibuffer. */
 int insert_default_directory;
@@ -6284,10 +6287,8 @@
     }
 
   count = SPECPDL_INDEX ();
-#if defined VMS || defined DOS_NT || defined MAC_OSX
-  specbind (intern ("completion-ignore-case"), Qt);
-#endif
-
+  specbind (intern ("completion-ignore-case"),
+	    read_file_name_completion_ignore_case ? Qt : Qnil);
   specbind (intern ("minibuffer-completing-file-name"), Qt);
   specbind (intern ("read-file-name-predicate"),
 	    (NILP (predicate) ? Qfile_exists_p : predicate));
@@ -6523,6 +6524,14 @@
 	       doc: /* Current predicate used by `read-file-name-internal'.  */);
   Vread_file_name_predicate = Qnil;
 
+  DEFVAR_BOOL ("read-file-name-completion-ignore-case", &read_file_name_completion_ignore_case,
+	       doc: /* *Non-nil means when reading a file name completion ignores case.  */);
+#if defined VMS || defined DOS_NT || defined MAC_OSX
+  read_file_name_completion_ignore_case = 1;
+#else
+  read_file_name_completion_ignore_case = 0;
+#endif
+
   DEFVAR_BOOL ("insert-default-directory", &insert_default_directory,
 	       doc: /* *Non-nil means when reading a filename start with default dir in minibuffer.
 If the initial minibuffer contents are non-empty, you can usually

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: add read-file-name-completion-ignore-case user variable ?
  2004-07-04  3:55 ` John Paul Wallington
@ 2004-07-04 17:47   ` Steven Tamm
  0 siblings, 0 replies; 6+ messages in thread
From: Steven Tamm @ 2004-07-04 17:47 UTC (permalink / raw)
  Cc: emacs-devel

My only suggestion would be to use defined MAC_OS instead of defined 
MAC_OSX.

But more generally, using a system type to imply the use of a 
particular filesystem is fine right now, but may not be a good solution 
in the future.   For example, if you are using an NFS drive, it should 
be case-sensitive on the Mac.  If you are one of the minority of Mac OS 
X (or darwin) users that use a UFS style filesystem, it should be also 
be case-sensitive.

So what emacs should "really" do is pay attention to the filesystem 
type of the relevant directory.  However, that seems hard.

-Steven

On Jul 3, 2004, at 8:55 PM, John Paul Wallington wrote:

> I wrote:
>
>> Stef's change of 2004-03-17 to `read-file-name' to set
>> completion-ignore-case for case-insensitive systems is hard for users
>> to configure -- Viktor Haag pointed this out on the gnu.emacs.help
>> newsgroup.
>>
>> How about having a `read-file-name-completion-ignore-case' user
>> variable rather than hard-coding a value according to system type?
>> We could still set its default value according to system type.
>
> Does anyone object to the following patch?
> If not, I shall install it.
>
>
> 2004-07-04  John Paul Wallington  <jpw@gnu.org>
>
> 	* fileio.c (read_file_name_completion_ignore_case): New variable.
> 	(syms_of_fileio): Declare and initialise it.
> 	(Fread_file_name): Bind `completion-ignore-case' to respect it.
>
> Index: fileio.c
> ===================================================================
> RCS file: /cvsroot/emacs/emacs/src/fileio.c,v
> retrieving revision 1.505
> diff -u -r1.505 fileio.c
> --- fileio.c	22 May 2004 22:17:17 -0000	1.505
> +++ fileio.c	4 Jul 2004 03:56:48 -0000
> @@ -206,6 +206,9 @@
>  /* Current predicate used by read_file_name_internal.  */
>  Lisp_Object Vread_file_name_predicate;
>
> +/* Nonzero means completion ignores case when reading file name.  */
> +int read_file_name_completion_ignore_case;
> +
>  /* Nonzero means, when reading a filename in the minibuffer,
>   start out by inserting the default directory into the minibuffer. */
>  int insert_default_directory;
> @@ -6284,10 +6287,8 @@
>      }
>
>    count = SPECPDL_INDEX ();
> -#if defined VMS || defined DOS_NT || defined MAC_OSX
> -  specbind (intern ("completion-ignore-case"), Qt);
> -#endif
> -
> +  specbind (intern ("completion-ignore-case"),
> +	    read_file_name_completion_ignore_case ? Qt : Qnil);
>    specbind (intern ("minibuffer-completing-file-name"), Qt);
>    specbind (intern ("read-file-name-predicate"),
>  	    (NILP (predicate) ? Qfile_exists_p : predicate));
> @@ -6523,6 +6524,14 @@
>  	       doc: /* Current predicate used by `read-file-name-internal'.  
> */);
>    Vread_file_name_predicate = Qnil;
>
> +  DEFVAR_BOOL ("read-file-name-completion-ignore-case", 
> &read_file_name_completion_ignore_case,
> +	       doc: /* *Non-nil means when reading a file name completion 
> ignores case.  */);
> +#if defined VMS || defined DOS_NT || defined MAC_OSX
> +  read_file_name_completion_ignore_case = 1;
> +#else
> +  read_file_name_completion_ignore_case = 0;
> +#endif
> +
>    DEFVAR_BOOL ("insert-default-directory", &insert_default_directory,
>  	       doc: /* *Non-nil means when reading a filename start with 
> default dir in minibuffer.
>  If the initial minibuffer contents are non-empty, you can usually
>
>
> _______________________________________________
> Emacs-devel mailing list
> Emacs-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-07-04 17:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-24 22:24 add read-file-name-completion-ignore-case user variable ? John Paul Wallington
2004-06-25  9:20 ` David Kastrup
2004-06-25  9:31   ` David Kastrup
2004-06-25 10:28     ` John Paul Wallington
2004-07-04  3:55 ` John Paul Wallington
2004-07-04 17:47   ` Steven Tamm

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).