Search, download and vote for AUR packages from Emacs

Alex Kost 971b16ba06 Update version (0.5) and package commentary 11 gadi atpakaļ
.gitignore 2b57fcd4c6 Add .gitignore 11 gadi atpakaļ
README.md ea731df346 Update README 11 gadi atpakaļ
aurel.el 971b16ba06 Update version (0.5) and package commentary 11 gadi atpakaļ

README.md

About

This is an Emacs package for searching, getting information, voting, subscribing for comments and downloading AUR (Arch User Repository) packages. Its functionality is very similar to the one provided by cower and aurvote, but instead of command-line interface you use Emacs interface.

The package uses AurJson RPC interface to get information about AUR packages.

You may look at the screenshots below or at the gif demonstration made by Ivaylo Kuzev to get an idea how aurel looks like.

Installation

MELPA

The package can be installed from MELPA (with M-x package-install or M-x list-packages).

Manual

Add the following lines to your .emacs.

  • Add a directory with this package to the load-path:
  (add-to-list 'load-path "/path/to/aurel-dir")
  • Add autoloads for the interactive functions:
  (autoload 'aurel-package-info "aurel" nil t)
  (autoload 'aurel-package-search "aurel" nil t)
  (autoload 'aurel-maintainer-search "aurel" nil t)
  • Set a directory where the packages will be downloaded:
  (setq aurel-download-directory "~/abs")

AUR

If you prefer to install everything with pacman, there is aurel package.

Usage

  • Search for packages by name or description:

M-x aurel-package-search

Searching for multiple words (separated with spaces) is supported. If you want to search for a string containing spaces, quote it with double quotes ("..."). Examples of searching:

  • ttf
  • strategy game
  • "python library" xml
  • light weight "programming language"

  • Search for packages by maintainer:

M-x aurel-maintainer-search

  • Get an information about a package by exact name or ID:

M-x aurel-package-info

There are 2 kinds of buffers (major modes) for representing an information about packages:

  • aurel-list-mode

It is used for listing multiple packages. Press RET on a package line to get more information about the package.

  • aurel-info-mode

It is used for displaying an information about a single package.

In both modes you can press d to download the package, but don't forget to set aurel-download-directory before.

Using prefix (C-u) before interactive commands creates a new info or list buffer instead of using the existing ones. That allows, for example, to keep results of multiple searches or to look at information about several packages at the same time.

Maintainer name in an info buffer is a button. If you press RET (keep in mind C-u) on it, a new search for packages by this maintainer will happen.

Each aurel buffer has its own history similar to the history of the Emacs help or Info modes. You can move backward/forward by the history with l/r and refresh information with g (confirmation can be disabled with aurel-revert-no-confirm variable). If you want to change the number of stored elements (or to disable the history), use aurel-info-history-size and aurel-list-history-size variables.

AUR account actions

If you have an AUR account, you can use aurel to vote for packages, to subscribe for new comments and to show additional information (whether a package is voted/subscribed by you or not).

The following keys are available in a buffer with package info by default:

  • v to vote (C-u v to unvote)
  • s to subscribe (C-u s to unsubscribe)

To enable receiving additional AUR user specific information (Voted and Subscribed lines should appear in the info buffer), use the following:

(setq aurel-aur-user-package-info-check t)

The first time aurel needs the above information, you will be prompted for your AUR account (you may set aurel-aur-user-name variable for convenience) and a password. The password is not saved anywhere, but a login cookie is saved (emacs saves cookies in ~/.emacs.d/url/cookies by default), so you will not be prompted for credentials next time.

Configuration

User options can be explored with M-x customize-group RET aurel.

If you don't like the names of info and list modes and buffers, you can change those, for example:

(setq aurel-list-mode-name "aurel-list"
      aurel-info-mode-name "aurel-info"
      aurel-list-buffer-name "*aur-list*"
      aurel-info-buffer-name "*aur-info*")

By default after receiving information about the packages from AUR server, pacman is called to get additional information about installed packages. If you want to disable that (to make the process a bit faster or if you don't have pacman installed), use the following:

(setq aurel-installed-packages-check nil)

Package list

Columns in a buffer with a list of packages can be configured with aurel-list-column-format.

For example, if you don't want to have a column with version but want to add sortable columns with maintainer and votes, try the following:

(setq aurel-list-column-format
      '((name 20 t)
        (maintainer 13 t)
        (votes 5
         (lambda (a b)
           (> (string-to-number (aref (cadr a) 2))
              (string-to-number (aref (cadr b) 2)))))
        (installed-version 8 t)
        (description 30 nil)))

Descriptions of a package parameters (displayed in aurel-info-mode buffer) are stored in aurel-param-description-alist variable. Columns in aurel-list-mode buffer have the same titles as these descriptions, unless they are not set in aurel-list-column-name-alist. For example, the following shortened titles suit better the compact column format shown in the above example:

(setq aurel-list-column-name-alist
      '((votes . "V.")
        (installed-version . "Inst.")))

Package info

Anything you see in a buffer with a package info is configurable. Various aspects of displaying information about a package can be configured with aurel-info-parameters, aurel-info-installed-parameters, aurel-info-aur-user-parameters, aurel-info-insert-params-alist, aurel-info-format, aurel-info-fill-column, aurel-info-installed-package-string, aurel-info-aur-user-string, aurel-info-ignore-empty-vals, aurel-info-show-maintainer-account variables and with aurel-info-... faces. For example:

(setq aurel-info-format "%-16s"
      aurel-info-ignore-empty-vals t
      aurel-info-installed-package-string "\n  ————————————————————————————————\n\n"
      aurel-info-aur-user-string aurel-info-installed-package-string
      aurel-empty-string "")

A more complex example: suppose you want to display a red star (*) after the number of votes if a package is voted by you (see the second screenshot). For that we define a function that will insert needed information and replace the default value in aurel-info-insert-params-alist by this function:

(defun aurel-info-insert-cool-votes (val)
  (insert (propertize (if (numberp val) (number-to-string val) val)
                      'face 'aurel-info-votes))
  (when (aurel-get-param-val 'voted aurel-info)
    (insert (propertize "*" 'face '(:foreground "red" :weight bold)))))

(eval-after-load 'aurel
  '(setcdr (assoc 'votes aurel-info-insert-params-alist)
           'aurel-info-insert-cool-votes))

Downloading a package

You can change the default behavior of a "downloading action" with aurel-info-download-function, aurel-list-download-function and aurel-list-multi-download-function (you can mark several packages for downloading with m/M and unmark with u/U/DEL) variables. Currently the following functions are available:

  • aurel-download
  • aurel-download-unpack (default in a list buffer)
  • aurel-download-unpack-dired (default in an info buffer)
  • aurel-download-unpack-pkgbuild
  • aurel-download-unpack-eshell

Screenshots

Aurel with default settings:

Default

Aurel with all modifications, described above:

Changed

In both screenshots alect-dark theme from alect-themes is used.