From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Mark Oteiza Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] checking eww download directory Date: Fri, 27 Jan 2017 14:48:16 -0500 Message-ID: <20170127194816.GA18966@holos.localdomain> References: <87wpdgmi84.fsf@udel.edu> <87inp08g2b.fsf@mouse> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1485546515 14409 195.159.176.226 (27 Jan 2017 19:48:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 27 Jan 2017 19:48:35 +0000 (UTC) User-Agent: Mutt/1.7.2+27 (e4ad1dc9bfbd) (2016-11-26) Cc: emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 27 20:48:31 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 1cXCVU-0002rw-Ku for ged-emacs-devel@m.gmane.org; Fri, 27 Jan 2017 20:48:24 +0100 Original-Received: from localhost ([::1]:47581 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXCVa-0005vw-4b for ged-emacs-devel@m.gmane.org; Fri, 27 Jan 2017 14:48:30 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58351) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXCVU-0005vq-9T for emacs-devel@gnu.org; Fri, 27 Jan 2017 14:48:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cXCVQ-0001Ja-6e for emacs-devel@gnu.org; Fri, 27 Jan 2017 14:48:24 -0500 Original-Received: from mail-qt0-x235.google.com ([2607:f8b0:400d:c0d::235]:36140) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cXCVQ-0001JT-1s for emacs-devel@gnu.org; Fri, 27 Jan 2017 14:48:20 -0500 Original-Received: by mail-qt0-x235.google.com with SMTP id k15so152924967qtg.3 for ; Fri, 27 Jan 2017 11:48:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=udel-edu.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Bni0P9bErb2FD2EcBnvQvXGEQfd3V6xffNo9ndPhi4A=; b=ZdjipxTe6nlt2vsVfL2sIZH/NqWPxYKLbKu9dqXuElqilTb/FqRT6ykl16eE66Ec1m rPpDWIFezHAHZJ0lmVLacNnp1Z/K+H4qW83y7X04wt3o7i9oDWDt0paBgQaVhc58hVdz /XmVQJ/gVmAHlxMcs+uTY3RpoKt1ywyfVtkHVjednGhiAiK1bS7871zEWF8YuJ0bgvmH aEqKrs4dkGSfN26A2qQcre9RkGzUUgoUYmXy52YW3e2JT7ZYt4DHF23tCwq1PA8k5d7I YVbjlRyzJpKKqDQKH7wsEnQe+DqE7J+fE+k4UiP0NiANTM+a+8/E8Abip7hiWU604WAf ZOVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Bni0P9bErb2FD2EcBnvQvXGEQfd3V6xffNo9ndPhi4A=; b=IlPLcFEwbQa1wOqoMjIbROlAa1ygO5M54Ds2awDS09aSbCYS8GRof4u5XFPrXn4Xe0 5QI0+OX5sBN8obgQmw3A2cPIeI1yvrEWJfVnYNHRZLZO0zDz4W5F1iUvQxeyEHGXdB02 hEmtY1P+VX83oJQotkxtC2p3CJVfaOLLl2ferGsLOUKHCWnZLsA2xro+ryV5smINskVb fRi1wxAkloF3Lyj1oq1ecUrfH3VDM10Y6VUmXJ+nAei2fHTc+gGm7xrb/Cfzjz34+Wd9 0Qjive7PIf3Npt/TgGo6SVuc+2ZWirlrdzAcKB2djG1ZgWrHRCFO1wlUeRcSQeAYnc0w kn3g== X-Gm-Message-State: AIkVDXK429HnGJ7Lv5djZqOLXxi29UlFbWMP31Ubcu6fOFvty1C32WoHqGkvaT14UMW/fCt9 X-Received: by 10.200.40.242 with SMTP id j47mr9482091qtj.24.1485546498638; Fri, 27 Jan 2017 11:48:18 -0800 (PST) Original-Received: from holos.localdomain (pool-173-67-40-97.bltmmd.fios.verizon.net. [173.67.40.97]) by smtp.gmail.com with ESMTPSA id p46sm4938274qta.33.2017.01.27.11.48.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Jan 2017 11:48:17 -0800 (PST) Original-Received: by holos.localdomain (Postfix, from userid 1000) id 09B7E66372; Fri, 27 Jan 2017 14:48:17 -0500 (EST) Content-Disposition: inline In-Reply-To: <87inp08g2b.fsf@mouse> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c0d::235 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:211655 Archived-At: On 27/01/17 at 08:21pm, Lars Ingebrigtsen wrote: > 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? 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