comparison lisp/prim/files.el @ 149:538048ae2ab8 r20-3b1

Import from CVS: tag r20-3b1
author cvs
date Mon, 13 Aug 2007 09:36:16 +0200
parents b980b6286996
children 59463afc5666
comparison
equal deleted inserted replaced
148:f659db2a1f73 149:538048ae2ab8
312 "Character used to separate concatenated paths.") 312 "Character used to separate concatenated paths.")
313 313
314 (defun parse-colon-path (cd-path) 314 (defun parse-colon-path (cd-path)
315 "Explode a colon-separated list of paths into a string list." 315 "Explode a colon-separated list of paths into a string list."
316 (and cd-path 316 (and cd-path
317 (let (cd-list cd-list (cd-start 0) cd-colon) 317 (let (cd-list (cd-start 0) cd-colon)
318 (setq cd-path (concat cd-path path-separator)) 318 (setq cd-path (concat cd-path path-separator))
319 (while (setq cd-colon (string-match path-separator cd-path cd-start)) 319 (while (setq cd-colon (string-match path-separator cd-path cd-start))
320 (setq cd-list 320 (setq cd-list
321 (nconc cd-list 321 (nconc cd-list
322 (list (if (= cd-start cd-colon) 322 (list (if (= cd-start cd-colon)
1088 (hack-local-variables (not find-file)) 1088 (hack-local-variables (not find-file))
1089 (error (message "File local-variables error: %s" 1089 (error (message "File local-variables error: %s"
1090 (prin1-to-string err)))))) 1090 (prin1-to-string err))))))
1091 1091
1092 (defvar auto-mode-alist 1092 (defvar auto-mode-alist
1093 (mapcar 1093 '(("\\.te?xt\\'" . text-mode)
1094 'purecopy 1094 ("\\.[ch]\\'" . c-mode)
1095 '(("\\.te?xt\\'" . text-mode) 1095 ("\\.ltx\\'" . latex-mode)
1096 ("\\.[ch]\\'" . c-mode) 1096 ("\\.el\\'" . emacs-lisp-mode)
1097 ("\\.ltx\\'" . latex-mode) 1097 ("\\.l\\(i?sp\\)?\\'" . lisp-mode)
1098 ("\\.el\\'" . emacs-lisp-mode) 1098 ("\\.f\\(or\\)?\\'" . fortran-mode)
1099 ("\\.l\\(i?sp\\)?\\'" . lisp-mode) 1099 ("\\.p\\(as\\)?\\'" . pascal-mode)
1100 ("\\.f\\(or\\)?\\'" . fortran-mode) 1100 ("\\.ad[abs]\\'" . ada-mode)
1101 ("\\.p\\(as\\)?\\'" . pascal-mode) 1101 ("\\.p[lm]\\'" . perl-mode)
1102 ("\\.ad[abs]\\'" . ada-mode) 1102 ("\\.\\([CH]\\|cc\\|hh\\)\\'" . c++-mode)
1103 ("\\.p[lm]\\'" . perl-mode) 1103 ("\\.[ch]\\(pp\\|xx\\|\\+\\+\\)\\'" . c++-mode)
1104 ("\\.\\([CH]\\|cc\\|hh\\)\\'" . c++-mode) 1104 ("\\.java\\'" . java-mode)
1105 ("\\.[ch]\\(pp\\|xx\\|\\+\\+\\)\\'" . c++-mode)
1106 ("\\.java\\'" . java-mode)
1107 ("\\.ma?k\\'" . makefile-mode)
1108 ("[Mm]akefile\\(.in\\)?\\(.in\\)?\\'" . makefile-mode)
1109 ;;; Less common extensions come here 1105 ;;; Less common extensions come here
1110 ;;; so more common ones above are found faster. 1106 ;;; so more common ones above are found faster.
1111 ("\\.texi\\(nfo\\)?\\'" . texinfo-mode) 1107 ("\\.texi\\(nfo\\)?\\'" . texinfo-mode)
1112 ("\\.[sS]\\'" . asm-mode) 1108 ("\\.[sS]\\'" . asm-mode)
1113 ("[Cc]hange.?[Ll]og?\\(.[0-9]+\\)?\\'" . change-log-mode) 1109 ("[Cc]hange.?[Ll]og?\\(.[0-9]+\\)?\\'" . change-log-mode)
1114 ("\\$CHANGE_LOG\\$\\.TXT" . change-log-mode) 1110 ("\\$CHANGE_LOG\\$\\.TXT" . change-log-mode)
1115 ("\\.scm\\(\\.[0-9]*\\)?\\'" . scheme-mode) 1111 ("\\.scm\\(\\.[0-9]*\\)?\\'" . scheme-mode)
1116 ("\\.py\\'" . python-mode) 1112 ("\\.py\\'" . python-mode)
1117 ("\\.e\\'" . eiffel-mode) 1113 ("\\.e\\'" . eiffel-mode)
1118 ("\\.mss\\'" . scribe-mode) 1114 ("\\.mss\\'" . scribe-mode)
1119 ("\\.m\\([mes]\\|an\\)\\'" . nroff-mode) 1115 ("\\.m\\([mes]\\|an\\)\\'" . nroff-mode)
1120 ("\\.icn\\'" . icon-mode) 1116 ("\\.icn\\'" . icon-mode)
1121 ;;; The following should come after the ChangeLog pattern 1117 ;;; The following should come after the ChangeLog pattern
1122 ;;; for the sake of ChangeLog.1, etc. 1118 ;;; for the sake of ChangeLog.1, etc.
1123 ;;; and after the .scm.[0-9] pattern too. 1119 ;;; and after the .scm.[0-9] pattern too.
1124 ("\\.[12345678]\\'" . nroff-mode) 1120 ("\\.[12345678]\\'" . nroff-mode)
1125 ("\\.[tT]e[xX]\\'" . tex-mode) 1121 ("\\.[tT]e[xX]\\'" . tex-mode)
1126 ("\\.\\(sty\\|cls\\|bbl\\)\\'" . latex-mode) 1122 ("\\.\\(sty\\|cls\\|bbl\\)\\'" . latex-mode)
1127 ("\\.bib\\'" . bibtex-mode) 1123 ("\\.bib\\'" . bibtex-mode)
1128 ("\\.article\\'" . text-mode) 1124 ("\\.article\\'" . text-mode)
1129 ("\\.letter\\'" . text-mode) 1125 ("\\.letter\\'" . text-mode)
1130 ("\\.\\(tcl\\|exp\\)\\'" . tcl-mode) 1126 ("\\.\\(tcl\\|exp\\)\\'" . tcl-mode)
1131 ("\\.wrl\\'" . vrml-mode) 1127 ("\\.wrl\\'" . vrml-mode)
1132 ("\\.f90\\'" . f90-mode) 1128 ("\\.f90\\'" . f90-mode)
1133 ("\\.awk\\'" . awk-mode) 1129 ("\\.awk\\'" . awk-mode)
1134 ("\\.prolog\\'" . prolog-mode) 1130 ("\\.prolog\\'" . prolog-mode)
1135 ("\\.tar\\'" . tar-mode) 1131 ("\\.tar\\'" . tar-mode)
1136 ("\\.\\(arc\\|zip\\|lzh\\|zoo\\)\\'" . archive-mode) 1132 ("\\.\\(arc\\|zip\\|lzh\\|zoo\\)\\'" . archive-mode)
1137 ;; Mailer puts message to be edited in 1133 ;; Mailer puts message to be edited in
1138 ;; /tmp/Re.... or Message 1134 ;; /tmp/Re.... or Message
1139 ("^/tmp/Re" . text-mode) 1135 ("^/tmp/Re" . text-mode)
1140 ("/Message[0-9]*\\'" . text-mode) 1136 ("/Message[0-9]*\\'" . text-mode)
1141 ("/drafts/[0-9]+\\'" . mh-letter-mode) 1137 ("/drafts/[0-9]+\\'" . mh-letter-mode)
1142 ;; some news reader is reported to use this 1138 ;; some news reader is reported to use this
1143 ("^/tmp/fol/" . text-mode) 1139 ("^/tmp/fol/" . text-mode)
1144 ("\\.y\\'" . c-mode) 1140 ("\\.y\\'" . c-mode)
1145 ("\\.lex\\'" . c-mode) 1141 ("\\.lex\\'" . c-mode)
1146 ("\\.oak\\'" . scheme-mode) 1142 ("\\.oak\\'" . scheme-mode)
1147 ("\\.s?html?\\'" . html-mode) 1143 ("\\.s?html?\\'" . html-mode)
1148 ("\\.htm?l?3\\'" . html3-mode) 1144 ("\\.htm?l?3\\'" . html3-mode)
1149 ("\\.\\(sgml?\\|dtd\\)\\'" . sgml-mode) 1145 ("\\.\\(sgml?\\|dtd\\)\\'" . sgml-mode)
1150 ("\\.c?ps\\'" . postscript-mode) 1146 ("\\.c?ps\\'" . postscript-mode)
1151 ;; .emacs following a directory delimiter 1147 ;; .emacs following a directory delimiter
1152 ;; in either Unix or VMS syntax. 1148 ;; in either Unix or VMS syntax.
1153 ("[]>:/]\\..*emacs\\'" . emacs-lisp-mode) 1149 ("[]>:/]\\..*emacs\\'" . emacs-lisp-mode)
1154 ;; _emacs following a directory delimiter 1150 ;; _emacs following a directory delimiter
1155 ;; in MsDos syntax 1151 ;; in MsDos syntax
1156 ("[:/]_emacs\\'" . emacs-lisp-mode) 1152 ("[:/]_emacs\\'" . emacs-lisp-mode)
1157 ("\\.ml\\'" . lisp-mode))) 1153 ("\\.m4\\'" . m4-mode)
1154 ("configure\\.in\\'" . autoconf-mode)
1155 ("\\.ml\\'" . lisp-mode)
1156 ("\\.ma?k\\'" . makefile-mode)
1157 ("[Mm]akefile\\(\\.\\|\\'\\)" . makefile-mode)
1158 )
1158 "Alist of filename patterns vs. corresponding major mode functions. 1159 "Alist of filename patterns vs. corresponding major mode functions.
1159 Each element looks like (REGEXP . FUNCTION) or (REGEXP FUNCTION NON-NIL). 1160 Each element looks like (REGEXP . FUNCTION) or (REGEXP FUNCTION NON-NIL).
1160 \(NON-NIL stands for anything that is not nil; the value does not matter.) 1161 \(NON-NIL stands for anything that is not nil; the value does not matter.)
1161 Visiting a file whose name matches REGEXP specifies FUNCTION as the 1162 Visiting a file whose name matches REGEXP specifies FUNCTION as the
1162 mode function to use. FUNCTION will be called, unless it is nil. 1163 mode function to use. FUNCTION will be called, unless it is nil.
1164 If the element has the form (REGEXP FUNCTION NON-NIL), then after 1165 If the element has the form (REGEXP FUNCTION NON-NIL), then after
1165 calling FUNCTION (if it's not nil), we delete the suffix that matched 1166 calling FUNCTION (if it's not nil), we delete the suffix that matched
1166 REGEXP and search the list again for another match.") 1167 REGEXP and search the list again for another match.")
1167 1168
1168 (defconst interpreter-mode-alist 1169 (defconst interpreter-mode-alist
1169 (mapcar 'purecopy 1170 '(("^#!.*csh" . sh-mode)
1170 '(("^#!.*csh" . sh-mode) 1171 ("^#!.*sh\\b" . ksh-mode)
1171 ("^#!.*sh\\b" . ksh-mode) 1172 ("^#!.*\\b\\(scope\\|wish\\|tcl\\|expect\\)" . tcl-mode)
1172 ("^#!.*\\b\\(scope\\|wish\\|tcl\\|expect\\)" . tcl-mode) 1173 ("perl" . perl-mode)
1173 ("perl" . perl-mode) 1174 ("python" . python-mode)
1174 ("python" . python-mode) 1175 ("awk\\b" . awk-mode)
1175 ("awk\\b" . awk-mode) 1176 ("rexx" . rexx-mode)
1176 ("rexx" . rexx-mode) 1177 ("scm" . scheme-mode)
1177 ("scm" . scheme-mode) 1178 ("^:" . ksh-mode))
1178 ("^:" . ksh-mode)
1179 ))
1180 "Alist mapping interpreter names to major modes. 1179 "Alist mapping interpreter names to major modes.
1181 This alist is used to guess the major mode of a file based on the 1180 This alist is used to guess the major mode of a file based on the
1182 contents of the first line. This line often contains something like: 1181 contents of the first line. This line often contains something like:
1183 #!/bin/sh 1182 #!/bin/sh
1184 but may contain something more imaginative like 1183 but may contain something more imaginative like