This repository has been archived by the owner on Feb 5, 2024. It is now read-only.
forked from emacsattic/wget
-
Notifications
You must be signed in to change notification settings - Fork 1
/
w3m-wget.el
71 lines (56 loc) · 2.28 KB
/
w3m-wget.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
;;; w3m-wget.el --- Interface program of wget on emacs-w3m.
;; Copyright (C) 2001, 2002 Masayuki Ataka <[email protected]>
;; $Id: w3m-wget.el,v 1.14 2004/03/12 22:31:46 m1378502 Exp $
;; Authors: Masayuki Ataka <[email protected]>
;; Keywords: w3m, WWW, hypermedia
;; This file is a part of emacs-wget.
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, you can either send email to this
;; program's maintainer or write to: The Free Software Foundation,
;; Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
;;; Code:
(autoload 'wget-api "wget" "Application Program Interface for wget")
(defgroup w3m-wget nil
"wget interface for emacs-w3m."
:group 'wget
:group 'w3m
:prefix "w3m-wget-")
(defcustom w3m-wget-substitute-download-command t
"*If non-nil, substitute download command from emacs-w3m default to `w3m-wget'."
:group 'w3m-wget
:type 'boolean)
;;
;; Eval after load w3m.el
;;
(eval-after-load "w3m"
'(progn
(defun w3m-wget (arg)
"Download anchor, image, or current page.
With prefix argument ARG, you can change uri."
(interactive "P")
(let ((uri (or (w3m-anchor) (w3m-image)
(car (w3m-lnum-get-action "Wget on: " 1)))))
(if uri
(progn (setq wget-current-title w3m-current-title)
(wget-api uri w3m-current-url arg))
(error "No link selected"))))
(if w3m-wget-substitute-download-command
(substitute-key-definition 'w3m-download-this-url
'w3m-wget w3m-mode-map))))
(eval-after-load "w3m-lnum"
'(setq w3m-lnum-actions-link-alist
(append w3m-lnum-actions-link-alist
'((?d (lambda (info)
(setq wget-current-title w3m-current-title)
(wget-api (car info) w3m-current-url))
"Download with Wget")))))
(provide 'w3m-wget)
;;; w3m-wget.el ends here