;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/elpa.el (require 'cl-lib) (require 'close) (require 'package) (require 'scroll) (defun get-all () (interactive) (cl-loop while (< (point) (point-max)) do (let ((name (symbol-at-point))) (condition-case nil (package-menu-describe-package) (error nil)) (with-current-buffer "*Help*" (write-file (format "~/elpa/%s" name)) (bury-buffer)) (forward-button 1) (sleep-for 1)))) (setq package-archives `( ("gnu" . "https://elpa.gnu.org/packages/") ("nongnu" . "https://elpa.nongnu.org/nongnu/") )) (let ((pack-status '#1=("" "available" "built-in" "deleted" "dependency" "incompat" "installed" "new" . #1#) )) (defun pack-filter (&optional status) (interactive) (or status (setq status (pop pack-status))) (package-menu-filter-by-status status) (message (if (string-empty-p status) "all" status) ))) (declare-function pack-filter nil) (defun elpa (&optional get) (interactive "P") (if get (list-packages) (let ((buf (get-buffer "*Packages*"))) ; hardcoded in package.el 28 times (if (and buf (bufferp buf)) (pop-to-buffer buf) (list-packages) )))) (let ((kmap package-menu-mode-map)) (set-close-key kmap) (set-pane-scroll-keys kmap) (set-vertical-keys kmap) (keymap-set kmap "TAB" #'pack-filter) ) (provide 'elpa)