From: Mark Oteiza <mvoteiza@udel.edu>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] checking eww download directory
Date: Fri, 27 Jan 2017 14:48:16 -0500 [thread overview]
Message-ID: <20170127194816.GA18966@holos.localdomain> (raw)
In-Reply-To: <87inp08g2b.fsf@mouse>
On 27/01/17 at 08:21pm, Lars Ingebrigtsen wrote:
> Mark Oteiza <mvoteiza@udel.edu> writes:
>
> > - it would be nice if eww looked a little harder for an existing
> > downloads directory. Perhaps what's below is too much, comments
> > welcome
>
> [...]
>
> > -(defcustom eww-download-directory "~/Downloads/"
> > +(defcustom eww-download-directory
> > + (cond
> > + ((memq system-type '(ms-dos windows-nt cygwin))
> > + (expand-file-name "Downloads" (getenv "USERPROFILE")))
> > + ((cl-some
> > + (lambda (str)
> > + (let ((f (expand-file-name str "~")))
> > + (and (file-directory-p f)
> > + (string-match-p "downloads?" (downcase f))
> > + (abbreviate-file-name f))))
> > + (directory-files "~")))
> > + (t "~/Downloads/"))
>
> Yikes. There must be a gazillion places directories are defined under
> the home director. Do they all do this dance? If they do, perhaps it
> should be made into a library function?
I just went off of knowing it's called Downloads in windows, and trying
to consider plural/nonplural and case insensitivity on Linux. Mine, for
instance is just lower cased. So... the cl-some is probably overkill.
This is something I've thought about and I know I've seen johnw kick the
idea around somewhere, but it would take some
work to generalize it. Just one example of what such a library might
read is user-dirs.dirs for XDG thingies:
https://www.freedesktop.org/wiki/Software/xdg-user-dirs/
It's a shell-looking file with lines like
XDG_DOWNLOAD_DIR="$HOME/Downloads"
> > + (access-file eww-download-directory "Download failed")
>
> Seem OK, except that the error message should say what the error is
> instead of this.
It does, access-file appends the error:
Download failed: No such file or directory, ~/NOWOAIWJD
next prev parent reply other threads:[~2017-01-27 19:48 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-27 19:10 [PATCH] checking eww download directory Mark Oteiza
2017-01-27 19:21 ` Lars Ingebrigtsen
2017-01-27 19:48 ` Mark Oteiza [this message]
2017-01-27 20:10 ` Eli Zaretskii
2017-01-28 8:01 ` Yuri Khan
2017-01-28 8:54 ` Eli Zaretskii
2017-01-28 14:14 ` Lars Ingebrigtsen
2017-01-28 21:04 ` Mark Oteiza
2017-01-27 19:27 ` Lars Ingebrigtsen
2017-01-27 19:38 ` Clément Pit-Claudel
2017-01-27 20:17 ` Mark Oteiza
2017-01-27 22:21 ` Clément Pit-Claudel
2017-01-28 7:53 ` Eli Zaretskii
2017-01-29 1:01 ` Library for XDG things (was Re: [PATCH] checking eww download directory) Mark Oteiza
2017-01-30 14:40 ` Ted Zlatanov
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=20170127194816.GA18966@holos.localdomain \
--to=mvoteiza@udel.edu \
--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.