unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David Ponce <david.ponce@wanadoo.fr>
Cc: emacs-devel@gnu.org
Subject: Re: CC Mode 5.30
Date: Sat, 05 Jul 2003 12:18:42 +0200	[thread overview]
Message-ID: <3F06A602.80508@wanadoo.fr> (raw)

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's a possible cause. Could you please try to move the entry
 >
 >     ("\\.\\(CC?\\|HH?\\)\\'" . c++-mode)
 >
 > in auto-mode-alist to the bottom of it and see if it helps?
 >
 > If it does, I'll rearrange the autoload directives so that ".c" is
 > tested before ".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)
		      ....

I use the following hack in my startup file, that fixes the problem:

(when (eq system-type 'windows-nt)
   ;; File system is case insensitive.  Ensure that .C or .H will not
   ;; open in `c++-mode'.  Reorder `auto-mode-alist' so `c-mode'
   ;; regexps will be matched before `c++-mode' ones.
   (let* (aml cml)
     (dolist (elt auto-mode-alist)
       (if (eq 'c-mode (cdr elt))
           (push elt cml)
         (push elt aml)))
     (setq auto-mode-alist (nreverse (nconc aml cml))))
   )

Hope it helps.

Sincerely,
David

             reply	other threads:[~2003-07-05 10:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-05 10:18 David Ponce [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-07-04  6:25 CC Mode 5.30 David Ponce
2003-07-04 11:05 ` Martin Stjernholm
2003-06-19 13:42 Martin Stjernholm
2003-07-03 12:56 ` Martin Stjernholm
2003-07-03 21:19   ` Tak Ota
2003-07-03 21:57     ` Martin Stjernholm
2003-07-03 22:19       ` Tak Ota
2003-07-04 12:14         ` Martin Stjernholm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F06A602.80508@wanadoo.fr \
    --to=david.ponce@wanadoo.fr \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).