emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: image.el doesn't associate image-mode with .JPG files


From: Juanma Barranquero
Subject: Re: image.el doesn't associate image-mode with .JPG files
Date: Sat, 16 Dec 2006 03:56:57 +0100

On 12/14/06, Richard Stallman <address@hidden> wrote:

That seems like a valid reason.  Would someone please install that change?
It would be useful to recognize PNG and GIF as well this way.

image.el already defines `image-type-header-regexps' and
`image-type-from-buffer', so it seems wasteful to recreate that. It
would be better IMHO to simply use `image-type-from-buffer' from
`set-auto-mode'. Other than changes to docstrings and info files, the
path is as simple as this, and works quite well.

                   /L/e/k/t/u


Index: lisp/files.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/files.el,v
retrieving revision 1.868
diff -c -r1.868 files.el
*** lisp/files.el       11 Dec 2006 04:40:41 -0000      1.868
--- lisp/files.el       16 Dec 2006 02:51:21 -0000
***************
*** 2222,2230 ****
                         (narrow-to-region (point-min)
                                           (min (point-max)
                                                (+ (point-min) 
magic-mode-regexp-match-limit)))
!                        (assoc-default nil magic-mode-alist
!                                       (lambda (re dummy)
!                                         (looking-at re))))))
          (set-auto-mode-0 done keep-mode-if-same)
        ;; Compare the filename against the entries in auto-mode-alist.
        (if buffer-file-name
--- 2222,2232 ----
                         (narrow-to-region (point-min)
                                           (min (point-max)
                                                (+ (point-min) 
magic-mode-regexp-match-limit)))
!                        (if (image-type-from-buffer)
!                            'image-mode
!                          (assoc-default nil magic-mode-alist
!                                         (lambda (re dummy)
!                                           (looking-at re)))))))
          (set-auto-mode-0 done keep-mode-if-same)
        ;; Compare the filename against the entries in auto-mode-alist.
        (if buffer-file-name




reply via email to

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