Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
;; a packagelet for figuring out where melpa is. will move point to commit in magit-log buffers.
(defun melpautil-where-is-melpa (package &optional force-refresh)
(interactive (list (intern (let-alist (magithub-repo) .name))
(let ((commit (melpautil-commit-for-package package force-refresh)))
(unless commit
(error "Commit not found"))
(setq commit (magit-rev-parse "--short" commit))
(when (derived-mode-p 'magit-log-mode)
(goto-char 0)
(while (not (string= commit (magit-section-value (magit-current-section))))
(message "MELPA is at %s" (magit-get-shortname commit))))
(defconst melpautil-archive-url "")
(defvar melpautil-archive nil)
(defun melpautil--get-archive (refresh-now)
(let ((now (current-time))
(archive-url ))
(cdr (if (or (null melpautil-archive)
;; auto refresh every five minutes
(< 300 (time-to-seconds (time-subtract now (car melpautil-archive)))))
(setq melpautil-archive
(cons now (with-current-buffer (url-retrieve-synchronously melpautil-archive-url)
(search-forward "\n\n")
(defun melpautil-commit-for-package (package &optional refresh-now)
(let-alist (alist-get package (melpautil--get-archive refresh-now))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment