diff --git a/package-build/package-build.el b/package-build/package-build.el index 9b868f03df1..75b66b8d1b8 100644 --- a/package-build/package-build.el +++ b/package-build/package-build.el @@ -160,7 +160,7 @@ function for access to this function") (defun package-build--string-rtrim (str) "Remove trailing whitespace from `STR'." - (replace-regexp-in-string "[ \t\n]*$" "" str)) + (replace-regexp-in-string "[ \t\n\r]+$" "" str)) (defun package-build--valid-version (str &optional regexp) @@ -182,7 +182,7 @@ or nil if the version cannot be parsed." (match-string 3 s) " " (match-string 4 s)) s)))) (concat (format-time-string "%Y%m%d." time) - (format "%d" (or (string-to-number (format-time-string "%H%M" time)) 0))))) + (format "%d" (string-to-number (format-time-string "%H%M" time)))))) (defun package-build--find-parse-time (regex &optional bound) "Find REGEX in current buffer and format as a time-based version string, \ @@ -330,7 +330,7 @@ A number as third arg means request confirmation if NEWNAME already exists." (defun package-build--grab-wiki-file (filename) "Download FILENAME from emacswiki, returning its last-modified time." (let* ((download-url - (format "http://www.emacswiki.org/emacs/download/%s" filename)) + (format "https://www.emacswiki.org/emacs/download/%s" filename)) headers) (package-build--with-wiki-rate-limit (setq headers (package-build--url-copy-file download-url filename t))) @@ -705,17 +705,17 @@ Optionally PRETTY-PRINT the data." (package-version-join (cadr elt)))) (aref pkg-info 1)) ;; Append our extra information - ,@(apply #'append (mapcar (lambda (entry) - (let ((value (cdr entry))) - (when (or (symbolp value) (listp value)) - ;; We must quote lists and symbols, - ;; because Emacs 24.3 and earlier evaluate - ;; the package information, which would - ;; break for unquoted symbols or lists - (setq value (list 'quote value))) - (list (car entry) value))) - (when (> (length pkg-info) 4) - (aref pkg-info 4))))) + ,@(cl-mapcan (lambda (entry) + (let ((value (cdr entry))) + (when (or (symbolp value) (listp value)) + ;; We must quote lists and symbols, + ;; because Emacs 24.3 and earlier evaluate + ;; the package information, which would + ;; break for unquoted symbols or lists + (setq value (list 'quote value))) + (list (car entry) value))) + (when (> (length pkg-info) 4) + (aref pkg-info 4)))) (current-buffer)) (princ ";; Local Variables:\n;; no-byte-compile: t\n;; End:\n" (current-buffer)))) @@ -1503,22 +1503,20 @@ If FILE-NAME is not specified, the default archive-contents file is used." (type (elt info 3)) (props (when (> (length info) 4) (elt info 4)))) (list :ver ver - :deps (apply 'append - (mapcar (lambda (dep) - (list (package-build--sym-to-keyword (car dep)) - (cadr dep))) - deps)) + :deps (cl-mapcan (lambda (dep) + (list (package-build--sym-to-keyword (car dep)) + (cadr dep))) + deps) :desc desc :type type :props props))) (defun package-build--archive-alist-for-json () "Return the archive alist in a form suitable for JSON encoding." - (apply 'append - (mapcar (lambda (entry) - (list (package-build--sym-to-keyword (car entry)) - (package-build--pkg-info-for-json (cdr entry)))) - (package-build-archive-alist)))) + (cl-mapcan (lambda (entry) + (list (package-build--sym-to-keyword (car entry)) + (package-build--pkg-info-for-json (cdr entry)))) + (package-build-archive-alist))) (defun package-build-archive-alist-as-json (file-name) "Dump the build packages list to FILE-NAME as json."