diff options
author | Karoly Lorentey <lorentey@elte.hu> | 2006-02-06 18:44:57 +0000 |
---|---|---|
committer | Karoly Lorentey <lorentey@elte.hu> | 2006-02-06 18:44:57 +0000 |
commit | a5805c9d0240fab504f2a3e32db6449392005fb6 (patch) | |
tree | a6eba3e018d5edf0f33476dcf5d2f2ac50983307 /lisp/files.el | |
parent | fbb63435176d3614d3603b675784122bf50d22b1 (diff) | |
parent | 55495ab90ed2afd64f757e55f697d716a7c7b75c (diff) | |
download | emacs-a5805c9d0240fab504f2a3e32db6449392005fb6.tar.gz |
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-41
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-42
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-43
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-44
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-45
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-46
Merge from erc--emacs--0
* emacs@sv.gnu.org/emacs--devo--0--patch-47
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-48
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-14
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-15
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-16
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-17
Merge from emacs--devo--0
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-507
Diffstat (limited to 'lisp/files.el')
-rw-r--r-- | lisp/files.el | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/files.el b/lisp/files.el index d13e37752b1..ec974ceebe7 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2047,6 +2047,9 @@ to decide the buffer's major mode. If FUNCTION is nil, then it is not called. (That is a way of saying \"allow `auto-mode-alist' to decide for these files.\")") +(defvar magic-mode-regexp-match-limit 4000 + "Upper limit on `magic-mode-alist' regexp matches.") + (defun set-auto-mode (&optional keep-mode-if-same) "Select major mode appropriate for current buffer. @@ -2120,9 +2123,13 @@ only set the major mode, if that would change it." (unless done (if (setq done (save-excursion (goto-char (point-min)) - (assoc-default nil magic-mode-alist - (lambda (re dummy) - (looking-at re))))) + (save-restriction + (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 |