When one wants to choose between two Emacs packages that have similar features, it can be useful to evaluate their respective installed size before installing.

How to evaluate the installed size of a package that resides in ELPA or MELPA? Would there be a way to do so from the list-packages interface?


1 Answer 1


Visit GNU ELPA's website, you can see the package's size, e.g., https://elpa.gnu.org/packages/ace-window.html says

ace-window-0.9.0.el, 2015-Jun-05, 18.7 KiB

Visit MELPA's website, you can get package's download URL, e.g., https://melpa.org/#/dash (notes that the website is a SPA, aka, Single Page Application, if you visit it for the first time, it needs download several MB json files), then you can get the size via the Content-Length header, e.g.,

~ $ curl -I https://melpa.org/packages/dash-20200803.1520.tar
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 03 Sep 2020 12:27:39 GMT
Content-Type: application/octet-stream
Content-Length: 235520
Last-Modified: Thu, 03 Sep 2020 09:41:27 GMT
Connection: keep-alive
ETag: "5f50ba47-39800"
Strict-Transport-Security: max-age=15768000
Accept-Ranges: bytes

Would there be a way to do so from the list-packages interface?

You can also use the Content-Length header. Be aware that it does not work for installed packages.

(defun your-package-menu-show-package-size ()
  (let* ((pkg-desc (tabulated-list-get-id))
         (url (concat (package-archive-base pkg-desc)
                      (package-desc-full-name pkg-desc)
                      (package-desc-suffix pkg-desc))))
    (with-current-buffer (let ((url-request-method "HEAD"))
                           (url-retrieve-synchronously url))
      (goto-char (point-min))
      (let ((case-fold-search t))
        (unless (re-search-forward (rx bol "Content-Length: " (group (1+ num)) eol))
          (error "No Content-Length header")))
      (message "%s bytes" (match-string 1))
      (kill-buffer (current-buffer)))))

Most Emacs packages are small, just several hundreds or thousands line of code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.