1386 |
;; At first check the head. |
;; At first check the head. |
1387 |
(when head-found |
(when head-found |
1388 |
(goto-char head-start) |
(goto-char head-start) |
1389 |
(setq pos (re-search-forward "[\n\r]" head-end t)) |
(setq head-end (set-auto-mode-1)) |
1390 |
(if (and pos |
(setq head-start (point)) |
|
(= (char-after head-start) ?#) |
|
|
(= (char-after (1+ head-start)) ?!)) |
|
|
;; If the file begins with "#!" (exec interpreter magic), |
|
|
;; look for coding frobs in the first two lines. You cannot |
|
|
;; necessarily put them in the first line of such a file |
|
|
;; without screwing up the interpreter invocation. |
|
|
(setq pos (search-forward "\n" head-end t))) |
|
|
(if pos (setq head-end pos)) |
|
1391 |
(when (< head-found head-end) |
(when (< head-found head-end) |
1392 |
(goto-char head-start) |
(goto-char head-start) |
1393 |
(when (and set-auto-coding-for-load |
(when (and set-auto-coding-for-load |
1394 |
(re-search-forward |
(re-search-forward |
1395 |
"-\\*-\\(.*;\\)?[ \t]*unibyte:[ \t]*\\([^ ;]+\\)" |
"\\(.*;\\)?[ \t]*unibyte:[ \t]*\\([^ ;]+\\)" |
1396 |
head-end t)) |
head-end t)) |
1397 |
(setq coding-system 'raw-text)) |
(setq coding-system 'raw-text)) |
1398 |
(when (and (not coding-system) |
(when (and (not coding-system) |
1399 |
(re-search-forward |
(re-search-forward |
1400 |
"-\\*-\\(.*;\\)?[ \t]*coding:[ \t]*\\([^ ;]+\\)" |
"\\(.*;\\)?[ \t]*coding:[ \t]*\\([^ ;]+\\)" |
1401 |
head-end t)) |
head-end t)) |
1402 |
(setq coding-system (intern (match-string 2))) |
(setq coding-system (intern (match-string 2))) |
1403 |
(or (coding-system-p coding-system) |
(or (coding-system-p coding-system) |