merge trunk
[bpt/emacs.git] / lisp / url / url-dired.el
CommitLineData
8c8b8430 1;;; url-dired.el --- URL Dired minor mode
00eef4de 2
ba318903 3;; Copyright (C) 1996-1999, 2004-2014 Free Software Foundation, Inc.
00eef4de 4
8c8b8430
SM
5;; Keywords: comm, files
6
00eef4de
LH
7;; This file is part of GNU Emacs.
8
4936186e 9;; GNU Emacs is free software: you can redistribute it and/or modify
00eef4de 10;; it under the terms of the GNU General Public License as published by
4936186e
GM
11;; the Free Software Foundation, either version 3 of the License, or
12;; (at your option) any later version.
00eef4de
LH
13
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.
18
19;; You should have received a copy of the GNU General Public License
4936186e 20;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
00eef4de
LH
21
22;;; Code:
8c8b8430 23
8c8b8430
SM
24(autoload 'dired-get-filename "dired")
25
26(defvar url-dired-minor-mode-map
27 (let ((map (make-sparse-keymap)))
28 (define-key map "\C-m" 'url-dired-find-file)
cc38a294 29 (define-key map [mouse-2] 'url-dired-find-file-mouse)
8c8b8430
SM
30 map)
31 "Keymap used when browsing directories.")
32
8c8b8430 33(defun url-dired-find-file ()
e0566192 34 "In dired, visit the file or directory named on this line."
8c8b8430
SM
35 (interactive)
36 (let ((filename (dired-get-filename)))
e0566192 37 (find-file filename)))
8c8b8430
SM
38
39(defun url-dired-find-file-mouse (event)
e0566192 40 "In dired, visit the file or directory name you click on."
8c8b8430
SM
41 (interactive "@e")
42 (mouse-set-point event)
43 (url-dired-find-file))
44
56eb0904 45(define-minor-mode url-dired-minor-mode
e1ac4066
GM
46 "Minor mode for directory browsing.
47With a prefix argument ARG, enable the mode if ARG is positive,
48and disable it otherwise. If called from Lisp, enable the mode
49if ARG is omitted or nil."
56eb0904 50 :lighter " URL" :keymap url-dired-minor-mode-map)
8c8b8430
SM
51
52(defun url-find-file-dired (dir)
53 "\"Edit\" directory DIR, but with additional URL-friendly bindings."
54 (interactive "DURL Dired (directory): ")
55 (find-file dir)
56 (url-dired-minor-mode t))
57
58(provide 'url-dired)
e5566bd5 59
00eef4de 60;;; url-dired.el ends here