aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2000-05-22 19:29:04 +0000
committerDave Love2000-05-22 19:29:04 +0000
commit74654c6507a28f2eb1523423c9fe87d13acf04f2 (patch)
tree46296c06644b3ff867a8a66a8ad779e9224bdfdf
parent5f34457e85849f67321e31f617e2ae76e952adc8 (diff)
downloademacs-74654c6507a28f2eb1523423c9fe87d13acf04f2.tar.gz
emacs-74654c6507a28f2eb1523423c9fe87d13acf04f2.zip
(parse-colon-path): Doc fix.
(auto-mode-alist, interpreter-mode-alist): Purecopy the cars. (set-auto-mode): Use mapc.
-rw-r--r--lisp/files.el333
1 files changed, 170 insertions, 163 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 2fb5cb07dd4..43872274a25 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -472,7 +472,9 @@ with a definition that really does change some file names."
472Not actually set up until the first time you you use it.") 472Not actually set up until the first time you you use it.")
473 473
474(defun parse-colon-path (cd-path) 474(defun parse-colon-path (cd-path)
475 "Explode a colon-separated search path into a list of directory names." 475 "Explode a colon-separated search path into a list of directory names.
476\(For values of `colon' equal to `path-separator'.)"
477 ;; We could use split-string here.
476 (and cd-path 478 (and cd-path
477 (let (cd-prefix cd-list (cd-start 0) cd-colon) 479 (let (cd-prefix cd-list (cd-start 0) cd-colon)
478 (setq cd-path (concat cd-path path-separator)) 480 (setq cd-path (concat cd-path path-separator))
@@ -1310,135 +1312,137 @@ in that case, this function acts as if `enable-local-variables' were t."
1310 (prin1-to-string err))))) 1312 (prin1-to-string err)))))
1311 1313
1312(defvar auto-mode-alist 1314(defvar auto-mode-alist
1313 '(("\\.te?xt\\'" . text-mode) 1315 (mapc
1314 ("\\.c\\'" . c-mode) 1316 (lambda (elt)
1315 ("\\.h\\'" . c-mode) 1317 (cons (purecopy (car elt)) (cdr elt)))
1316 ("\\.tex\\'" . tex-mode) 1318 '(("\\.te?xt\\'" . text-mode)
1317 ("\\.ltx\\'" . latex-mode) 1319 ("\\.c\\'" . c-mode)
1318 ("\\.el\\'" . emacs-lisp-mode) 1320 ("\\.h\\'" . c-mode)
1319 ("\\.scm\\'" . scheme-mode) 1321 ("\\.tex\\'" . tex-mode)
1320 ("\\.l\\'" . lisp-mode) 1322 ("\\.ltx\\'" . latex-mode)
1321 ("\\.lisp\\'" . lisp-mode) 1323 ("\\.el\\'" . emacs-lisp-mode)
1322 ("\\.f\\'" . fortran-mode) 1324 ("\\.scm\\'" . scheme-mode)
1323 ("\\.F\\'" . fortran-mode) 1325 ("\\.l\\'" . lisp-mode)
1324 ("\\.for\\'" . fortran-mode) 1326 ("\\.lisp\\'" . lisp-mode)
1325 ("\\.p\\'" . pascal-mode) 1327 ("\\.f\\'" . fortran-mode)
1326 ("\\.pas\\'" . pascal-mode) 1328 ("\\.F\\'" . fortran-mode)
1327 ("\\.ad[abs]\\'" . ada-mode) 1329 ("\\.for\\'" . fortran-mode)
1328 ("\\.\\([pP][Llm]\\|al\\)\\'" . perl-mode) 1330 ("\\.p\\'" . pascal-mode)
1329 ("\\.s?html?\\'" . html-mode) 1331 ("\\.pas\\'" . pascal-mode)
1330 ("\\.cc\\'" . c++-mode) 1332 ("\\.ad[abs]\\'" . ada-mode)
1331 ("\\.hh\\'" . c++-mode) 1333 ("\\.\\([pP][Llm]\\|al\\)\\'" . perl-mode)
1332 ("\\.hpp\\'" . c++-mode) 1334 ("\\.s?html?\\'" . html-mode)
1333 ("\\.C\\'" . c++-mode) 1335 ("\\.cc\\'" . c++-mode)
1334 ("\\.H\\'" . c++-mode) 1336 ("\\.hh\\'" . c++-mode)
1335 ("\\.cpp\\'" . c++-mode) 1337 ("\\.hpp\\'" . c++-mode)
1336 ("\\.cxx\\'" . c++-mode) 1338 ("\\.C\\'" . c++-mode)
1337 ("\\.hxx\\'" . c++-mode) 1339 ("\\.H\\'" . c++-mode)
1338 ("\\.c\\+\\+\\'" . c++-mode) 1340 ("\\.cpp\\'" . c++-mode)
1339 ("\\.h\\+\\+\\'" . c++-mode) 1341 ("\\.cxx\\'" . c++-mode)
1340 ("\\.m\\'" . objc-mode) 1342 ("\\.hxx\\'" . c++-mode)
1341 ("\\.java\\'" . java-mode) 1343 ("\\.c\\+\\+\\'" . c++-mode)
1342 ("\\.mk\\'" . makefile-mode) 1344 ("\\.h\\+\\+\\'" . c++-mode)
1343 ("\\(M\\|m\\|GNUm\\)akefile\\(\\.in\\)?\\'" . makefile-mode) 1345 ("\\.m\\'" . objc-mode)
1344 ("\\.am\\'" . makefile-mode) ;For Automake. 1346 ("\\.java\\'" . java-mode)
1347 ("\\.mk\\'" . makefile-mode)
1348 ("\\(M\\|m\\|GNUm\\)akefile\\(\\.in\\)?\\'" . makefile-mode)
1349 ("\\.am\\'" . makefile-mode) ;For Automake.
1345;;; Less common extensions come here 1350;;; Less common extensions come here
1346;;; so more common ones above are found faster. 1351;;; so more common ones above are found faster.
1347 ("\\.texinfo\\'" . texinfo-mode) 1352 ("\\.texinfo\\'" . texinfo-mode)
1348 ("\\.te?xi\\'" . texinfo-mode) 1353 ("\\.te?xi\\'" . texinfo-mode)
1349 ("\\.s\\'" . asm-mode) 1354 ("\\.s\\'" . asm-mode)
1350 ("\\.S\\'" . asm-mode) 1355 ("\\.S\\'" . asm-mode)
1351 ("\\.asm\\'" . asm-mode) 1356 ("\\.asm\\'" . asm-mode)
1352 ("ChangeLog\\'" . change-log-mode) 1357 ("ChangeLog\\'" . change-log-mode)
1353 ("change\\.log\\'" . change-log-mode) 1358 ("change\\.log\\'" . change-log-mode)
1354 ("changelo\\'" . change-log-mode) 1359 ("changelo\\'" . change-log-mode)
1355 ("ChangeLog\\.[0-9]+\\'" . change-log-mode) 1360 ("ChangeLog\\.[0-9]+\\'" . change-log-mode)
1356 ;; for MSDOS and MS-Windows (which are case-insensitive) 1361 ;; for MSDOS and MS-Windows (which are case-insensitive)
1357 ("changelog\\'" . change-log-mode) 1362 ("changelog\\'" . change-log-mode)
1358 ("changelog\\.[0-9]+\\'" . change-log-mode) 1363 ("changelog\\.[0-9]+\\'" . change-log-mode)
1359 ("\\$CHANGE_LOG\\$\\.TXT" . change-log-mode) 1364 ("\\$CHANGE_LOG\\$\\.TXT" . change-log-mode)
1360 ("\\.scm\\.[0-9]*\\'" . scheme-mode) 1365 ("\\.scm\\.[0-9]*\\'" . scheme-mode)
1361 ("\\.[ck]?sh\\'\\|\\.shar\\'\\|/\\.z?profile\\'" . sh-mode) 1366 ("\\.[ck]?sh\\'\\|\\.shar\\'\\|/\\.z?profile\\'" . sh-mode)
1362 ("\\(/\\|\\`\\)\\.\\(bash_profile\\|z?login\\|bash_login\\|z?logout\\)\\'" . sh-mode) 1367 ("\\(/\\|\\`\\)\\.\\(bash_profile\\|z?login\\|bash_login\\|z?logout\\)\\'" . sh-mode)
1363 ("\\(/\\|\\`\\)\\.\\(bash_logout\\|shrc\\|[kz]shrc\\|bashrc\\|t?cshrc\\|esrc\\)\\'" . sh-mode) 1368 ("\\(/\\|\\`\\)\\.\\(bash_logout\\|shrc\\|[kz]shrc\\|bashrc\\|t?cshrc\\|esrc\\)\\'" . sh-mode)
1364 ("\\(/\\|\\`\\)\\.\\([kz]shenv\\|xinitrc\\|startxrc\\|xsession\\)\\'" . sh-mode) 1369 ("\\(/\\|\\`\\)\\.\\([kz]shenv\\|xinitrc\\|startxrc\\|xsession\\)\\'" . sh-mode)
1365 ("\\.m?spec$" . sh-mode) 1370 ("\\.m?spec$" . sh-mode)
1366 ("\\.mm\\'" . nroff-mode) 1371 ("\\.mm\\'" . nroff-mode)
1367 ("\\.me\\'" . nroff-mode) 1372 ("\\.me\\'" . nroff-mode)
1368 ("\\.ms\\'" . nroff-mode) 1373 ("\\.ms\\'" . nroff-mode)
1369 ("\\.man\\'" . nroff-mode) 1374 ("\\.man\\'" . nroff-mode)
1370 ("\\.\\(u?lpc\\|pike\\|pmod\\)\\'" . pike-mode) 1375 ("\\.\\(u?lpc\\|pike\\|pmod\\)\\'" . pike-mode)
1371;;; The following should come after the ChangeLog pattern 1376;;; The following should come after the ChangeLog pattern
1372;;; for the sake of ChangeLog.1, etc. 1377;;; for the sake of ChangeLog.1, etc.
1373;;; and after the .scm.[0-9] pattern too. 1378;;; and after the .scm.[0-9] pattern too.
1374 ("\\.[12345678]\\'" . nroff-mode) 1379 ("\\.[12345678]\\'" . nroff-mode)
1375 ("\\.TeX\\'" . tex-mode) 1380 ("\\.TeX\\'" . tex-mode)
1376 ("\\.sty\\'" . latex-mode) 1381 ("\\.sty\\'" . latex-mode)
1377 ("\\.cls\\'" . latex-mode) ;LaTeX 2e class 1382 ("\\.cls\\'" . latex-mode) ;LaTeX 2e class
1378 ("\\.clo\\'" . latex-mode) ;LaTeX 2e class option 1383 ("\\.clo\\'" . latex-mode) ;LaTeX 2e class option
1379 ("\\.bbl\\'" . latex-mode) 1384 ("\\.bbl\\'" . latex-mode)
1380 ("\\.bib\\'" . bibtex-mode) 1385 ("\\.bib\\'" . bibtex-mode)
1381 ("\\.sql\\'" . sql-mode) 1386 ("\\.sql\\'" . sql-mode)
1382 ("\\.m4\\'" . m4-mode) 1387 ("\\.m4\\'" . m4-mode)
1383 ("\\.mc\\'" . m4-mode) 1388 ("\\.mc\\'" . m4-mode)
1384 ("\\.mf\\'" . metafont-mode) 1389 ("\\.mf\\'" . metafont-mode)
1385 ("\\.mp\\'" . metapost-mode) 1390 ("\\.mp\\'" . metapost-mode)
1386 ("\\.vhdl?\\'" . vhdl-mode) 1391 ("\\.vhdl?\\'" . vhdl-mode)
1387 ("\\.article\\'" . text-mode) 1392 ("\\.article\\'" . text-mode)
1388 ("\\.letter\\'" . text-mode) 1393 ("\\.letter\\'" . text-mode)
1389 ("\\.tcl\\'" . tcl-mode) 1394 ("\\.tcl\\'" . tcl-mode)
1390 ("\\.exp\\'" . tcl-mode) 1395 ("\\.exp\\'" . tcl-mode)
1391 ("\\.itcl\\'" . tcl-mode) 1396 ("\\.itcl\\'" . tcl-mode)
1392 ("\\.itk\\'" . tcl-mode) 1397 ("\\.itk\\'" . tcl-mode)
1393 ("\\.icn\\'" . icon-mode) 1398 ("\\.icn\\'" . icon-mode)
1394 ("\\.sim\\'" . simula-mode) 1399 ("\\.sim\\'" . simula-mode)
1395 ("\\.mss\\'" . scribe-mode) 1400 ("\\.mss\\'" . scribe-mode)
1396 ("\\.f90\\'" . f90-mode) 1401 ("\\.f90\\'" . f90-mode)
1397 ("\\.pro\\'" . idlwave-mode) 1402 ("\\.pro\\'" . idlwave-mode)
1398 ("\\.lsp\\'" . lisp-mode) 1403 ("\\.lsp\\'" . lisp-mode)
1399 ("\\.awk\\'" . awk-mode) 1404 ("\\.awk\\'" . awk-mode)
1400 ("\\.prolog\\'" . prolog-mode) 1405 ("\\.prolog\\'" . prolog-mode)
1401 ("\\.tar\\'" . tar-mode) 1406 ("\\.tar\\'" . tar-mode)
1402 ("\\.\\(arc\\|zip\\|lzh\\|zoo\\|jar\\)\\'" . archive-mode) 1407 ("\\.\\(arc\\|zip\\|lzh\\|zoo\\|jar\\)\\'" . archive-mode)
1403 ("\\.\\(ARC\\|ZIP\\|LZH\\|ZOO\\|JAR\\)\\'" . archive-mode) 1408 ("\\.\\(ARC\\|ZIP\\|LZH\\|ZOO\\|JAR\\)\\'" . archive-mode)
1404 ;; Mailer puts message to be edited in 1409 ;; Mailer puts message to be edited in
1405 ;; /tmp/Re.... or Message 1410 ;; /tmp/Re.... or Message
1406 ("\\`/tmp/Re" . text-mode) 1411 ("\\`/tmp/Re" . text-mode)
1407 ("/Message[0-9]*\\'" . text-mode) 1412 ("/Message[0-9]*\\'" . text-mode)
1408 ("/drafts/[0-9]+\\'" . mh-letter-mode) 1413 ("/drafts/[0-9]+\\'" . mh-letter-mode)
1409 ("\\.zone\\'" . zone-mode) 1414 ("\\.zone\\'" . zone-mode)
1410 ;; some news reader is reported to use this 1415 ;; some news reader is reported to use this
1411 ("\\`/tmp/fol/" . text-mode) 1416 ("\\`/tmp/fol/" . text-mode)
1412 ("\\.y\\'" . c-mode) 1417 ("\\.y\\'" . c-mode)
1413 ("\\.lex\\'" . c-mode) 1418 ("\\.lex\\'" . c-mode)
1414 ("\\.oak\\'" . scheme-mode) 1419 ("\\.oak\\'" . scheme-mode)
1415 ("\\.sgml?\\'" . sgml-mode) 1420 ("\\.sgml?\\'" . sgml-mode)
1416 ("\\.xml\\'" . sgml-mode) 1421 ("\\.xml\\'" . sgml-mode)
1417 ("\\.dtd\\'" . sgml-mode) 1422 ("\\.dtd\\'" . sgml-mode)
1418 ("\\.ds\\(ss\\)?l\\'" . dsssl-mode) 1423 ("\\.ds\\(ss\\)?l\\'" . dsssl-mode)
1419 ("\\.idl\\'" . idl-mode) 1424 ("\\.idl\\'" . idl-mode)
1420 ;; .emacs following a directory delimiter 1425 ;; .emacs following a directory delimiter
1421 ;; in Unix, MSDOG or VMS syntax. 1426 ;; in Unix, MSDOG or VMS syntax.
1422 ("[]>:/\\]\\..*emacs\\'" . emacs-lisp-mode) 1427 ("[]>:/\\]\\..*emacs\\'" . emacs-lisp-mode)
1423 ("\\`\\..*emacs\\'" . emacs-lisp-mode) 1428 ("\\`\\..*emacs\\'" . emacs-lisp-mode)
1424 ;; _emacs following a directory delimiter 1429 ;; _emacs following a directory delimiter
1425 ;; in MsDos syntax 1430 ;; in MsDos syntax
1426 ("[:/]_emacs\\'" . emacs-lisp-mode) 1431 ("[:/]_emacs\\'" . emacs-lisp-mode)
1427 ("/crontab\\.X*[0-9]+\\'" . shell-script-mode) 1432 ("/crontab\\.X*[0-9]+\\'" . shell-script-mode)
1428 ("\\.ml\\'" . lisp-mode) 1433 ("\\.ml\\'" . lisp-mode)
1429 ("\\.asn$" . snmp-mode) 1434 ("\\.asn$" . snmp-mode)
1430 ("\\.mib$" . snmp-mode) 1435 ("\\.mib$" . snmp-mode)
1431 ("\\.smi$" . snmp-mode) 1436 ("\\.smi$" . snmp-mode)
1432 ("\\.as2$" . snmpv2-mode) 1437 ("\\.as2$" . snmpv2-mode)
1433 ("\\.mi2$" . snmpv2-mode) 1438 ("\\.mi2$" . snmpv2-mode)
1434 ("\\.sm2$" . snmpv2-mode) 1439 ("\\.sm2$" . snmpv2-mode)
1435 ("\\.\\(diffs?\\|patch\\|rej\\)\\'" . diff-mode) 1440 ("\\.\\(diffs?\\|patch\\|rej\\)\\'" . diff-mode)
1436 ("\\.[eE]?[pP][sS]$" . ps-mode) 1441 ("\\.[eE]?[pP][sS]$" . ps-mode)
1437 ("configure\\.in\\'" . autoconf-mode) 1442 ("configure\\.in\\'" . autoconf-mode)
1438 ("BROWSE\\'" . ebrowse-tree-mode) 1443 ("BROWSE\\'" . ebrowse-tree-mode)
1439 ("\\.ebrowse\\'" . ebrowse-tree-mode)) 1444 ("\\.ebrowse\\'" . ebrowse-tree-mode)))
1440 "\ 1445 "Alist of filename patterns vs corresponding major mode functions.
1441Alist of filename patterns vs corresponding major mode functions.
1442Each element looks like (REGEXP . FUNCTION) or (REGEXP FUNCTION NON-NIL). 1446Each element looks like (REGEXP . FUNCTION) or (REGEXP FUNCTION NON-NIL).
1443\(NON-NIL stands for anything that is not nil; the value does not matter.) 1447\(NON-NIL stands for anything that is not nil; the value does not matter.)
1444Visiting a file whose name matches REGEXP specifies FUNCTION as the 1448Visiting a file whose name matches REGEXP specifies FUNCTION as the
@@ -1450,43 +1454,46 @@ REGEXP and search the list again for another match.")
1450 1454
1451 1455
1452(defvar interpreter-mode-alist 1456(defvar interpreter-mode-alist
1453 '(("perl" . perl-mode) 1457 (mapc
1454 ("perl5" . perl-mode) 1458 (lambda (l)
1455 ("miniperl" . perl-mode) 1459 (cons (purecopy (car l)) (cdr l)))
1456 ("wish" . tcl-mode) 1460 '(("perl" . perl-mode)
1457 ("wishx" . tcl-mode) 1461 ("perl5" . perl-mode)
1458 ("tcl" . tcl-mode) 1462 ("miniperl" . perl-mode)
1459 ("tclsh" . tcl-mode) 1463 ("wish" . tcl-mode)
1460 ("awk" . awk-mode) 1464 ("wishx" . tcl-mode)
1461 ("mawk" . awk-mode) 1465 ("tcl" . tcl-mode)
1462 ("nawk" . awk-mode) 1466 ("tclsh" . tcl-mode)
1463 ("gawk" . awk-mode) 1467 ("awk" . awk-mode)
1464 ("scm" . scheme-mode) 1468 ("mawk" . awk-mode)
1465 ("ash" . sh-mode) 1469 ("nawk" . awk-mode)
1466 ("bash" . sh-mode) 1470 ("gawk" . awk-mode)
1467 ("csh" . sh-mode) 1471 ("scm" . scheme-mode)
1468 ("dtksh" . sh-mode) 1472 ("ash" . sh-mode)
1469 ("es" . sh-mode) 1473 ("bash" . sh-mode)
1470 ("itcsh" . sh-mode) 1474 ("csh" . sh-mode)
1471 ("jsh" . sh-mode) 1475 ("dtksh" . sh-mode)
1472 ("ksh" . sh-mode) 1476 ("es" . sh-mode)
1473 ("oash" . sh-mode) 1477 ("itcsh" . sh-mode)
1474 ("pdksh" . sh-mode) 1478 ("jsh" . sh-mode)
1475 ("rc" . sh-mode) 1479 ("ksh" . sh-mode)
1476 ("rpm" . sh-mode) 1480 ("oash" . sh-mode)
1477 ("sh" . sh-mode) 1481 ("pdksh" . sh-mode)
1478 ("sh5" . sh-mode) 1482 ("rc" . sh-mode)
1479 ("tcsh" . sh-mode) 1483 ("rpm" . sh-mode)
1480 ("wksh" . sh-mode) 1484 ("sh" . sh-mode)
1481 ("wsh" . sh-mode) 1485 ("sh5" . sh-mode)
1482 ("zsh" . sh-mode) 1486 ("tcsh" . sh-mode)
1483 ("tail" . text-mode) 1487 ("wksh" . sh-mode)
1484 ("more" . text-mode) 1488 ("wsh" . sh-mode)
1485 ("less" . text-mode) 1489 ("zsh" . sh-mode)
1486 ("pg" . text-mode) 1490 ("tail" . text-mode)
1487 ("make" . makefile-mode) ; Debian uses this 1491 ("more" . text-mode)
1488 ("guile" . scheme-mode) 1492 ("less" . text-mode)
1489 ("clisp" . lisp-mode)) 1493 ("pg" . text-mode)
1494 ("make" . makefile-mode) ; Debian uses this
1495 ("guile" . scheme-mode)
1496 ("clisp" . lisp-mode)))
1490 "Alist mapping interpreter names to major modes. 1497 "Alist mapping interpreter names to major modes.
1491This alist applies to files whose first line starts with `#!'. 1498This alist applies to files whose first line starts with `#!'.
1492Each element looks like (INTERPRETER . MODE). 1499Each element looks like (INTERPRETER . MODE).
@@ -1583,7 +1590,7 @@ and we don't even do that unless it would come from the file name."
1583 ;; outside the save-excursion. 1590 ;; outside the save-excursion.
1584 (when modes 1591 (when modes
1585 (unless just-from-file-name 1592 (unless just-from-file-name
1586 (mapcar 'funcall (nreverse modes))) 1593 (mapc 'funcall (nreverse modes)))
1587 (setq done t)) 1594 (setq done t))
1588 ;; If we didn't find a mode from a -*- line, try using the file name. 1595 ;; If we didn't find a mode from a -*- line, try using the file name.
1589 (if (and (not done) buffer-file-name) 1596 (if (and (not done) buffer-file-name)