Mercurial > hg > xemacs-beta
comparison lisp/files.el @ 219:262b8bb4a523 r20-4b8
Import from CVS: tag r20-4b8
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:09:35 +0200 |
parents | 78478c60bfcd |
children | 2c611d1463a6 |
comparison
equal
deleted
inserted
replaced
218:c9f226976f56 | 219:262b8bb4a523 |
---|---|
1322 -*- mode tag." | 1322 -*- mode tag." |
1323 (save-excursion | 1323 (save-excursion |
1324 ;; Look for -*-MODENAME-*- or -*- ... mode: MODENAME; ... -*- | 1324 ;; Look for -*-MODENAME-*- or -*- ... mode: MODENAME; ... -*- |
1325 ;; Do this by calling the hack-local-variables helper to avoid redundancy. | 1325 ;; Do this by calling the hack-local-variables helper to avoid redundancy. |
1326 ;; We bind enable-local-variables to nil this time because we're going to | 1326 ;; We bind enable-local-variables to nil this time because we're going to |
1327 ;; call hack-local-variables-prop-line again later, "for real." | 1327 ;; call hack-local-variables-prop-line again later, "for real." Note that |
1328 (or (let ((enable-local-variables nil)) | 1328 ;; this temporary binding does not prevent hack-local-variables-prop-line |
1329 (hack-local-variables-prop-line nil)) | 1329 ;; from setting the major mode. |
1330 (or (and enable-local-variables | |
1331 (let ((enable-local-variables nil)) | |
1332 (hack-local-variables-prop-line nil)) | |
1333 ) | |
1330 ;; It's not in the -*- line, so check the auto-mode-alist, unless | 1334 ;; It's not in the -*- line, so check the auto-mode-alist, unless |
1331 ;; this buffer isn't associated with a file. | 1335 ;; this buffer isn't associated with a file. |
1332 (null buffer-file-name) | 1336 (null buffer-file-name) |
1333 (let ((name (file-name-sans-versions buffer-file-name)) | 1337 (let ((name (file-name-sans-versions buffer-file-name)) |
1334 (keep-going t)) | 1338 (keep-going t)) |
1570 (setq key 'mode)) | 1574 (setq key 'mode)) |
1571 (setq result (cons (cons key val) result)) | 1575 (setq result (cons (cons key val) result)) |
1572 (skip-chars-forward " \t;"))) | 1576 (skip-chars-forward " \t;"))) |
1573 (setq result (nreverse result)))))) | 1577 (setq result (nreverse result)))))) |
1574 | 1578 |
1575 (let ((set-any-p (or force (hack-local-variables-p t))) | 1579 (let ((set-any-p (or force |
1580 ;; It's OK to force null specifications. | |
1581 (null result) | |
1582 ;; It's OK to force mode-only specifications. | |
1583 (let ((remaining result) | |
1584 (mode-specs-only t)) | |
1585 (while remaining | |
1586 (if (eq (car (car remaining)) 'mode) | |
1587 (setq remaining (cdr remaining)) | |
1588 ;; Otherwise, we have a real local. | |
1589 (setq mode-specs-only nil | |
1590 remaining nil)) | |
1591 ) | |
1592 mode-specs-only) | |
1593 ;; Otherwise, check. | |
1594 (hack-local-variables-p t))) | |
1576 (mode-p nil)) | 1595 (mode-p nil)) |
1577 (while result | 1596 (while result |
1578 (let ((key (car (car result))) | 1597 (let ((key (car (car result))) |
1579 (val (cdr (car result)))) | 1598 (val (cdr (car result)))) |
1580 (cond ((eq key 'mode) | 1599 (cond ((eq key 'mode) |
1581 (and enable-local-variables | 1600 (setq mode-p t) |
1582 (setq mode-p t) | 1601 (let ((mode (intern (concat (downcase (symbol-name val)) |
1583 (funcall (intern (concat (downcase (symbol-name val)) | 1602 "-mode")))) |
1584 "-mode"))))) | 1603 ;; Without this guard, `normal-mode' would potentially run |
1604 ;; the major mode function twice: once via `set-auto-mode' | |
1605 ;; and once via `hack-local-variables'. | |
1606 (if (not (eq mode major-mode)) | |
1607 (funcall mode)) | |
1608 )) | |
1585 (set-any-p | 1609 (set-any-p |
1586 (hack-one-local-variable key val)) | 1610 (hack-one-local-variable key val)) |
1587 (t | 1611 (t |
1588 nil))) | 1612 nil))) |
1589 (setq result (cdr result))) | 1613 (setq result (cdr result))) |
2694 This command first displays a Dired buffer showing you the | 2718 This command first displays a Dired buffer showing you the |
2695 previous sessions that you could recover from. | 2719 previous sessions that you could recover from. |
2696 To choose one, move point to the proper line and then type C-c C-c. | 2720 To choose one, move point to the proper line and then type C-c C-c. |
2697 Then you'll be asked about a number of files to recover." | 2721 Then you'll be asked about a number of files to recover." |
2698 (interactive) | 2722 (interactive) |
2723 (unless (fboundp 'dired) | |
2724 (error "recover-session requires dired")) | |
2699 (dired (concat auto-save-list-file-prefix "*")) | 2725 (dired (concat auto-save-list-file-prefix "*")) |
2700 (goto-char (point-min)) | 2726 (goto-char (point-min)) |
2701 (or (looking-at "Move to the session you want to recover,") | 2727 (or (looking-at "Move to the session you want to recover,") |
2702 (let ((inhibit-read-only t)) | 2728 (let ((inhibit-read-only t)) |
2703 (insert "Move to the session you want to recover,\n" | 2729 (insert "Move to the session you want to recover,\n" |
3094 ;; Suggested by Michael Kifer <kifer@CS.SunySB.EDU> | 3120 ;; Suggested by Michael Kifer <kifer@CS.SunySB.EDU> |
3095 (defun file-remote-p (file-name) | 3121 (defun file-remote-p (file-name) |
3096 "Test whether FILE-NAME is looked for on a remote system." | 3122 "Test whether FILE-NAME is looked for on a remote system." |
3097 (cond ((not allow-remote-paths) nil) | 3123 (cond ((not allow-remote-paths) nil) |
3098 ((featurep 'ange-ftp) (ange-ftp-ftp-path file-name)) | 3124 ((featurep 'ange-ftp) (ange-ftp-ftp-path file-name)) |
3099 (t (efs-ftp-path file-name)))) | 3125 ((fboundp 'efs-ftp-path) (efs-ftp-path file-name)) |
3126 (t nil))) | |
3100 | 3127 |
3101 ;;; files.el ends here | 3128 ;;; files.el ends here |