Is there some kind of "package-search" function available for Emacs?
Asked Answered
M

5

7

In Emacs, the M-x keybinding lets you search and execute available commands. I'm looking for a similar function/functionality that lets you search and install available packages from the Emacs repositories.

The best I can do at present is M-x package-list-packages followed by C-s, but this has a few shortcomings:

  1. It requires that you navigate to the list of available packages, whereas I'd like something that works from most places within Emacs.
  2. It only lets you cycle through the package list, whereas I'd like something that displays a narrowing list of results.
  3. It doesn't support fuzzy matching (like Helm).

Does the functionality I'm looking for exist? Or is there a package that provides this functionality for Emacs? And if so, where can I find it?

Mobilize answered 18/12, 2016 at 0:54 Comment(1)
Just use M-x package-install with helm-mode enabledCamala
M
9

It sounds like M-x package-install should do what you want. If you have helm installed, you will have a helm-like interface to search and install packages. Even without helm, it can be invoked from any buffer, it supports narrowing, and if you do have helm installed, it supports fuzzy matching.

I still tend to use M-x package-list-packages unless I know exactly what I am looking for, because unlike package-install it allows you to see details and descriptions of the packages. I have C-s bound to helm-occur, so I can search through this buffer with a helm-like interface as well. Also, in the *Packages* buffer, you can use f (package-menu-filter) which allows you to narrow down the package list based on a list of comma-separated keywords. However, I can understanding you wanting to avoid the aspects of package-list-packages outlined in your post.

Macmahon answered 18/12, 2016 at 2:48 Comment(0)
D
1

Install the ido-ubiquitous package and enable (ido-ubiquitous-mode 1), and (setq ido-enable-flex-matching t) to enable flex matching (not sure if that's necessary, but I have it set). It basically makes all completion use ido, including package-install. You can narrow with C-SPC, or use <tab> to pop up a completions buffer.

I usually use list-packages. I use flex-isearch to automatically start flex matching after isearch either wraps around or has no matches.

Dampproof answered 19/12, 2016 at 22:31 Comment(1)
Thanks jpkotta—I've gone with elethan's solution as I already have Helm installed and configured.Mobilize
U
1

According to a screenshot found here there is such a thing as M-x list-matching-lines that does what you need (string search through packages.) I've tried it. The sequence of what was typed is shown in the screenshot. I didn't install anything special to get this functionality.

Ursuline answered 28/5, 2020 at 2:20 Comment(1)
Better known as M-x occur, which is bound to M-s o by default. list-matching-lines is an alias.Desperate
P
0
  1. M-x package-install
  2. ENTER
  3. Start typing the package you want to install (Eg: xah-find) and use the autocomplete option to select the package of your choice.

Credits: @elethan

Putput answered 20/4, 2019 at 13:16 Comment(0)
E
0

This performs search on package names and summaries:

(defun apropos-package--filter (string)
  (let (packages)
    (dolist (package-assoc package-archive-contents)
      (let ((package (cadr package-assoc)))
        (when (or (string-match-p (regexp-quote string) (package-desc-summary package))
                  (string-match-p (regexp-quote string) (prin1-to-string (package-desc-name package))))
          (push package packages))))
    packages))

(defun apropos-package (string)
  (interactive "sSearch for package: ")
  ;; Initialize the package system if necessary.
  (unless package--initialized
    (package-initialize t))
  (let ((packages (apropos-package--filter string)))
    (if (null packages)
    (message "No packages")
      (package-show-package-list (mapcar 'package-desc-name packages)))))

Invoke the command with M-x apropos-package

Etamine answered 29/4, 2021 at 14:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.