annotate lisp/efs/default-dir.el @ 22:8fc7fe29b841 r19-15b94

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