Advertisement
Guest User

Untitled

a guest
Apr 17th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 1.18 KB | None | 0 0
  1. (defun list-packages (&optional no-fetch)
  2.   "Display a list of packages.
  3. This first fetches the updated list of packages before
  4. displaying, unless a prefix argument NO-FETCH is specified.
  5. The list is displayed in a buffer named `*Packages*'."
  6.   (interactive "P")
  7.   (require 'finder-inf nil t)
  8.   ;; Initialize the package system if necessary.
  9.   (unless package--initialized
  10.     (package-initialize t))
  11.   ;; Integrate the package-menu with updating the archives.
  12.   (add-hook 'package--post-download-archives-hook
  13.             #'package-menu--post-refresh)
  14.   (add-hook 'package--post-download-archives-hook
  15.             #'package-menu--mark-or-notify-upgrades 'append)
  16.  
  17.   ;; Generate the Package Menu.
  18.   (let ((buf (get-buffer-create "*Packages*")))
  19.     (with-current-buffer buf
  20.       (package-menu-mode)
  21.  
  22.       ;; Fetch the remote list of packages.
  23.       (unless no-fetch (package-menu-refresh))
  24.  
  25.       ;; If we're not async, this would be redundant.
  26.       (when package-menu-async
  27.         (package-menu--generate nil t)))
  28.     ;; The package menu buffer has keybindings.  If the user types
  29.     ;; `M-x list-packages', that suggests it should become current.
  30.     (switch-to-buffer buf)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement