1 ;;; url-dired.el --- URL Dired minor mode
3 ;; Copyright (C) 1996-1999, 2004-2016 Free Software Foundation, Inc.
5 ;; Keywords: comm, files
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software: you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation, either version 3 of the License, or
12 ;; (at your option) any later version.
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
24 (autoload 'dired-get-filename
"dired")
26 (defvar url-dired-minor-mode-map
27 (let ((map (make-sparse-keymap)))
28 (define-key map
"\C-m" 'url-dired-find-file
)
29 (define-key map
[mouse-2
] 'url-dired-find-file-mouse
)
31 "Keymap used when browsing directories.")
33 (defun url-dired-find-file ()
34 "In dired, visit the file or directory named on this line."
36 (let ((filename (dired-get-filename)))
37 (find-file filename
)))
39 (defun url-dired-find-file-mouse (event)
40 "In dired, visit the file or directory name you click on."
42 (mouse-set-point event
)
43 (url-dired-find-file))
45 (define-minor-mode url-dired-minor-mode
46 "Minor mode for directory browsing.
47 With a prefix argument ARG, enable the mode if ARG is positive,
48 and disable it otherwise. If called from Lisp, enable the mode
49 if ARG is omitted or nil."
50 :lighter
" URL" :keymap url-dired-minor-mode-map
)
52 (defun url-find-file-dired (dir)
53 "\"Edit\" directory DIR, but with additional URL-friendly bindings."
54 (interactive "DURL Dired (directory): ")
56 (url-dired-minor-mode t
))
60 ;;; url-dired.el ends here