annotate lisp/efs/default-dir.el @ 100:4be1180a9e89 r20-1b2

Import from CVS: tag r20-1b2
author cvs
date Mon, 13 Aug 2007 09:15:11 +0200
parents 0d2f883870bc
children 8619ce7e4c50
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1 ;; -*-Emacs-Lisp-*-
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
3 ;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
4 ;; File: default-dir.el
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
5 ;; RCS:
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
6 ;; Version: $Revision: 1.3 $
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
7 ;; Description: Defines the function default-directory, for fancy handling
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
8 ;; of the initial contents in the minibuffer when reading
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
9 ;; file names.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
10 ;; Authors: Sebastian Kremer <sk@thp.uni-koeln.de>
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
11 ;; Sandy Rutherford <sandy@ibm550.sissa.it>
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
12 ;; Created: Sun Jul 18 11:38:06 1993 by sandy on ibm550
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
13 ;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
14 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
15
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
16 ;; This program is free software; you can redistribute it and/or modify
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
17 ;; it under the terms of the GNU General Public License as published by
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
18 ;; the Free Software Foundation; either version 1, or (at your option)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
19 ;; any later version.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
20
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
21 ;; This program is distributed in the hope that it will be useful,
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
22 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
23 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
24 ;; GNU General Public License for more details.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
25
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
26 ;; You should have received a copy of the GNU General Public License
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
27 ;; along with GNU Emacs; see the file COPYING. If not, write to
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
28 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
29
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
30 (provide 'default-dir)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
31 (require 'efs-ovwrt)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
32
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
33 (defconst default-dir-emacs-variant
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
34 (cond ((string-match "XEmacs" emacs-version) 'xemacs)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
35 ((>= (string-to-int (substring emacs-version 0 2)) 19) 'fsf-19)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
36 (t 'fsf-18)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
37
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
38 ;;;###autoload
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
39 (defvar default-directory-function nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
40 "A function to call to compute the default-directory for the current buffer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
41 If this is nil, the function default-directory will return the value of the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
42 variable default-directory.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
43 Buffer local.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
44 (make-variable-buffer-local 'default-directory-function)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
45
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
46 ;; As a bonus we give shell-command history if possible.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
47 (defvar shell-command-history nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
48 "History list of previous shell commands.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
49
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
50 (defun default-directory ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
51 " Returns the default-directory for the current buffer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
52 Will use the variable default-directory-function if it non-nil."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
53 (if default-directory-function
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
54 (funcall default-directory-function)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
55 (if (eq default-dir-emacs-variant 'xemacs)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
56 (abbreviate-file-name default-directory t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
57 (abbreviate-file-name default-directory))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
58
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
59 ;;; Overloads
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
60
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
61 (if (or (featurep 'mule)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
62 (boundp 'MULE))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
63 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
64
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
65 (defun default-dir-find-file (file &optional coding-system)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
66 "Documented as original"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
67 (interactive
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
68 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
69 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
70 (read-file-name "Find file: " (default-directory)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
71 (and current-prefix-arg
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
72 (read-coding-system "Coding-system: "))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
73 (default-dir-real-find-file file coding-system))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
74
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
75 (defun default-dir-find-file-other-window (file &optional coding-system)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
76 "Documented as original"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
77 (interactive
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
78 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
79 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
80 (read-file-name "Find file in other window: " (default-directory)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
81 (and current-prefix-arg
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
82 (read-coding-system "Coding-system: "))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
83 (default-dir-real-find-file-other-window file coding-system))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
84
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
85 (defun default-dir-find-file-read-only (file &optional coding-system)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
86 "Documented as original"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
87 (interactive
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
88 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
89 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
90 (read-file-name "Find file read-only: " (default-directory) nil t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
91 (and current-prefix-arg
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
92 (read-coding-system "Coding-system: "))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
93 (default-dir-real-find-file-read-only file coding-system))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
94
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
95 (if (fboundp 'find-file-read-only-other-window)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
96 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
97 (defun default-dir-find-file-read-only-other-window
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
98 (file &optional coding-system)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
99 "Documented as original"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
100 (interactive
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
101 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
102 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
103 (read-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
104 "Find file read-only in other window: "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
105 (default-directory) nil t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
106 (and current-prefix-arg
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
107 (read-coding-system "Coding-system: "))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
108 (default-dir-real-find-file-read-only-other-window file
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
109 coding-system))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
110
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
111 (if (fboundp 'find-file-other-frame)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
112 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
113 (defun default-dir-find-file-other-frame
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
114 (file &optional coding-system)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
115 "Documented as original"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
116 (interactive
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
117 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
118 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
119 (read-file-name "Find file in other frame: "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
120 (default-directory)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
121 (and current-prefix-arg
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
122 (read-coding-system "Coding-system: "))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
123 (default-dir-real-find-file-other-frame file
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
124 coding-system))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
125
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
126 (if (fboundp 'find-file-read-only-other-frame)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
127 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
128 (defun default-dir-find-file-read-only-other-frame
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
129 (file &optional coding-system)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
130 "Documented as original"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
131 (interactive
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
132 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
133 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
134 (read-file-name "Find file read-only in other frame: "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
135 (default-directory) nil t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
136 (and current-prefix-arg
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
137 (read-coding-system "Coding-system: "))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
138 (default-dir-real-find-file-read-only-other-frame file
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
139 coding-system)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
140
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
141 (defun default-dir-find-file (file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
142 "Documented as original"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
143 (interactive
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
144 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
145 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
146 (read-file-name "Find file: " (default-directory)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
147 (default-dir-real-find-file file))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
148
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
149 (defun default-dir-find-file-other-window (file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
150 "Documented as original"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
151 (interactive
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
152 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
153 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
154 (read-file-name "Find file in other window: " (default-directory)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
155 (default-dir-real-find-file-other-window file))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
156
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
157 (defun default-dir-find-file-read-only (file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
158 "Documented as original"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
159 (interactive
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
160 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
161 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
162 (read-file-name "Find file read-only: " (default-directory) nil t))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
163 (default-dir-real-find-file-read-only file))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
164
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
165 (if (fboundp 'find-file-read-only-other-window)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
166 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
167 (defun default-dir-find-file-read-only-other-window (file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
168 "Documented as original"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
169 (interactive
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
170 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
171 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
172 (read-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
173 "Find file read-only in other window: "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
174 (default-directory) nil t))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
175 (default-dir-real-find-file-read-only-other-window file))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
176
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
177 (if (fboundp 'find-file-other-frame)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
178 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
179 (defun default-dir-find-file-other-frame (file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
180 "Documented as original"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
181 (interactive
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
182 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
183 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
184 (read-file-name "Find file in other frame: "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
185 (default-directory)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
186 (default-dir-real-find-file-other-frame file))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
187
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
188 (if (fboundp 'find-file-read-only-other-frame)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
189 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
190 (defun default-dir-find-file-read-only-other-frame (file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
191 "Documented as original"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
192 (interactive
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
193 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
194 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
195 (read-file-name "Find file read-only in other frame: "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
196 (default-directory) nil t))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
197 (default-dir-real-find-file-read-only-other-frame file)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
198
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
199 (efs-overwrite-fn "default-dir" 'find-file 'default-dir-find-file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
200 (efs-overwrite-fn "default-dir" 'find-file-other-window
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
201 'default-dir-find-file-other-window)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
202 (if (fboundp 'find-file-other-frame)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
203 (efs-overwrite-fn "default-dir" 'find-file-other-frame
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
204 'default-dir-find-file-other-frame))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
205 (efs-overwrite-fn "default-dir" 'find-file-read-only
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
206 'default-dir-find-file-read-only)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
207 (if (fboundp 'find-file-read-only-other-window)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
208 (efs-overwrite-fn "default-dir" 'find-file-read-only-other-window
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
209 'default-dir-find-file-read-only-other-window))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
210 (if (fboundp 'find-file-read-only-other-frame)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
211 (efs-overwrite-fn "default-dir" 'find-file-read-only-other-frame
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
212 'default-dir-find-file-read-only-other-frame))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
213
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
214
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
215 (defun default-dir-load-file (file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
216 "Documented as original"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
217 (interactive
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
218 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
219 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
220 (read-file-name "Load file: " (default-directory) nil t))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
221 (default-dir-real-load-file file))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
222
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
223 (efs-overwrite-fn "default-dir" 'load-file 'default-dir-load-file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
224
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
225 (condition-case nil
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
226 (require 'view-less)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
227 (error (require 'view)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
228
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
229 (defun default-dir-view-file (file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
230 "Documented as original"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
231 (interactive
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
232 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
233 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
234 (read-file-name "View file: " (default-directory) nil t))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
235 (default-dir-real-view-file file))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
236
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
237 (efs-overwrite-fn "default-dir" 'view-file 'default-dir-view-file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
238
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
239 (if (fboundp 'view-file-other-window)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
240 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
241 (defun default-dir-view-file-other-window (file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
242 "Documented as original"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
243 (interactive
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
244 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
245 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
246 (read-file-name "View file in other window: "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
247 (default-directory) nil t))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
248 (default-dir-real-view-file-other-window file))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
249 (efs-overwrite-fn "default-dir" 'view-file-other-window
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
250 'default-dir-view-file-other-window)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
251
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
252 (if (fboundp 'view-file-other-frame)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
253 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
254 (defun default-dir-view-file-other-frame (file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
255 "Documented as original"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
256 (interactive
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
257 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
258 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
259 (read-file-name "View file in other frame: "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
260 (default-directory) nil t))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
261 (default-dir-real-view-file-other-frame file))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
262 (efs-overwrite-fn "default-dir" 'view-file-other-frame
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
263 'default-dir-view-file-other-frame)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
264
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
265
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
266 (defun default-dir-shell-command (command &optional insert)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
267 "Documented as original"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
268 (interactive
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
269 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
270 (let ((prompt (format "Shell command in %s: " (default-directory))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
271 (cond
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
272 ((memq default-dir-emacs-variant '(fsf-19 xemacs))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
273 (read-from-minibuffer prompt nil nil nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
274 'shell-command-history))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
275 ((featurep 'gmhist)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
276 (let ((minibuffer-history-symbol 'shell-command-history))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
277 (read-string prompt)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
278 (t (read-string prompt))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
279 current-prefix-arg))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
280 (let ((default-directory (expand-file-name (default-directory))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
281 (default-dir-real-shell-command command insert)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
282
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
283 (efs-overwrite-fn "default-dir" 'shell-command 'default-dir-shell-command)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
284
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
285 ;; Is advice about?
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
286 (if (featurep 'advice)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
287 (defadvice cd (before default-dir-cd activate compile)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
288 (interactive
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
289 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
290 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
291 (read-file-name "Change default directory: " (default-directory))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
292
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
293 (defun default-dir-cd (dir)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
294 "Documented as original"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
295 (interactive
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
296 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
297 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
298 (read-file-name "Change default directory: " (default-directory)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
299 (default-dir-real-cd dir))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
300
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
301 (efs-overwrite-fn "default-dir" 'cd 'default-dir-cd))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
302
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
303 (defun default-dir-set-visited-file-name (filename)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
304 "Documented as original"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
305 (interactive
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
306 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
307 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
308 (read-file-name "Set visited file name: " (default-directory)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
309 (default-dir-real-set-visited-file-name filename))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
310
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
311 (efs-overwrite-fn "default-dir" 'set-visited-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
312 'default-dir-set-visited-file-name)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
313
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
314 (defun default-dir-insert-file (filename &rest args)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
315 "Documented as original"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
316 (interactive
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
317 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
318 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
319 (read-file-name "Insert file: " (default-directory) nil t))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
320 (apply 'default-dir-real-insert-file filename args))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
321
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
322 (efs-overwrite-fn "default-dir" 'insert-file 'default-dir-insert-file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
323
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
324 (defun default-dir-append-to-file (start end filename &rest args)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
325 "Documented as original"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
326 (interactive
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
327 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
328 (or (mark) (error "The mark is not set now"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
329 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
330 (min (mark) (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
331 (max (mark) (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
332 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
333 (read-file-name "Append to file: " (default-directory))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
334 (apply 'default-dir-real-append-to-file start end filename args))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
335
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
336 (efs-overwrite-fn "default-dir" 'append-to-file 'default-dir-append-to-file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
337
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
338 (defun default-dir-delete-file (file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
339 "Documented as original"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
340 (interactive
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
341 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
342 (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
343 (read-file-name "Delete file: " (default-directory) nil t))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
344 (default-dir-real-delete-file file))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
345
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
346 (efs-overwrite-fn "default-dir" 'delete-file 'default-dir-delete-file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
347
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
348 ;;; end of default-dir.el