diff options
| author | Richard M. Stallman | 2001-12-14 03:21:49 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2001-12-14 03:21:49 +0000 |
| commit | 2d2ab9da1b332f6620e25dc76914cf7d9c65b972 (patch) | |
| tree | 37f09b80cab857b5d398cfa0983c4a9e54668cba | |
| parent | b26d003af1abc2a07939bcb38fa4f1ac6b4f565f (diff) | |
| download | emacs-2d2ab9da1b332f6620e25dc76914cf7d9c65b972.tar.gz emacs-2d2ab9da1b332f6620e25dc76914cf7d9c65b972.zip | |
(set-auto-mode): Fix previous change.
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/files.el | 31 |
2 files changed, 19 insertions, 16 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 26087a6d607..34018fccc73 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2001-12-13 Richard M. Stallman <rms@gnu.org> | ||
| 2 | |||
| 3 | * files.el (set-auto-mode): Fix previous change. | ||
| 4 | |||
| 1 | 2001-12-13 Stefan Monnier <monnier@cs.yale.edu> | 5 | 2001-12-13 Stefan Monnier <monnier@cs.yale.edu> |
| 2 | 6 | ||
| 3 | * emacs-lisp/easymenu.el (easy-menu-intern): New fun. | 7 | * emacs-lisp/easymenu.el (easy-menu-intern): New fun. |
diff --git a/lisp/files.el b/lisp/files.el index c7426d05d04..054dd0368e5 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -1576,32 +1576,31 @@ If the optional argument JUST-FROM-FILE-NAME is non-nil, | |||
| 1576 | then we do not set anything but the major mode, | 1576 | then we do not set anything but the major mode, |
| 1577 | and we don't even do that unless it would come from the file name." | 1577 | and we don't even do that unless it would come from the file name." |
| 1578 | ;; Look for -*-MODENAME-*- or -*- ... mode: MODENAME; ... -*- | 1578 | ;; Look for -*-MODENAME-*- or -*- ... mode: MODENAME; ... -*- |
| 1579 | (let (beg end done modes) | 1579 | (let (end done modes) |
| 1580 | (save-excursion | 1580 | (save-excursion |
| 1581 | (goto-char (point-min)) | 1581 | (goto-char (point-min)) |
| 1582 | (skip-chars-forward " \t\n") | 1582 | (skip-chars-forward " \t\n") |
| 1583 | (and enable-local-variables | 1583 | (and enable-local-variables |
| 1584 | (setq end (set-auto-mode-1)) | 1584 | (setq end (set-auto-mode-1)) |
| 1585 | (progn | 1585 | (if (save-excursion (search-forward ":" end t)) |
| 1586 | (if (save-excursion (search-forward ":" end t)) | 1586 | ;; Find all specifications for the `mode:' variable |
| 1587 | ;; Find all specifications for the `mode:' variable | 1587 | ;; and execute them left to right. |
| 1588 | ;; and execute them left to right. | 1588 | (while (let ((case-fold-search t)) |
| 1589 | (while (let ((case-fold-search t)) | 1589 | (or (and (looking-at "mode:") |
| 1590 | (or (and (looking-at "mode:") | 1590 | (goto-char (match-end 0))) |
| 1591 | (goto-char (match-end 0))) | 1591 | (re-search-forward "[ \t;]mode:" end t))) |
| 1592 | (re-search-forward "[ \t;]mode:" end t))) | 1592 | (skip-chars-forward " \t") |
| 1593 | (skip-chars-forward " \t") | 1593 | (let ((beg (point))) |
| 1594 | (setq beg (point)) | ||
| 1595 | (if (search-forward ";" end t) | 1594 | (if (search-forward ";" end t) |
| 1596 | (forward-char -1) | 1595 | (forward-char -1) |
| 1597 | (goto-char end)) | 1596 | (goto-char end)) |
| 1598 | (skip-chars-backward " \t") | 1597 | (skip-chars-backward " \t") |
| 1599 | (push (intern (concat (downcase (buffer-substring beg (point))) "-mode")) | 1598 | (push (intern (concat (downcase (buffer-substring beg (point))) "-mode")) |
| 1600 | modes)) | 1599 | modes))) |
| 1601 | ;; Simple -*-MODE-*- case. | 1600 | ;; Simple -*-MODE-*- case. |
| 1602 | (push (intern (concat (downcase (buffer-substring beg end)) | 1601 | (push (intern (concat (downcase (buffer-substring (point) end)) |
| 1603 | "-mode")) | 1602 | "-mode")) |
| 1604 | modes))))) | 1603 | modes)))) |
| 1605 | ;; If we found modes to use, invoke them now, | 1604 | ;; If we found modes to use, invoke them now, |
| 1606 | ;; outside the save-excursion. | 1605 | ;; outside the save-excursion. |
| 1607 | (unless just-from-file-name | 1606 | (unless just-from-file-name |