Use curl over url-retrieve when possible
I have no idea why, but url-retrieve-synchronously seems to be a bit flaky in some situations while curl does not. While we're att it, switch from dash.el to cl-lib. We're going to gradually stop needing dash.el to load config.el.
This commit is contained in:
parent
7af198eb87
commit
9ed12652b8
12
config.org
12
config.org
|
@ -10823,10 +10823,16 @@ Now we just need to actually implement that metadata extraction function.
|
|||
(cons
|
||||
url
|
||||
(let* ((head-data
|
||||
(-filter #'listp
|
||||
(cl-remove-if-not
|
||||
#'listp
|
||||
(cdaddr
|
||||
(with-current-buffer (progn (message "Fetching metadata from %s" url)
|
||||
(url-retrieve-synchronously url t t 5))
|
||||
(with-current-buffer
|
||||
(progn (message "Fetching metadata from %s" url)
|
||||
(if (executable-find "curl")
|
||||
(with-current-buffer (generate-new-buffer " *curl*")
|
||||
(call-process "curl" nil t nil "--max-time" "5" "-sSL" url)
|
||||
(current-buffer))
|
||||
(url-retrieve-synchronously url t t 5)))
|
||||
(goto-char (point-min))
|
||||
(delete-region (point-min) (- (search-forward "<head") 6))
|
||||
(delete-region (search-forward "</head>") (point-max))
|
||||
|
|
Loading…
Reference in New Issue