From: Ivan Kanis <ivan@kanis.fr>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Emacs Development List <emacs-devel@gnu.org>
Subject: patches and one bug
Date: Mon, 24 Jun 2013 11:58:34 +0200 [thread overview]
Message-ID: <87bo6v25kl.fsf@kanis.fr> (raw)
[-- Attachment #1: Type: text/plain, Size: 412 bytes --]
Lars,
I have attached more patches.
There is a bug that I don't think I'll fix: it is the function
eww-open-file. It doesn't work with a file that doesn't have HTTP
headers.
emacs-wget fetches a file with wget asynchronously. It pops a small
window with the progress of the download.
I have attached my wget.el. I sent the author an e-mail to see if he
would sign the FSF paper work to include it in Emacs.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-fix-opening-file-URL.patch --]
[-- Type: text/x-diff, Size: 980 bytes --]
From 017c749f5590e0e564d9dab2de7dabd60766318e Mon Sep 17 00:00:00 2001
From: Ivan Kanis <ivan@tao>
Date: Mon, 24 Jun 2013 08:06:08 +0200
Subject: [PATCH 1/7] fix opening file:/// URL
---
emacs/gnus/eww.el | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/emacs/gnus/eww.el b/emacs/gnus/eww.el
index 959fc4d..53fa882 100644
--- a/emacs/gnus/eww.el
+++ b/emacs/gnus/eww.el
@@ -106,8 +106,9 @@ It will be used when emacs runs on neither Windows or Mac."
(> (length (split-string url "\\.")) 1))
(unless (string-match-p "\\`[a-zA-Z][-a-zA-Z0-9+.]*://" url)
(setq url (concat "http://" url)))
- (setq url (concat eww-search-prefix
- (replace-regexp-in-string " " "+" url))))
+ (unless (string-match-p "^file:" url)
+ (setq url (concat eww-search-prefix
+ (replace-regexp-in-string " " "+" url)))))
(url-retrieve url 'eww-render (list url)))
;;;###autoload
--
1.7.1
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-handle-quoted-charset-header.patch --]
[-- Type: text/x-diff, Size: 828 bytes --]
From 22526c5f7dabdf2d48ee58e93cb78c2d1f2ec9ed Mon Sep 17 00:00:00 2001
From: Ivan Kanis <ivan@tao>
Date: Mon, 24 Jun 2013 08:39:26 +0200
Subject: [PATCH 2/7] handle quoted charset header
(https://wincent.com/products/command-t to reproduce bug)
---
emacs/gnus/eww.el | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/emacs/gnus/eww.el b/emacs/gnus/eww.el
index 53fa882..aa39585 100644
--- a/emacs/gnus/eww.el
+++ b/emacs/gnus/eww.el
@@ -180,7 +180,7 @@ It will be used when emacs runs on neither Windows or Mac."
(pt (point)))
(or (and html-p
(re-search-forward
- "<meta[\t\n\r ]+[^>]*charset=\"?\\([^\t\n\r \"/>]+\\)" nil t)
+ "<meta[\t\n\r ]+[^>]*charset=\"?\\([^\t\n\r \"/>]+\\)[\\\"'.*]" nil t)
(goto-char pt)
(match-string 1))
(and (looking-at
--
1.7.1
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-key-y-puts-page-url-in-kill-ring.patch --]
[-- Type: text/x-diff, Size: 1035 bytes --]
From f5ccea29a6f31f3d3e742d5d224ec6140a7316e3 Mon Sep 17 00:00:00 2001
From: Ivan Kanis <ivan@tao>
Date: Mon, 24 Jun 2013 08:44:58 +0200
Subject: [PATCH 3/7] key 'y' puts page url in kill ring
---
emacs/gnus/eww.el | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/emacs/gnus/eww.el b/emacs/gnus/eww.el
index aa39585..50737d5 100644
--- a/emacs/gnus/eww.el
+++ b/emacs/gnus/eww.el
@@ -321,6 +321,7 @@ It will be used when emacs runs on neither Windows or Mac."
(define-key map "u" 'eww-up-url)
(define-key map "t" 'eww-top-url)
(define-key map "w" 'eww-browse-with-external-browser)
+ (define-key map "y" 'eww-yank-page-url)
map))
(define-derived-mode eww-mode nil "eww"
@@ -845,6 +846,10 @@ It support Windows and Mac then calls the function specified in
(t
(funcall eww-external-browser url)))))
+(defun eww-yank-page-url ()
+ (interactive)
+ (message eww-current-url)
+ (kill-new eww-current-url))
(provide 'eww)
;;; eww.el ends here
--
1.7.1
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-tack-at-the-end-of-naked-url.patch --]
[-- Type: text/x-diff, Size: 1236 bytes --]
From b183f74911508df20c2aee843490da05f4535a59 Mon Sep 17 00:00:00 2001
From: Ivan Kanis <ivan@tao>
Date: Mon, 24 Jun 2013 10:14:21 +0200
Subject: [PATCH 4/7] tack / at the end of naked url
ie: http://google.com -> http://google.com/
---
emacs/gnus/eww.el | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/emacs/gnus/eww.el b/emacs/gnus/eww.el
index 50737d5..d34b84a 100644
--- a/emacs/gnus/eww.el
+++ b/emacs/gnus/eww.el
@@ -109,6 +109,16 @@ It will be used when emacs runs on neither Windows or Mac."
(unless (string-match-p "^file:" url)
(setq url (concat eww-search-prefix
(replace-regexp-in-string " " "+" url)))))
+
+ (and (string-match "https*://\\(.*\\)" url)
+ ;; true when url part is just a hostname
+ (not (string-match "/" (substring url (match-beginning 1)
+ (match-end 1))))
+ ;; Last character is not /
+ (not (string= (substring url (1- (length url)) (length url)) "/"))
+ ;; tack / at the end of naked url
+ ;; ie: http://google.com -> http://google.com/
+ (setq url ( concat url "/")))
(url-retrieve url 'eww-render (list url)))
;;;###autoload
--
1.7.1
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-add-optional-argument-needed-for-browse-url.patch --]
[-- Type: text/x-diff, Size: 888 bytes --]
From b879b382de4ee3f14dbe652ebc996645cf52807a Mon Sep 17 00:00:00 2001
From: Ivan Kanis <ivan@tao>
Date: Mon, 24 Jun 2013 11:17:51 +0200
Subject: [PATCH 5/7] add optional argument needed for browse url
---
emacs/gnus/eww.el | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/emacs/gnus/eww.el b/emacs/gnus/eww.el
index d34b84a..f5c2eb9 100644
--- a/emacs/gnus/eww.el
+++ b/emacs/gnus/eww.el
@@ -99,8 +99,9 @@ It will be used when emacs runs on neither Windows or Mac."
(defvar eww-contents-url nil)
;;;###autoload
-(defun eww (url)
- "Fetch URL and render the page."
+(defun eww (url &optional new-session interactive-p)
+ "Fetch URL and render the page.
+NEW-SESSION and INTERCATIVE-P are not used"
(interactive "sEnter URL or keywords: ")
(if (and (= (length (split-string url)) 1)
(> (length (split-string url "\\.")) 1))
--
1.7.1
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #7: 0006-add-emacs-wget.patch --]
[-- Type: text/x-diff, Size: 1131 bytes --]
From 8816a9029f33ca98437ad88323ab9068f5b964fe Mon Sep 17 00:00:00 2001
From: Ivan Kanis <ivan@tao>
Date: Mon, 24 Jun 2013 11:41:58 +0200
Subject: [PATCH 6/7] add emacs-wget
---
emacs/gnus/shr.el | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/emacs/gnus/shr.el b/emacs/gnus/shr.el
index 868956d..5f74f27 100644
--- a/emacs/gnus/shr.el
+++ b/emacs/gnus/shr.el
@@ -141,6 +141,7 @@ cid: URL as the argument.")
(define-key map "u" 'shr-copy-url)
(define-key map "v" 'shr-browse-url)
(define-key map "o" 'shr-save-contents)
+ (define-key map "d" 'shr-wget)
(define-key map "\r" 'shr-browse-url)
map))
@@ -1634,6 +1635,17 @@ ones, in case fg and bg are nil."
(list oldval face)
(list face oldval))))))))))
+(defun shr-wget ()
+ "Download URL under point."
+ (interactive)
+ (when (not (fboundp 'wget-api))
+ (error "You need to install emacs-wget."))
+
+ (let ((url (get-text-property (point) 'shr-url)))
+ (if (not url)
+ (message "No URL under point")
+ (wget-api url nil))))
+
(provide 'shr)
;; Local Variables:
--
1.7.1
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #8: 0007-C-u-RET-opens-link-in-external-browser.patch --]
[-- Type: text/x-diff, Size: 1062 bytes --]
From 5ab007318cab14c2cb354a8d2c956321d4fe09f3 Mon Sep 17 00:00:00 2001
From: Ivan Kanis <ivan@tao>
Date: Mon, 24 Jun 2013 11:50:25 +0200
Subject: [PATCH 7/7] C-u RET opens link in external browser
---
emacs/gnus/shr.el | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/emacs/gnus/shr.el b/emacs/gnus/shr.el
index 5f74f27..117c7f6 100644
--- a/emacs/gnus/shr.el
+++ b/emacs/gnus/shr.el
@@ -640,9 +640,9 @@ size, and full-buffer size."
(forward-line 1)
(goto-char end))))))
-(defun shr-browse-url ()
+(defun shr-browse-url (arg)
"Browse the URL under point."
- (interactive)
+ (interactive "P")
(let ((url (get-text-property (point) 'shr-url)))
(cond
((not url)
@@ -650,7 +650,9 @@ size, and full-buffer size."
((string-match "^mailto:" url)
(browse-url-mail url))
(t
- (browse-url url)))))
+ (if arg
+ (eww-browse-with-external-browser)
+ (browse-url url))))))
(defun shr-save-contents (directory)
"Save the contents from URL in a file."
--
1.7.1
[-- Attachment #9: wget.el --]
[-- Type: application/emacs-lisp, Size: 39567 bytes --]
next reply other threads:[~2013-06-24 9:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-24 9:58 Ivan Kanis [this message]
2013-06-24 13:36 ` patches and one bug Lars Magne Ingebrigtsen
2013-06-24 13:43 ` Lars Magne Ingebrigtsen
2013-06-24 14:05 ` Rüdiger Sonderfeld
2013-06-24 17:42 ` Lars Magne Ingebrigtsen
2013-06-24 16:18 ` Ivan Kanis
2013-06-24 17:36 ` Lars Magne Ingebrigtsen
2013-06-24 19:41 ` Ivan Kanis
2013-06-24 19:47 ` Lars Magne Ingebrigtsen
2013-06-25 6:21 ` Ivan Kanis
2013-06-25 19:51 ` Lars Magne Ingebrigtsen
2013-06-25 20:23 ` Ivan Kanis
2013-06-24 16:46 ` Ivan Kanis
2013-06-24 17:39 ` Lars Magne Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bo6v25kl.fsf@kanis.fr \
--to=ivan@kanis.fr \
--cc=emacs-devel@gnu.org \
--cc=larsi@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.