Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
5cce080e
Commit
5cce080e
authored
Feb 04, 2006
by
Kim F. Storm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(magic-mode-regexp-match-limit): New defvar.
(set-auto-mode): Use it to limit magic-mode-alist matching.
parent
53391989
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
lisp/files.el
lisp/files.el
+10
-3
No files found.
lisp/files.el
View file @
5cce080e
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment