Mercurial > hg > xemacs-beta
comparison lisp/efs/default-dir.el @ 116:9f59509498e1 r20-1b10
Import from CVS: tag r20-1b10
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:23:06 +0200 |
parents | 8619ce7e4c50 |
children | 7d55a9ba150c |
comparison
equal
deleted
inserted
replaced
115:f109f7dabbe2 | 116:9f59509498e1 |
---|---|
1 ;; -*-Emacs-Lisp-*- | 1 ;; -*-Emacs-Lisp-*- |
2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
3 ;; | 3 ;; |
4 ;; File: default-dir.el | 4 ;; File: default-dir.el |
5 ;; RCS: | 5 ;; RCS: |
6 ;; Version: $Revision: 1.4 $ | 6 ;; Version: #Revision: 1.5 $ |
7 ;; Description: Defines the function default-directory, for fancy handling | 7 ;; Description: Defines the function default-directory, for fancy handling |
8 ;; of the initial contents in the minibuffer when reading | 8 ;; of the initial contents in the minibuffer when reading |
9 ;; file names. | 9 ;; file names. |
10 ;; Authors: Sebastian Kremer <sk@thp.uni-koeln.de> | 10 ;; Authors: Sebastian Kremer <sk@thp.uni-koeln.de> |
11 ;; Sandy Rutherford <sandy@ibm550.sissa.it> | 11 ;; Sandy Rutherford <sandy@ibm550.sissa.it> |
33 (defconst default-dir-emacs-variant | 33 (defconst default-dir-emacs-variant |
34 (cond ((string-match "XEmacs" emacs-version) 'xemacs) | 34 (cond ((string-match "XEmacs" emacs-version) 'xemacs) |
35 ((>= (string-to-int (substring emacs-version 0 2)) 19) 'fsf-19) | 35 ((>= (string-to-int (substring emacs-version 0 2)) 19) 'fsf-19) |
36 (t 'fsf-18))) | 36 (t 'fsf-18))) |
37 | 37 |
38 (defconst default-dir-find-file-takes-coding-system | |
39 (and (eq default-dir-emacs-variant 'xemacs) | |
40 (>= (string-to-int (substring emacs-version 0 2)) 20))) | |
41 | |
38 ;;;###autoload | 42 ;;;###autoload |
39 (defvar default-directory-function nil | 43 (defvar default-directory-function nil |
40 "A function to call to compute the default-directory for the current buffer. | 44 "A function to call to compute the default-directory for the current buffer. |
41 If this is nil, the function default-directory will return the value of the | 45 If this is nil, the function default-directory will return the value of the |
42 variable default-directory. | 46 variable default-directory. |
59 ;;; Overloads | 63 ;;; Overloads |
60 | 64 |
61 (cond | 65 (cond |
62 ((or (featurep 'mule) | 66 ((or (featurep 'mule) |
63 (boundp 'MULE)) | 67 (boundp 'MULE)) |
64 | 68 |
65 (defun default-dir-find-file (file &optional coding-system) | 69 (defun default-dir-find-file (file &optional coding-system) |
66 "Documented as original" | 70 "Documented as original" |
67 (interactive | 71 (interactive |
68 (list | 72 (list |
69 (expand-file-name | 73 (expand-file-name |
120 (default-directory))) | 124 (default-directory))) |
121 (and current-prefix-arg | 125 (and current-prefix-arg |
122 (read-coding-system "Coding-system: ")))) | 126 (read-coding-system "Coding-system: ")))) |
123 (default-dir-real-find-file-other-frame file | 127 (default-dir-real-find-file-other-frame file |
124 coding-system)))) | 128 coding-system)))) |
125 | 129 |
126 (if (fboundp 'find-file-read-only-other-frame) | 130 (if (fboundp 'find-file-read-only-other-frame) |
127 (progn | 131 (progn |
128 (defun default-dir-find-file-read-only-other-frame | 132 (defun default-dir-find-file-read-only-other-frame |
129 (file &optional coding-system) | 133 (file &optional coding-system) |
130 "Documented as original" | 134 "Documented as original" |
143 ;; still accepts an optional argument for find-file related | 147 ;; still accepts an optional argument for find-file related |
144 ;; functions. Things like advice.el insist on passing nil for | 148 ;; functions. Things like advice.el insist on passing nil for |
145 ;; optional arguments, and the interaction screws things up. | 149 ;; optional arguments, and the interaction screws things up. |
146 ;; Therefore these functions accept an optional dummy coding-system | 150 ;; Therefore these functions accept an optional dummy coding-system |
147 ;; argument. | 151 ;; argument. |
148 | 152 |
149 (defun default-dir-find-file (file &optional coding-system) | 153 (defun default-dir-find-file (file &optional coding-system) |
150 "Documented as original" | 154 "Documented as original" |
151 (interactive | 155 (interactive |
152 (list | 156 (list |
153 (expand-file-name | 157 (expand-file-name |
154 (read-file-name "Find file: " (default-directory))))) | 158 (read-file-name "Find file: " (default-directory))))) |
155 (default-dir-real-find-file file coding-system)) | 159 (default-dir-real-find-file file)) |
156 | 160 |
157 (defun default-dir-find-file-other-window (file &optional coding-system) | 161 (defun default-dir-find-file-other-window (file &optional coding-system) |
158 "Documented as original" | 162 "Documented as original" |
159 (interactive | 163 (interactive |
160 (list | 164 (list |
161 (expand-file-name | 165 (expand-file-name |
162 (read-file-name "Find file in other window: " (default-directory))))) | 166 (read-file-name "Find file in other window: " (default-directory))))) |
163 (default-dir-real-find-file-other-window file coding-system)) | 167 (default-dir-real-find-file-other-window file)) |
164 | 168 |
165 (defun default-dir-find-file-read-only (file &optional coding-system) | 169 (defun default-dir-find-file-read-only (file &optional coding-system) |
166 "Documented as original" | 170 "Documented as original" |
167 (interactive | 171 (interactive |
168 (list | 172 (list |
169 (expand-file-name | 173 (expand-file-name |
170 (read-file-name "Find file read-only: " (default-directory) nil t)))) | 174 (read-file-name "Find file read-only: " (default-directory) nil t)))) |
171 (default-dir-real-find-file-read-only file coding-system)) | 175 (default-dir-real-find-file-read-only file)) |
172 | 176 |
173 (if (fboundp 'find-file-read-only-other-window) | 177 (if (fboundp 'find-file-read-only-other-window) |
174 (progn | 178 (progn |
175 (defun default-dir-find-file-read-only-other-window | 179 (defun default-dir-find-file-read-only-other-window |
176 (file &optional coding-system) | 180 (file &optional coding-system) |
206 (read-file-name "Find file read-only in other frame: " | 210 (read-file-name "Find file read-only in other frame: " |
207 (default-directory) nil t)))) | 211 (default-directory) nil t)))) |
208 (default-dir-real-find-file-read-only-other-frame file))))) | 212 (default-dir-real-find-file-read-only-other-frame file))))) |
209 | 213 |
210 (t | 214 (t |
215 | |
211 (defun default-dir-find-file (file) | 216 (defun default-dir-find-file (file) |
212 "Documented as original" | 217 "Documented as original" |
213 (interactive | 218 (interactive |
214 (list | 219 (list |
215 (expand-file-name | 220 (expand-file-name |
264 (expand-file-name | 269 (expand-file-name |
265 (read-file-name "Find file read-only in other frame: " | 270 (read-file-name "Find file read-only in other frame: " |
266 (default-directory) nil t)))) | 271 (default-directory) nil t)))) |
267 (default-dir-real-find-file-read-only-other-frame file)))))) | 272 (default-dir-real-find-file-read-only-other-frame file)))))) |
268 | 273 |
269 | 274 |
270 | 275 |
271 (efs-overwrite-fn "default-dir" 'find-file 'default-dir-find-file) | 276 (efs-overwrite-fn "default-dir" 'find-file 'default-dir-find-file) |
272 (efs-overwrite-fn "default-dir" 'find-file-other-window | 277 (efs-overwrite-fn "default-dir" 'find-file-other-window |
273 'default-dir-find-file-other-window) | 278 'default-dir-find-file-other-window) |
274 (if (fboundp 'find-file-other-frame) | 279 (if (fboundp 'find-file-other-frame) |
359 (interactive | 364 (interactive |
360 (list | 365 (list |
361 (expand-file-name | 366 (expand-file-name |
362 (read-file-name "Change default directory: " (default-directory))))) | 367 (read-file-name "Change default directory: " (default-directory))))) |
363 (default-dir-real-cd dir)) | 368 (default-dir-real-cd dir)) |
364 | 369 |
365 (efs-overwrite-fn "default-dir" 'cd 'default-dir-cd) | 370 (efs-overwrite-fn "default-dir" 'cd 'default-dir-cd) |
366 | 371 |
367 (defun default-dir-set-visited-file-name (filename) | 372 (defun default-dir-set-visited-file-name (filename) |
368 "Documented as original" | 373 "Documented as original" |
369 (interactive | 374 (interactive |