unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [David Ponce <david.ponce@wanadoo.fr>] Re: CC Mode 5.30
       [not found] <5bhe6119sc.fsf@lister.roxen.com>
@ 2003-07-05 12:11 ` Martin Stjernholm
  2003-07-05 20:10   ` Martin Stjernholm
  0 siblings, 1 reply; 10+ messages in thread
From: Martin Stjernholm @ 2003-07-05 12:11 UTC (permalink / raw
  Cc: emacs-devel

> From: David Ponce <david.ponce@wanadoo.fr>
> Subject: Re: CC Mode 5.30
> To: mast@lysator.liu.se
> Cc: emacs-devel@gnu.org
> Date: Sat Jul  5 12:18:42 2003 +0200
>
> Hi,
>
>  > > /.../ One possibility is the problem is specific to my platform.  I
>  > > am building emacs with MSVC++ 6.0 and running on windoze 2K.  This
>  > > system may fail to distinguish ".c" from ".C".  /.../
/.../
> That is definitively the case, when system-type is windows-nt (or
> cygwin), Emacs can't distinguish ".c" from ".C".  Here is the relevant
> code in function `set-auto-mode' in files.el, that set
> `case-fold-search' before trying to `string-match' regexps in
> `auto-mode-alist':
>
>              (let ((alist auto-mode-alist)
> 		  (mode nil))
> 	      ;; Find first matching alist entry.
> 	      (let ((case-fold-search
> 		     (memq system-type '(vax-vms windows-nt cygwin))))
> 		(while (and (not mode) alist)
> 		  (if (string-match (car (car alist)) name)
> 		      ....

Wouldn't it be better if it downcased the name and matched it case
sensitively instead? The "normal" case in case sensitive systems is
afaik lowercase, so patterns that are written without special
attention to it use lowercase characters and would match if the name
was simply downcased.

Also, NT file systems can distinguish between upper and lower case
chars visually, even if it doesn't matter when finding files. Thus it
could be an idea to try to match the name case sensitively first, and
if that fails do another attempt with a downcased name (or with
case-fold-search set).

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

* Re: [David Ponce <david.ponce@wanadoo.fr>] Re: CC Mode 5.30
  2003-07-05 12:11 ` [David Ponce <david.ponce@wanadoo.fr>] Re: CC Mode 5.30 Martin Stjernholm
@ 2003-07-05 20:10   ` Martin Stjernholm
  2003-07-06 11:28     ` Jason Rumney
  2003-07-07 16:34     ` [David Ponce <david.ponce@wanadoo.fr>] Re: CC Mode 5.30 Tak Ota
  0 siblings, 2 replies; 10+ messages in thread
From: Martin Stjernholm @ 2003-07-05 20:10 UTC (permalink / raw
  Cc: bug-cc-mode

Martin Stjernholm <mast@lysator.liu.se> wrote:

>> From: David Ponce <david.ponce@wanadoo.fr>
/.../
>> That is definitively the case, when system-type is windows-nt (or
>> cygwin), Emacs can't distinguish ".c" from ".C".

I've now changed the autoload directives in cc-mode.el so that ".c"
comes before ".C" in auto-mode-alist. Still, I think the match method
used in `set-auto-mode' should be changed:

>> Here is the relevant code in function `set-auto-mode' in files.el,
>> that set `case-fold-search' before trying to `string-match' regexps
>> in `auto-mode-alist':
>>
>>              (let ((alist auto-mode-alist)
>> 		  (mode nil))
>> 	      ;; Find first matching alist entry.
>> 	      (let ((case-fold-search
>> 		     (memq system-type '(vax-vms windows-nt cygwin))))
>> 		(while (and (not mode) alist)
>> 		  (if (string-match (car (car alist)) name)
>> 		      ....
>
> Wouldn't it be better if it downcased the name and matched it case
> sensitively instead? The "normal" case in case sensitive systems is
> afaik lowercase, so patterns that are written without special
> attention to it use lowercase characters and would match if the name
> was simply downcased.
>
> Also, NT file systems can distinguish between upper and lower case
> chars visually, even if it doesn't matter when finding files. Thus it
> could be an idea to try to match the name case sensitively first, and
> if that fails do another attempt with a downcased name (or with
> case-fold-search set).

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

* Re: [David Ponce <david.ponce@wanadoo.fr>] Re: CC Mode 5.30
  2003-07-05 20:10   ` Martin Stjernholm
@ 2003-07-06 11:28     ` Jason Rumney
  2003-07-06 13:03       ` set-auto-mode on case insensitive OS:es [Was: Re: CC Mode 5.30] Martin Stjernholm
  2003-07-07 16:34     ` [David Ponce <david.ponce@wanadoo.fr>] Re: CC Mode 5.30 Tak Ota
  1 sibling, 1 reply; 10+ messages in thread
From: Jason Rumney @ 2003-07-06 11:28 UTC (permalink / raw
  Cc: emacs-devel

Martin Stjernholm <mast@lysator.liu.se> writes:

> Martin Stjernholm <mast@lysator.liu.se> wrote:
> 
> >> From: David Ponce <david.ponce@wanadoo.fr>
> /.../
> >> That is definitively the case, when system-type is windows-nt (or
> >> cygwin), Emacs can't distinguish ".c" from ".C".
> 
> I've now changed the autoload directives in cc-mode.el so that ".c"
> comes before ".C" in auto-mode-alist. Still, I think the match method
> used in `set-auto-mode' should be changed:

To what?  What we have now works, provided the entries are in the
right order.




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01


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

* set-auto-mode on case insensitive OS:es [Was: Re: CC Mode 5.30]
  2003-07-06 11:28     ` Jason Rumney
@ 2003-07-06 13:03       ` Martin Stjernholm
  2003-07-07  3:39         ` Richard Stallman
  0 siblings, 1 reply; 10+ messages in thread
From: Martin Stjernholm @ 2003-07-06 13:03 UTC (permalink / raw
  Cc: bug-cc-mode, emacs-devel

Jason Rumney <jasonr@gnu.org> wrote:

>> /.../ Still, I think the match method used in `set-auto-mode'
>> should be changed:
>
> To what?

To what I quoted further down in that mail. I repeat:

    Wouldn't it be better if it downcased the name and matched it case
    sensitively instead? The "normal" case in case sensitive systems
    is afaik lowercase, so patterns that are written without special
    attention to it use lowercase characters and would match if the
    name was simply downcased.

    Also, NT file systems can distinguish between upper and lower case
    chars visually, even if it doesn't matter when finding files. Thus
    it could be an idea to try to match the name case sensitively
    first, and if that fails do another attempt with a downcased name
    (or with case-fold-search set).

> What we have now works, provided the entries are in the right order.

It'd be less dependent on order with my suggestion. That'd be a good
thing since there's no really good way to control the order on
auto-mode-alist from autoload directives in a package, given that one
doesn't want to make assumptions on the entries that are already on
it.

Furthermore, the second paragraph in my suggestion would allow e.g. NT
users to handle .c and .C files differently too.


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01


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

* Re: set-auto-mode on case insensitive OS:es [Was: Re: CC Mode 5.30]
  2003-07-06 13:03       ` set-auto-mode on case insensitive OS:es [Was: Re: CC Mode 5.30] Martin Stjernholm
@ 2003-07-07  3:39         ` Richard Stallman
  2003-07-07  7:08           ` Jason Rumney
  2003-07-07 14:27           ` Stefan Monnier
  0 siblings, 2 replies; 10+ messages in thread
From: Richard Stallman @ 2003-07-07  3:39 UTC (permalink / raw
  Cc: jasonr, emacs-devel, bug-cc-mode

	Wouldn't it be better if it downcased the name and matched it case
	sensitively instead? The "normal" case in case sensitive systems
	is afaik lowercase, so patterns that are written without special
	attention to it use lowercase characters and would match if the
	name was simply downcased.

That seems like a good idea to me.  Is there any case where it would give
bad results?

	Also, NT file systems can distinguish between upper and lower case
	chars visually, even if it doesn't matter when finding files. Thus
	it could be an idea to try to match the name case sensitively
	first, and if that fails do another attempt with a downcased name
	(or with case-fold-search set).

Whether this would really give the desired results is a tricky
question.  I think that we had better wait for MS-Windows users to tell
us if that would really work well with their typical patterns of usage.


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01


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

* Re: set-auto-mode on case insensitive OS:es [Was: Re: CC Mode 5.30]
  2003-07-07  3:39         ` Richard Stallman
@ 2003-07-07  7:08           ` Jason Rumney
  2003-07-07 14:27           ` Stefan Monnier
  1 sibling, 0 replies; 10+ messages in thread
From: Jason Rumney @ 2003-07-07  7:08 UTC (permalink / raw
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

> 	Also, NT file systems can distinguish between upper and lower case
> 	chars visually, even if it doesn't matter when finding files. Thus
> 	it could be an idea to try to match the name case sensitively
> 	first, and if that fails do another attempt with a downcased name
> 	(or with case-fold-search set).
> 
> Whether this would really give the desired results is a tricky
> question.  I think that we had better wait for MS-Windows users to tell
> us if that would really work well with their typical patterns of usage.

I don't think so. Other tools have a tendancy to change the case of
the file name at random.

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

* Re: set-auto-mode on case insensitive OS:es [Was: Re: CC Mode 5.30]
  2003-07-07  3:39         ` Richard Stallman
  2003-07-07  7:08           ` Jason Rumney
@ 2003-07-07 14:27           ` Stefan Monnier
  2003-07-07 19:40             ` Jason Rumney
  2003-07-08 20:02             ` Richard Stallman
  1 sibling, 2 replies; 10+ messages in thread
From: Stefan Monnier @ 2003-07-07 14:27 UTC (permalink / raw
  Cc: bug-cc-mode, emacs-devel

> 	Also, NT file systems can distinguish between upper and lower case
> 	chars visually, even if it doesn't matter when finding files. Thus
> 	it could be an idea to try to match the name case sensitively
> 	first, and if that fails do another attempt with a downcased name
> 	(or with case-fold-search set).
> 
> Whether this would really give the desired results is a tricky
> question.  I think that we had better wait for MS-Windows users to tell
> us if that would really work well with their typical patterns of usage.

I think it's a good idea, but probably will hit various problems
where the capitalization of the filename gets lost (because it
passed through a program that is not careful to preserve it).
I seem to remember that double-clicking on an file icon to have
Emacs open the file passes the 8+3 allcaps filename to Emacs,
so with the above change, doing it on a C file would open it in
C++ mode since the extension would be .C rather than .c.


	Stefan



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01


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

* Re: [David Ponce <david.ponce@wanadoo.fr>] Re: CC Mode 5.30
  2003-07-05 20:10   ` Martin Stjernholm
  2003-07-06 11:28     ` Jason Rumney
@ 2003-07-07 16:34     ` Tak Ota
  1 sibling, 0 replies; 10+ messages in thread
From: Tak Ota @ 2003-07-07 16:34 UTC (permalink / raw
  Cc: emacs-devel

Sat, 05 Jul 2003 22:10:36 +0200: Martin Stjernholm <mast@lysator.liu.se> wrote:

> Martin Stjernholm <mast@lysator.liu.se> wrote:
> 
> >> From: David Ponce <david.ponce@wanadoo.fr>
> /.../
> >> That is definitively the case, when system-type is windows-nt (or
> >> cygwin), Emacs can't distinguish ".c" from ".C".

I have confirmed that the problem I experienced is now fixed.  Thanks.

-Tak


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01


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

* Re: set-auto-mode on case insensitive OS:es [Was: Re: CC Mode 5.30]
  2003-07-07 14:27           ` Stefan Monnier
@ 2003-07-07 19:40             ` Jason Rumney
  2003-07-08 20:02             ` Richard Stallman
  1 sibling, 0 replies; 10+ messages in thread
From: Jason Rumney @ 2003-07-07 19:40 UTC (permalink / raw
  Cc: Richard Stallman, emacs-devel, bug-cc-mode

"Stefan Monnier" <monnier+gnu/emacs@cs.yale.edu> writes:

> I seem to remember that double-clicking on an file icon to have
> Emacs open the file passes the 8+3 allcaps filename to Emacs,
> so with the above change, doing it on a C file would open it in
> C++ mode since the extension would be .C rather than .c.

Not any more, but Samba mounts have a problem where if the filename
fits into 8+3, the filename is always reported as allcaps.





-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01


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

* Re: set-auto-mode on case insensitive OS:es [Was: Re: CC Mode 5.30]
  2003-07-07 14:27           ` Stefan Monnier
  2003-07-07 19:40             ` Jason Rumney
@ 2003-07-08 20:02             ` Richard Stallman
  1 sibling, 0 replies; 10+ messages in thread
From: Richard Stallman @ 2003-07-08 20:02 UTC (permalink / raw
  Cc: bug-cc-mode, emacs-devel

	I seem to remember that double-clicking on an file icon to have
	Emacs open the file passes the 8+3 allcaps filename to Emacs,
	so with the above change, doing it on a C file would open it in
	C++ mode since the extension would be .C rather than .c.

    Not any more, but Samba mounts have a problem where if the filename
    fits into 8+3, the filename is always reported as allcaps.

That sounds like sufficient reason not to try to depend on
the apparent case pattern.


-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps


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

end of thread, other threads:[~2003-07-08 20:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <5bhe6119sc.fsf@lister.roxen.com>
2003-07-05 12:11 ` [David Ponce <david.ponce@wanadoo.fr>] Re: CC Mode 5.30 Martin Stjernholm
2003-07-05 20:10   ` Martin Stjernholm
2003-07-06 11:28     ` Jason Rumney
2003-07-06 13:03       ` set-auto-mode on case insensitive OS:es [Was: Re: CC Mode 5.30] Martin Stjernholm
2003-07-07  3:39         ` Richard Stallman
2003-07-07  7:08           ` Jason Rumney
2003-07-07 14:27           ` Stefan Monnier
2003-07-07 19:40             ` Jason Rumney
2003-07-08 20:02             ` Richard Stallman
2003-07-07 16:34     ` [David Ponce <david.ponce@wanadoo.fr>] Re: CC Mode 5.30 Tak Ota

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