From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] checking eww download directory Date: Fri, 27 Jan 2017 20:21:16 +0100 Message-ID: <87inp08g2b.fsf@mouse> References: <87wpdgmi84.fsf@udel.edu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1485544920 17471 195.159.176.226 (27 Jan 2017 19:22:00 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 27 Jan 2017 19:22:00 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Mark Oteiza Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 27 20:21:55 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cXC5g-0003M8-KG for ged-emacs-devel@m.gmane.org; Fri, 27 Jan 2017 20:21:44 +0100 Original-Received: from localhost ([::1]:47495 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXC5l-0000dU-V3 for ged-emacs-devel@m.gmane.org; Fri, 27 Jan 2017 14:21:49 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXC5a-0000aw-Ga for emacs-devel@gnu.org; Fri, 27 Jan 2017 14:21:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cXC5X-0002IZ-AJ for emacs-devel@gnu.org; Fri, 27 Jan 2017 14:21:38 -0500 Original-Received: from hermes.netfonds.no ([80.91.224.195]:36567) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cXC5X-0002Ho-4A for emacs-devel@gnu.org; Fri, 27 Jan 2017 14:21:35 -0500 Original-Received: from 37.253.224.99.tmi.telenormobil.no ([37.253.224.99] helo=mouse) by hermes.netfonds.no with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cXC5R-0001lf-U6; Fri, 27 Jan 2017 20:21:32 +0100 In-Reply-To: <87wpdgmi84.fsf@udel.edu> (Mark Oteiza's message of "Fri, 27 Jan 2017 14:10:51 -0500") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 80.91.224.195 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:211651 Archived-At: Mark Oteiza 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? > + (access-file eww-download-directory "Download failed") Seem OK, except that the error message should say what the error is instead of this. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no