all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: lux <lx@shellcodes.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 62435@debbugs.gnu.org
Subject: bug#62435: [PATCH] 29.0 Fix eww--download-directory on MS-Windows
Date: Sat, 25 Mar 2023 22:17:01 +0800	[thread overview]
Message-ID: <tencent_7596E01BCEFB99C61A909AAEBB7A79B5F007@qq.com> (raw)
In-Reply-To: <83355tc4fh.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1182 bytes --]

On Sat, 2023-03-25 at 17:05 +0300, Eli Zaretskii wrote:
> > From: lux <lx@shellcodes.org>
> > Cc: 62435@debbugs.gnu.org
> > Date: Sat, 25 Mar 2023 21:42:44 +0800
> > 
> > 
> > +(defcustom eww-default-download-directory "~/Downloads/"
> > +  "The default directory where downloaded files will be saved."
> > +  :version "29.0"
>               ^^^^^^
> This should be "30.1".
> 
> >  (defun eww--download-directory ()
> >    "Return the name of the download directory.
> >  If ~/Downloads/ exists, that will be used, and if not, the
> >  DOWNLOAD XDG user directory will be returned.  If that's
> >  undefined, ~/Downloads/ is returned anyway."
> > -  (or (and (file-exists-p "~/Downloads/")
> > -           "~/Downloads/")
> > +  (or (and (file-exists-p eww-default-download-directory)
> > +           eww-default-download-directory)
> >        (when-let ((dir (xdg-user-dir "DOWNLOAD")))
> >          (file-name-as-directory dir))
> > -      "~/Downloads/"))
> > +      eww-default-download-directory))
> 
> Please update the doc string as well.
> 
> 
Done, please review, thank you.

[-- Attachment #2: 0001-Add-eww-default-download-directory.patch --]
[-- Type: text/x-patch, Size: 1654 bytes --]

From 3eb370725605b4e66542195b5464c23a891f93c6 Mon Sep 17 00:00:00 2001
From: Xi Lu <lx@shellcodes.org>
Date: Sat, 25 Mar 2023 21:38:48 +0800
Subject: [PATCH] Add `eww-default-download-directory'.

* lisp/net/eww.el: Add variable `eww-default-download-directory'.
---
 lisp/net/eww.el | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 859a9b44bcb..9552138bb6e 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -64,16 +64,21 @@ eww-use-browse-url
   :version "28.1"
   :type 'regexp)
 
+(defcustom eww-default-download-directory "~/Downloads/"
+  "The default directory where downloaded files will be saved."
+  :version "30.1"
+  :group 'eww
+  :type 'string)
+
 (defun eww--download-directory ()
-  "Return the name of the download directory.
-If ~/Downloads/ exists, that will be used, and if not, the
-DOWNLOAD XDG user directory will be returned.  If that's
-undefined, ~/Downloads/ is returned anyway."
-  (or (and (file-exists-p "~/Downloads/")
-           "~/Downloads/")
+  "Return the name of the download directory based on the value of
+`eww-default-download-directory'. If the specified directory exists, it
+ will be used. Otherwise, the DOWNLOAD XDG user directory will be returned."
+  (or (and (file-exists-p eww-default-download-directory)
+           eww-default-download-directory)
       (when-let ((dir (xdg-user-dir "DOWNLOAD")))
         (file-name-as-directory dir))
-      "~/Downloads/"))
+      eww-default-download-directory))
 
 (defcustom eww-download-directory 'eww--download-directory
   "Directory where files will downloaded.
-- 
2.39.2


  reply	other threads:[~2023-03-25 14:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-25 11:56 bug#62435: [PATCH] 29.0 Fix eww--download-directory on MS-Windows lux
2023-03-25 13:25 ` Eli Zaretskii
2023-03-25 13:42   ` lux
2023-03-25 14:05     ` Eli Zaretskii
2023-03-25 14:17       ` lux [this message]
2023-03-26 11:59         ` Eli Zaretskii

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=tencent_7596E01BCEFB99C61A909AAEBB7A79B5F007@qq.com \
    --to=lx@shellcodes.org \
    --cc=62435@debbugs.gnu.org \
    --cc=eliz@gnu.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.