emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] checking eww download directory


From: Mark Oteiza
Subject: Re: [PATCH] checking eww download directory
Date: Fri, 27 Jan 2017 14:48:16 -0500
User-agent: Mutt/1.7.2+27 (e4ad1dc9bfbd) (2016-11-26)

On 27/01/17 at 08:21pm, Lars Ingebrigtsen wrote:
> Mark Oteiza <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]