Stefan Monnier <[EMAIL PROTECTED]> writes:

> It's at the very best a misfeature.  Far from a feature.
> See sample patch below to fix this problem.

This code is exactly what we need!

It is simple, localized, easy to document, and have no really severe
effects if it guesses wrong - as the worst effect of a wrong choice is
to not to enter fundamental-mode (which is usually pretty useless).

In contrast, the "recognize images by file contents" approach has already
required three rounds of bug-fixing ... and there's no guarantee that there
are not more "surprises"...

I strongly support installing this, _and_ reverting the recent image-mode 
related
patches which would no longer be needed with this patch.

>
>
>         Stefan
>
>
> --- orig/lisp/files.el
> +++ mod/lisp/files.el
> @@ -2234,15 +2234,22 @@
>             (setq name (file-name-sans-versions name))
>             (while name
>               ;; Find first matching alist entry.
> -             (let ((case-fold-search
> -                    (memq system-type '(vax-vms windows-nt cygwin))))
> -               (if (and (setq mode (assoc-default name auto-mode-alist
> -                                                  'string-match))
> -                        (consp mode)
> -                        (cadr mode))
> -                   (setq mode (car mode)
> -                         name (substring name 0 (match-beginning 0)))
> -                 (setq name)))
> +                (if (and (setq mode
> +                               (or (unless (memq system-type '(vax-vms 
> windows-nt cygwin))
> +                                     ;; First match case-sensitively if the
> +                                     ;; system is case-sensitive.
> +                                     (let ((case-fold-search nil))
> +                                       (assoc-default name auto-mode-alist
> +                                                      'string-match)))
> +                                   ;; Fallback to case-insensitive match.
> +                                   (let ((case-fold-search t))
> +                                     (assoc-default name auto-mode-alist
> +                                                    'string-match))))
> +                         (consp mode)
> +                         (cadr mode))
> +                    (setq mode (car mode)
> +                          name (substring name 0 (match-beginning 0)))
> +                  (setq name))
>               (when mode
>                 (set-auto-mode-0 mode keep-mode-if-same)))))))))

-- 
Kim F. Storm <[EMAIL PROTECTED]> http://www.cua.dk



_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug

Reply via email to