• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/emacs-93/emacs/lisp/

Lines Matching +defs:other +defs:file

9 ;; This file is part of GNU Emacs.
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
28 ;; This file provides the generic handling of the drop part only.
40 '(("^file:///" . dnd-open-local-file) ; XDND format.
41 ("^file://" . dnd-open-file) ; URL with host
42 ("^file:" . dnd-open-local-file) ; Old KDE, Motif, Sun
43 ("^\\(https?\\|ftp\\|file\\|nfs\\)://" . dnd-open-file)
47 This variable is used by `dnd-handle-one-url' and `dnd-handle-file-name'.
62 (defcustom dnd-open-remote-file-function
64 'dnd-open-local-file
66 "The function to call when opening a file on a remote machine.
68 `dnd-open-file' for details.
70 Predefined functions are `dnd-open-local-file' and `dnd-open-remote-url'.
71 `dnd-open-local-file' attempts to open a remote file using its UNC name and
79 (defcustom dnd-open-file-other-window nil
80 "If non-nil, always use find-file-other-window to open dropped files."
120 (defun dnd-get-local-file-uri (uri)
121 "Return an uri converted to file:/// syntax if uri is a local file.
122 Return nil if URI is not a local file."
125 ;; file. Otherwise return nil. TODO: How about an IP-address as hostname?
126 (let ((hostname (when (string-match "^file://\\([^/]*\\)" uri)
136 (concat "file://" (substring uri (+ 7 (length hostname)))))))
138 (defun dnd-get-local-file-name (uri &optional must-exist)
139 "Return file name converted from file:/// or file: syntax.
140 URI is the uri for the file. If MUST-EXIST is given and non-nil,
141 only return non-nil if the file exists.
142 Return nil if URI is not a local file."
143 (let ((f (cond ((string-match "^file:///" uri) ; XDND format.
145 ((string-match "^file:" uri) ; Old KDE, Motif, Sun
155 (or file-name-coding-system
156 default-file-name-coding-system)))
157 (try-f (if (file-readable-p decoded-f) decoded-f f)))
158 (when (file-readable-p try-f) try-f)))))
161 (defun dnd-open-local-file (uri action)
162 "Open a local file.
163 The file is opened in the current window, or a new window if
164 `dnd-open-file-other-window' is set. URI is the url for the file,
165 and must have the format file:file-name or file:///file-name.
166 The last / in file:/// is part of the file name. If the system
167 natively supports unc file names, then remote urls of the form
168 file://server-name/file-name will also be handled by this function.
169 An alternative for systems that do not support unc file names is
172 (let* ((f (dnd-get-local-file-name uri t)))
173 (if (and f (file-readable-p f))
175 (if dnd-open-file-other-window
176 (find-file-other-window f)
177 (find-file f))
182 "Open a remote file with `find-file' and `url-handler-mode'.
183 Turns `url-handler-mode' on if not on before. The file is opened in the
184 current window, or a new window if `dnd-open-file-other-window' is set.
185 URI is the url for the file. ACTION is ignored."
189 (if dnd-open-file-other-window
190 (find-file-other-window uri)
191 (find-file uri))
195 (defun dnd-open-file (uri action)
196 "Open a local or remote file.
197 The file is opened in the current window, or a new window if
198 `dnd-open-file-other-window' is set. URI is the url for the file,
199 and must have the format file://hostname/file-name. ACTION is ignored.
200 The last / in file://hostname/ is part of the file name."
203 ;; file. Otherwise return nil.
204 (let ((local-file (dnd-get-local-file-uri uri)))
205 (if local-file (dnd-open-local-file local-file action)
206 (if dnd-open-remote-file-function
207 (funcall dnd-open-remote-file-function uri action)