-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwww.el
More file actions
23 lines (17 loc) · 687 Bytes
/
www.el
File metadata and controls
23 lines (17 loc) · 687 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
;;;; www.el -- Web Browsing
(setq mk-browse-key "\C-cb")
(global-set-key mk-browse-key 'browse-url-at-point)
(add-hook 'dired-mode-hook
(lambda ()
(define-key dired-mode-map mk-browse-key 'mk-dired-browse-file)))
(defun mk-dired-browse-file ()
"In dired, open html file at point in a web-browse"
(interactive)
(let ((file (dired-get-filename)))
(when file (browse-url (concat "file://" file)))))
(defun mk-browse-current-buffer ()
(interactive)
(browse-url (concat "file://" (buffer-file-name (current-buffer)))))
;; TODO: write a dwim fn such that if I am at a URL, it opens the url;
;; if I am in a html buffer, run mk-browse-current-buffer.
(provide 'www)