comparison lisp/prim/files.el @ 24:4103f0995bd7 r19-15b95

Import from CVS: tag r19-15b95
author cvs
date Mon, 13 Aug 2007 08:51:03 +0200
parents 8fc7fe29b841
children 441bb1e64a06
comparison
equal deleted inserted replaced
23:0edd3412f124 24:4103f0995bd7
142 "*Control use of version numbers for backup files. 142 "*Control use of version numbers for backup files.
143 t means make numeric backup versions unconditionally. 143 t means make numeric backup versions unconditionally.
144 nil means make them for files that have some already. 144 nil means make them for files that have some already.
145 `never' means do not make them.") 145 `never' means do not make them.")
146 146
147 (defvar dired-kept-versions 2 147 ;; This is now defined in efs.
148 "*When cleaning directory, number of versions to keep.") 148 ;(defvar dired-kept-versions 2
149 ; "*When cleaning directory, number of versions to keep.")
149 150
150 (defvar delete-old-versions nil 151 (defvar delete-old-versions nil
151 "*If t, delete excess backup versions silently. 152 "*If t, delete excess backup versions silently.
152 If nil, ask confirmation. Any other value prevents any trimming.") 153 If nil, ask confirmation. Any other value prevents any trimming.")
153 154
1236 (if mode 1237 (if mode
1237 (funcall mode)) 1238 (funcall mode))
1238 )))))) 1239 ))))))
1239 1240
1240 ;; XEmacs: this function is not synched with FSF 1241 ;; XEmacs: this function is not synched with FSF
1242 ;; jwz - New Version 20.1/19.15
1241 (defun hack-local-variables-prop-line (&optional force) 1243 (defun hack-local-variables-prop-line (&optional force)
1242 ;; Set local variables specified in the -*- line. 1244 ;; Set local variables specified in the -*- line.
1243 ;; Returns t if mode was set. 1245 ;; Returns t if mode was set.
1244 (let ((result nil)) 1246 (let ((result nil))
1245 (save-excursion 1247 (save-excursion
1256 (end-of-line (and (looking-at "^#!") 2)) 1258 (end-of-line (and (looking-at "^#!") 2))
1257 (point)))) 1259 (point))))
1258 ;; Parse the -*- line into the `result' alist. 1260 ;; Parse the -*- line into the `result' alist.
1259 (cond ((not (search-forward "-*-" end t)) 1261 (cond ((not (search-forward "-*-" end t))
1260 ;; doesn't have one. 1262 ;; doesn't have one.
1261 (setq force t)) 1263 nil)
1262 ((looking-at "[ \t]*\\([^ \t\n\r:;]+\\)\\([ \t]*-\\*-\\)") 1264 ((looking-at "[ \t]*\\([^ \t\n\r:;]+\\)\\([ \t]*-\\*-\\)")
1263 ;; Antiquated form: "-*- ModeName -*-". 1265 ;; Antiquated form: "-*- ModeName -*-".
1264 (setq result 1266 (setq result
1265 (list (cons 'mode 1267 (list (cons 'mode
1266 (intern (buffer-substring 1268 (intern (buffer-substring
1292 (setq key 'mode)) 1294 (setq key 'mode))
1293 (setq result (cons (cons key val) result)) 1295 (setq result (cons (cons key val) result))
1294 (skip-chars-forward " \t;"))) 1296 (skip-chars-forward " \t;")))
1295 (setq result (nreverse result)))))) 1297 (setq result (nreverse result))))))
1296 1298
1297 (if result 1299 (let ((set-any-p (or force (hack-local-variables-p t)))
1298 (let ((set-any-p (or force (hack-local-variables-p t))) 1300 (mode-p nil))
1299 (mode-p nil)) 1301 (while result
1300 (while result 1302 (let ((key (car (car result)))
1301 (let ((key (car (car result))) 1303 (val (cdr (car result))))
1302 (val (cdr (car result)))) 1304 (cond ((eq key 'mode)
1303 (cond ((eq key 'mode) 1305 (setq mode-p t)
1304 (setq mode-p t) 1306 (funcall (intern (concat (downcase (symbol-name val))
1305 (funcall (intern (concat (downcase (symbol-name val)) 1307 "-mode"))))
1306 "-mode")))) 1308 (set-any-p
1307 (set-any-p 1309 (hack-one-local-variable key val))
1308 (hack-one-local-variable key val)) 1310 (t
1309 (t 1311 nil)))
1310 nil))) 1312 (setq result (cdr result)))
1311 (setq result (cdr result))) 1313 mode-p)))
1312 mode-p))))
1313 1314
1314 (defvar hack-local-variables-hook nil 1315 (defvar hack-local-variables-hook nil
1315 "Normal hook run after processing a file's local variables specs. 1316 "Normal hook run after processing a file's local variables specs.
1316 Major modes can use this to examine user-specified local variables 1317 Major modes can use this to examine user-specified local variables
1317 in order to initialize other data structure based on them. 1318 in order to initialize other data structure based on them.
3009 ;; Suggested by Michael Kifer <kifer@CS.SunySB.EDU> 3010 ;; Suggested by Michael Kifer <kifer@CS.SunySB.EDU>
3010 (defun file-remote-p (file) 3011 (defun file-remote-p (file)
3011 "Test whether file resides on the local system. 3012 "Test whether file resides on the local system.
3012 The special value 'unknown is returned if no remote file access package 3013 The special value 'unknown is returned if no remote file access package
3013 has been loaded." 3014 has been loaded."
3014 (cond ((fboundp 'efs-ftp-path) (efs-ftp-path name)) 3015 (cond ((featurep 'ange-ftp) (ange-ftp-ftp-path file-name))
3015 ((fboundp 'ange-ftp-ftp-name) (ange-ftp-ftp-name name)) 3016 (t (require 'efs)
3016 (t 'unknown))) 3017 (efs-ftp-path file-name))))
3017 3018
3018 ;; Written in C in FSF 3019 ;; Written in C in FSF
3019 (defun insert-file-contents (filename &optional visit beg end replace) 3020 (defun insert-file-contents (filename &optional visit beg end replace)
3020 "Insert contents of file FILENAME after point. 3021 "Insert contents of file FILENAME after point.
3021 Returns list of absolute file name and length of data inserted. 3022 Returns list of absolute file name and length of data inserted.