* bug#34291: Some EWW patches
@ 2019-02-02 19:26 Nicholas Drozd
2019-02-02 19:53 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: Nicholas Drozd @ 2019-02-02 19:26 UTC (permalink / raw)
To: 34291
[-- Attachment #1: Type: text/plain, Size: 153 bytes --]
One doc fix, one minor feature, one minor bug fix.
Let me know if these attachments are a problem, and I can send the
text of the patches individually.
[-- Attachment #2: 0003-lisp-net-eww.el-eww-download-callback-Fix-download-U.patch --]
[-- Type: text/x-patch, Size: 1455 bytes --]
From 6e491a94b0d7853931c96ebdcc39cd045da59fc5 Mon Sep 17 00:00:00 2001
From: Nick Drozd <nicholasdrozd@gmail.com>
Date: Sat, 2 Feb 2019 12:50:03 -0600
Subject: [PATCH 3/3] * lisp/net/eww.el (eww-download-callback): Fix download
URL path
Previously this wasn't handling download URLs correctly, resulting in
all downloaded pages being named "!", "!(1)", etc.
Take "https://emptysqua.re/blog/getaddrinfo-cpython-mac-and-bsd/" as
an example. `url-path-and-query' breaks this down to
"/blog/getaddrinfo-cpython-mac-and-bsd/", and this gets passed to
`file-name-nondirectory'. But that path looks like a directory because
of the trailing slash, so `eww-decode-url-file-name' would end up with
an empty string. Instead, remove the trailing slash so that a nonempty
file name is passed in.
---
lisp/net/eww.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 0c8bffa579..da18535fdb 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -1544,7 +1544,7 @@ eww-download
(defun eww-download-callback (status url)
(unless (plist-get status :error)
(let* ((obj (url-generic-parse-url url))
- (path (car (url-path-and-query obj)))
+ (path (string-remove-suffix "/" (car (url-path-and-query obj))))
(file (eww-make-unique-file-name
(eww-decode-url-file-name (file-name-nondirectory path))
eww-download-directory)))
--
2.17.1
[-- Attachment #3: 0001-doc-misc-eww.texi-Basics-Fix-eww-manual-keybinding.patch --]
[-- Type: text/x-patch, Size: 824 bytes --]
From fb95cdd55641a8ea9b48176604a1420ff2cbb7bf Mon Sep 17 00:00:00 2001
From: Nick Drozd <nicholasdrozd@gmail.com>
Date: Sat, 2 Feb 2019 12:31:44 -0600
Subject: [PATCH 1/3] * doc/misc/eww.texi (Basics): Fix eww manual keybinding
C is bound to url-cookie-list.
---
doc/misc/eww.texi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi
index b299ea1fb7..088da6f5fe 100644
--- a/doc/misc/eww.texi
+++ b/doc/misc/eww.texi
@@ -118,7 +118,7 @@ Basics
@findex eww-toggle-colors
@findex shr-use-colors
@kindex F
- The @kbd{C} command (@code{eww-toggle-colors}) toggles whether to use
+ The @kbd{M-C} command (@code{eww-toggle-colors}) toggles whether to use
HTML-specified colors or not. This sets the @code{shr-use-colors} variable.
@findex eww-download
--
2.17.1
[-- Attachment #4: 0002-eww-download-Use-link-under-point-or-current-URL.patch --]
[-- Type: text/x-patch, Size: 1915 bytes --]
From 9d60ec71260f627940d179e3bd559014b6c5a15d Mon Sep 17 00:00:00 2001
From: Nick Drozd <nicholasdrozd@gmail.com>
Date: Sat, 2 Feb 2019 12:35:02 -0600
Subject: [PATCH 2/3] eww-download: Use link under point or current URL
* lisp/net/eww.el (eww-download)
* doc/misc/eww.texi (Basics)
---
doc/misc/eww.texi | 7 ++++---
lisp/net/eww.el | 6 ++++--
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi
index 088da6f5fe..79175d10a9 100644
--- a/doc/misc/eww.texi
+++ b/doc/misc/eww.texi
@@ -125,9 +125,10 @@ Basics
@vindex eww-download-directory
@kindex d
@cindex Download
- A URL under the point can be downloaded with @kbd{d}
-(@code{eww-download}). The file will be written to the directory
-specified in @code{eww-download-directory} (Default: @file{~/Downloads/}).
+ A URL can be downloaded with @kbd{d} (@code{eww-download}). This
+will download the link under point if there is one, or else the URL of
+the current page. The file will be written to the directory specified
+in @code{eww-download-directory} (Default: @file{~/Downloads/}).
@findex eww-back-url
@findex eww-forward-url
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 3b7d9d5c2f..0c8bffa579 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -1531,10 +1531,12 @@ eww-copy-page-url
(kill-new (plist-get eww-data :url)))
(defun eww-download ()
- "Download URL under point to `eww-download-directory'."
+ "Download URL to `eww-download-directory'.
+Use link under point if there is one, else the current page URL."
(interactive)
(access-file eww-download-directory "Download failed")
- (let ((url (get-text-property (point) 'shr-url)))
+ (let ((url (or (get-text-property (point) 'shr-url)
+ (eww-current-url))))
(if (not url)
(message "No URL under point")
(url-retrieve url 'eww-download-callback (list url)))))
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* bug#34291: Some EWW patches
2019-02-02 19:26 bug#34291: Some EWW patches Nicholas Drozd
@ 2019-02-02 19:53 ` Eli Zaretskii
2019-02-05 0:26 ` Nicholas Drozd
0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2019-02-02 19:53 UTC (permalink / raw)
To: Nicholas Drozd; +Cc: 34291
> From: Nicholas Drozd <nicholasdrozd@gmail.com>
> Date: Sat, 2 Feb 2019 13:26:16 -0600
>
> Subject: [PATCH 3/3] * lisp/net/eww.el (eww-download-callback): Fix download
> URL path
>
> Previously this wasn't handling download URLs correctly, resulting in
> all downloaded pages being named "!", "!(1)", etc.
>
> Take "https://emptysqua.re/blog/getaddrinfo-cpython-mac-and-bsd/" as
> an example. `url-path-and-query' breaks this down to
> "/blog/getaddrinfo-cpython-mac-and-bsd/", and this gets passed to
> `file-name-nondirectory'. But that path looks like a directory because
> of the trailing slash, so `eww-decode-url-file-name' would end up with
> an empty string. Instead, remove the trailing slash so that a nonempty
> file name is passed in.
This log message lacks the ChangeLog-style list of functions that are
being changes, with short descriptions of the changes in each one.
(Same problem with the second patch.)
Also, please leave 2 spaces between sentences.
> - (path (car (url-path-and-query obj)))
> + (path (string-remove-suffix "/" (car (url-path-and-query obj))))
Please use directory-file-name here instead of string-remove-suffix.
Btw, isn't it better to remove all the leading directories, leaving
just the last component (a.k.a. the "basename")?
> * lisp/net/eww.el (eww-download)
> * doc/misc/eww.texi (Basics)
This should tell what was changed in each function/node. See
CONTRIBUTE, and the examples in the ChangeLog files in the tree.
> +the current page. The file will be written to the directory specified
^^
Two spaces between sentences, please.
> +in @code{eww-download-directory} (Default: @file{~/Downloads/}).
The "Default" part should not be capitalized (it's not a separate
sentence).
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#34291: Some EWW patches
2019-02-02 19:53 ` Eli Zaretskii
@ 2019-02-05 0:26 ` Nicholas Drozd
2019-02-08 7:53 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: Nicholas Drozd @ 2019-02-05 0:26 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 34291
[-- Attachment #1: Type: text/plain, Size: 1989 bytes --]
Feel free to fix any remaining formatting / style issues.
On Sat, Feb 2, 2019 at 1:54 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Nicholas Drozd <nicholasdrozd@gmail.com>
> > Date: Sat, 2 Feb 2019 13:26:16 -0600
> >
> > Subject: [PATCH 3/3] * lisp/net/eww.el (eww-download-callback): Fix download
> > URL path
> >
> > Previously this wasn't handling download URLs correctly, resulting in
> > all downloaded pages being named "!", "!(1)", etc.
> >
> > Take "https://emptysqua.re/blog/getaddrinfo-cpython-mac-and-bsd/" as
> > an example. `url-path-and-query' breaks this down to
> > "/blog/getaddrinfo-cpython-mac-and-bsd/", and this gets passed to
> > `file-name-nondirectory'. But that path looks like a directory because
> > of the trailing slash, so `eww-decode-url-file-name' would end up with
> > an empty string. Instead, remove the trailing slash so that a nonempty
> > file name is passed in.
>
> This log message lacks the ChangeLog-style list of functions that are
> being changes, with short descriptions of the changes in each one.
> (Same problem with the second patch.)
>
> Also, please leave 2 spaces between sentences.
>
> > - (path (car (url-path-and-query obj)))
> > + (path (string-remove-suffix "/" (car (url-path-and-query obj))))
>
> Please use directory-file-name here instead of string-remove-suffix.
>
> Btw, isn't it better to remove all the leading directories, leaving
> just the last component (a.k.a. the "basename")?
>
> > * lisp/net/eww.el (eww-download)
> > * doc/misc/eww.texi (Basics)
>
> This should tell what was changed in each function/node. See
> CONTRIBUTE, and the examples in the ChangeLog files in the tree.
>
> > +the current page. The file will be written to the directory specified
> ^^
> Two spaces between sentences, please.
>
> > +in @code{eww-download-directory} (Default: @file{~/Downloads/}).
>
> The "Default" part should not be capitalized (it's not a separate
> sentence).
>
> Thanks.
[-- Attachment #2: 0002-Use-link-under-point-or-current-URL-for-eww-download.patch --]
[-- Type: text/x-patch, Size: 2030 bytes --]
From e569d24a1f800419473e293dd13540c595c6b57e Mon Sep 17 00:00:00 2001
From: Nick Drozd <nicholasdrozd@gmail.com>
Date: Sat, 2 Feb 2019 12:35:02 -0600
Subject: [PATCH 2/3] Use link under point or current URL for eww-download
* lisp/net/eww.el (eww-download): Previously the behavior was the use
the link under point or error if there wasn't one.
* doc/misc/eww.texi (Basics): Update documentation.
---
doc/misc/eww.texi | 7 ++++---
lisp/net/eww.el | 6 ++++--
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi
index 088da6f5fe..d7dc32846e 100644
--- a/doc/misc/eww.texi
+++ b/doc/misc/eww.texi
@@ -125,9 +125,10 @@ Basics
@vindex eww-download-directory
@kindex d
@cindex Download
- A URL under the point can be downloaded with @kbd{d}
-(@code{eww-download}). The file will be written to the directory
-specified in @code{eww-download-directory} (Default: @file{~/Downloads/}).
+ A URL can be downloaded with @kbd{d} (@code{eww-download}). This
+will download the link under point if there is one, or else the URL of
+the current page. The file will be written to the directory specified
+in @code{eww-download-directory} (default: @file{~/Downloads/}).
@findex eww-back-url
@findex eww-forward-url
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 3b7d9d5c2f..0c8bffa579 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -1531,10 +1531,12 @@ eww-copy-page-url
(kill-new (plist-get eww-data :url)))
(defun eww-download ()
- "Download URL under point to `eww-download-directory'."
+ "Download URL to `eww-download-directory'.
+Use link under point if there is one, else the current page URL."
(interactive)
(access-file eww-download-directory "Download failed")
- (let ((url (get-text-property (point) 'shr-url)))
+ (let ((url (or (get-text-property (point) 'shr-url)
+ (eww-current-url))))
(if (not url)
(message "No URL under point")
(url-retrieve url 'eww-download-callback (list url)))))
--
2.17.1
[-- Attachment #3: 0001-doc-misc-eww.texi-Basics-Fix-eww-manual-keybinding.patch --]
[-- Type: text/x-patch, Size: 824 bytes --]
From fb95cdd55641a8ea9b48176604a1420ff2cbb7bf Mon Sep 17 00:00:00 2001
From: Nick Drozd <nicholasdrozd@gmail.com>
Date: Sat, 2 Feb 2019 12:31:44 -0600
Subject: [PATCH 1/3] * doc/misc/eww.texi (Basics): Fix eww manual keybinding
C is bound to url-cookie-list.
---
doc/misc/eww.texi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi
index b299ea1fb7..088da6f5fe 100644
--- a/doc/misc/eww.texi
+++ b/doc/misc/eww.texi
@@ -118,7 +118,7 @@ Basics
@findex eww-toggle-colors
@findex shr-use-colors
@kindex F
- The @kbd{C} command (@code{eww-toggle-colors}) toggles whether to use
+ The @kbd{M-C} command (@code{eww-toggle-colors}) toggles whether to use
HTML-specified colors or not. This sets the @code{shr-use-colors} variable.
@findex eww-download
--
2.17.1
[-- Attachment #4: 0003-lisp-net-eww.el-eww-download-callback-Fix-download-U.patch --]
[-- Type: text/x-patch, Size: 1024 bytes --]
From 64d5983a16feec057888ff85cd0b081798bec4f7 Mon Sep 17 00:00:00 2001
From: Nick Drozd <nicholasdrozd@gmail.com>
Date: Sat, 2 Feb 2019 12:50:03 -0600
Subject: [PATCH 3/3] * lisp/net/eww.el (eww-download-callback): Fix download
URL path
Previously this wasn't handling download URLs correctly, resulting in
all downloaded pages being named "!", "!(1)", etc.
---
lisp/net/eww.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 0c8bffa579..bec97b12d6 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -1544,7 +1544,7 @@ eww-download
(defun eww-download-callback (status url)
(unless (plist-get status :error)
(let* ((obj (url-generic-parse-url url))
- (path (car (url-path-and-query obj)))
+ (path (directory-file-name (car (url-path-and-query obj))))
(file (eww-make-unique-file-name
(eww-decode-url-file-name (file-name-nondirectory path))
eww-download-directory)))
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* bug#34291: Some EWW patches
2019-02-05 0:26 ` Nicholas Drozd
@ 2019-02-08 7:53 ` Eli Zaretskii
0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2019-02-08 7:53 UTC (permalink / raw)
To: Nicholas Drozd; +Cc: 34291-done
> From: Nicholas Drozd <nicholasdrozd@gmail.com>
> Date: Mon, 4 Feb 2019 18:26:49 -0600
> Cc: 34291@debbugs.gnu.org
>
> Feel free to fix any remaining formatting / style issues.
Done. Please note that user-visible changes in behavior (PATCH 1/3
below) should also be called out in NEWS.
Closing the bug report. Thanks for working on this.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-02-08 7:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-02 19:26 bug#34291: Some EWW patches Nicholas Drozd
2019-02-02 19:53 ` Eli Zaretskii
2019-02-05 0:26 ` Nicholas Drozd
2019-02-08 7:53 ` Eli Zaretskii
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.