Mercurial > emacs
comparison lisp/files.el @ 91005:424b655804ca
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 846-851)
- Update from CVS
- Merge from emacs--rel--22
* emacs--rel--22 (patch 88-92)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 242-244)
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-246
author | Miles Bader <miles@gnu.org> |
---|---|
date | Mon, 13 Aug 2007 13:48:35 +0000 |
parents | f55f9811f5d7 e5a68f18fcb9 |
children | b83d0dadb2a7 |
comparison
equal
deleted
inserted
replaced
91004:f72cf5b2ab11 | 91005:424b655804ca |
---|---|
1935 (defvar auto-mode-alist | 1935 (defvar auto-mode-alist |
1936 ;; Note: The entries for the modes defined in cc-mode.el (c-mode, | 1936 ;; Note: The entries for the modes defined in cc-mode.el (c-mode, |
1937 ;; c++-mode, java-mode and more) are added through autoload | 1937 ;; c++-mode, java-mode and more) are added through autoload |
1938 ;; directives in that file. That way is discouraged since it | 1938 ;; directives in that file. That way is discouraged since it |
1939 ;; spreads out the definition of the initial value. | 1939 ;; spreads out the definition of the initial value. |
1940 (mapc | 1940 (mapcar |
1941 (lambda (elt) | 1941 (lambda (elt) |
1942 (cons (purecopy (car elt)) (cdr elt))) | 1942 (cons (purecopy (car elt)) (cdr elt))) |
1943 `(;; do this first, so that .html.pl is Polish html, not Perl | 1943 `(;; do this first, so that .html.pl is Polish html, not Perl |
1944 ("\\.s?html?\\(\\.[a-zA-Z_]+\\)?\\'" . html-mode) | 1944 ("\\.s?html?\\(\\.[a-zA-Z_]+\\)?\\'" . html-mode) |
1945 ("\\.te?xt\\'" . text-mode) | 1945 ("\\.te?xt\\'" . text-mode) |
2308 (looking-at re))))))) | 2308 (looking-at re))))))) |
2309 (set-auto-mode-0 done keep-mode-if-same))) | 2309 (set-auto-mode-0 done keep-mode-if-same))) |
2310 ;; Next compare the filename against the entries in auto-mode-alist. | 2310 ;; Next compare the filename against the entries in auto-mode-alist. |
2311 (unless done | 2311 (unless done |
2312 (if buffer-file-name | 2312 (if buffer-file-name |
2313 (let ((name buffer-file-name)) | 2313 (let ((name buffer-file-name) |
2314 (remote-id (file-remote-p buffer-file-name))) | |
2315 ;; Remove remote file name identification. | |
2316 (when (and (stringp remote-id) | |
2317 (string-match (regexp-quote remote-id) name)) | |
2318 (setq name (substring name (match-end 0)))) | |
2314 ;; Remove backup-suffixes from file name. | 2319 ;; Remove backup-suffixes from file name. |
2315 (setq name (file-name-sans-versions name)) | 2320 (setq name (file-name-sans-versions name)) |
2316 (while name | 2321 (while name |
2317 ;; Find first matching alist entry. | 2322 ;; Find first matching alist entry. |
2318 (setq mode | 2323 (setq mode |
3986 "Modification-flag cleared")) | 3991 "Modification-flag cleared")) |
3987 (set-buffer-modified-p arg)) | 3992 (set-buffer-modified-p arg)) |
3988 | 3993 |
3989 (defun toggle-read-only (&optional arg) | 3994 (defun toggle-read-only (&optional arg) |
3990 "Change whether this buffer is visiting its file read-only. | 3995 "Change whether this buffer is visiting its file read-only. |
3991 With arg, set read-only iff arg is positive. | 3996 With prefix argument ARG, make the buffer read-only if ARG is |
3992 If visiting file read-only and `view-read-only' is non-nil, enter view mode." | 3997 positive, otherwise make it writable. If visiting file read-only |
3998 and `view-read-only' is non-nil, enter view mode." | |
3993 (interactive "P") | 3999 (interactive "P") |
3994 (if (and arg | 4000 (if (and arg |
3995 (if (> (prefix-numeric-value arg) 0) buffer-read-only | 4001 (if (> (prefix-numeric-value arg) 0) buffer-read-only |
3996 (not buffer-read-only))) ; If buffer-read-only is set correctly, | 4002 (not buffer-read-only))) ; If buffer-read-only is set correctly, |
3997 nil ; do nothing. | 4003 nil ; do nothing. |
4630 FILENAME should lack slashes. You can redefine this for customization." | 4636 FILENAME should lack slashes. You can redefine this for customization." |
4631 (string-match "^#.*#$" filename)) | 4637 (string-match "^#.*#$" filename)) |
4632 | 4638 |
4633 (defun wildcard-to-regexp (wildcard) | 4639 (defun wildcard-to-regexp (wildcard) |
4634 "Given a shell file name pattern WILDCARD, return an equivalent regexp. | 4640 "Given a shell file name pattern WILDCARD, return an equivalent regexp. |
4635 The generated regexp will match a filename iff the filename | 4641 The generated regexp will match a filename only if the filename |
4636 matches that wildcard according to shell rules. Only wildcards known | 4642 matches that wildcard according to shell rules. Only wildcards known |
4637 by `sh' are supported." | 4643 by `sh' are supported." |
4638 (let* ((i (string-match "[[.*+\\^$?]" wildcard)) | 4644 (let* ((i (string-match "[[.*+\\^$?]" wildcard)) |
4639 ;; Copy the initial run of non-special characters. | 4645 ;; Copy the initial run of non-special characters. |
4640 (result (substring wildcard 0 i)) | 4646 (result (substring wildcard 0 i)) |