emacs-devel
[Top][All Lists]
Advanced

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

Re: CC Mode 5.30


From: David Ponce
Subject: Re: CC Mode 5.30
Date: Sat, 05 Jul 2003 12:18:42 +0200
User-agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.5a) Gecko/20030704

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 via email to

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