From 43595c602ee7d7949a547a49e5e4b78a8b23cc39 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 14 Feb 2013 06:25:46 +0900 Subject: [PATCH] use curl instead of url-copy-file for downloading --- emacs.el | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/emacs.el b/emacs.el index f745bad..d5813fd 100644 --- a/emacs.el +++ b/emacs.el @@ -45,27 +45,28 @@ otherwise the path where the library installed." (defun download-file (url path &optional ok-if-already-exists) "Download file from URL and output to PATH." - (or (ignore-errors + (or + (let ((curl (executable-find "curl"))) + (when curl + (if (and (not ok-if-already-exists) + (file-exists-p path)) + nil + (and (eq 0 + (call-process curl + nil + nil + nil + "--output" + path + url + )) + path)))) + (ignore-errors (require 'url) (url-copy-file url path ok-if-already-exists) - path) - (let ((curl (executable-find "curl"))) - (when curl - (if (and (not ok-if-already-exists) - (file-exists-p path)) - nil - (and (eq 0 - (call-process curl - nil - nil - nil - "--output" - path - url - )) - path)))))) + path))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; autoload