From e9a8b6e46577d11e2e4570b99d1ff7b95012217c Mon Sep 17 00:00:00 2001 From: Vonfry Date: Sun, 31 Dec 2023 11:04:04 +0800 Subject: [PATCH 1/2] update-melpa: use cl-lib instead of cl --- .../editors/emacs/elisp-packages/update-melpa.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/editors/emacs/elisp-packages/update-melpa.el b/pkgs/applications/editors/emacs/elisp-packages/update-melpa.el index 149413580856..72d458390045 100644 --- a/pkgs/applications/editors/emacs/elisp-packages/update-melpa.el +++ b/pkgs/applications/editors/emacs/elisp-packages/update-melpa.el @@ -6,7 +6,7 @@ (require 'semaphore-promise) (require 'url) (require 'json) -(require 'cl) +(require 'cl-lib) (require 'subr-x) (require 'seq) @@ -77,7 +77,7 @@ return Promise to resolve in that process." (defun parse-previous-archive (filename) (let ((idx (make-hash-table :test 'equal))) - (loop for desc in + (cl-loop for desc in (let ((json-object-type 'hash-table) (json-array-type 'list) (json-key-type 'symbol)) @@ -166,7 +166,7 @@ return Promise to resolve in that process." (defun recipe-info (recipe-index ename) (if-let (desc (gethash ename recipe-index)) - (destructuring-bind (rcp-commit . rcp-sha256) desc + (cl-destructuring-bind (rcp-commit . rcp-sha256) desc `((commit . ,rcp-commit) (sha256 . ,rcp-sha256))) `((error . "No recipe info")))) @@ -204,7 +204,7 @@ return Promise to resolve in that process." (seq-let [recipe-index unstable-sha stable-sha] res (append `((ename . ,ename)) (if-let (desc (gethash ename recipe-index)) - (destructuring-bind (rcp-commit . rcp-sha256) desc + (cl-destructuring-bind (rcp-commit . rcp-sha256) desc (append `((commit . ,rcp-commit) (sha256 . ,rcp-sha256)) (when (not unstable-aprops) From 2e2097cb96680da1351b36c4eff76de274c32242 Mon Sep 17 00:00:00 2001 From: Vonfry Date: Sun, 31 Dec 2023 11:05:55 +0800 Subject: [PATCH 2/2] update-melpa: use url lib to parse HTTP instead of custom code This improves compatiblity of parsing http header. --- .../editors/emacs/elisp-packages/update-melpa.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/editors/emacs/elisp-packages/update-melpa.el b/pkgs/applications/editors/emacs/elisp-packages/update-melpa.el index 72d458390045..9cb6456cd6f9 100644 --- a/pkgs/applications/editors/emacs/elisp-packages/update-melpa.el +++ b/pkgs/applications/editors/emacs/elisp-packages/update-melpa.el @@ -257,10 +257,9 @@ return Promise to resolve in that process." url (lambda (status) (funcall resolve (condition-case err (progn - (goto-char (point-min)) - (search-forward "\n\n") + (url-http-parse-headers) + (goto-char url-http-end-of-headers) (message (buffer-substring (point-min) (point))) - (delete-region (point-min) (point)) (funcall parser)) (funcall reject err))))))))