package.elには package-list-packagesというコマンドがあって
これでパッケージ一覧を見ることができるんですが、パッケージも
増えてきたということもあって、普通の検索では若干探すの面倒
になってきました。なんで helmインタフェースを使って絞り込む
ものを作ってみました。
コード
;;; helm-package.el --- ;; Copyright (C) 2012 by Syohei YOSHIDA ;; Author: Syohei YOSHIDA <syohex@gmail.com> ;; URL: ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see <http://www.gnu.org/licenses/>. ;;; Commentary: ;;; Code: (eval-when-compile (require 'cl)) (require 'helm) (require 'package) (defvar helm-c-package-source '((name . "helm package") (init . (lambda () (unless package--initialized (package-initialize t)))) (candidates . (lambda () (let ((copyed (copy-sequence package-archive-contents))) (loop with sorted = (sort copyed (lambda (a b) (string< (car a) (car b)))) for candidate in sorted for package = (symbol-name (car candidate)) for name = (if (> (length package) 30) (concat (substring package 0 27) "...") package) for desc = (truncate-string-to-width (aref (cdr candidate) 2) (- (frame-width) 32)) collect (cons (format "%-30s| %s" name desc) package))))) (action . (lambda (c) (package-install c))) (candidate-number-limit . 9999) (volatile))) (defun helm-package () (interactive) (let ((buf (get-buffer-create "*helm-package*"))) (helm :sources '(helm-c-package-source) :buffer buf))) (provide 'helm-package) ;;; helm-package.el ends here
設定
helmと package.elの設定を事前にしておく必要があります。
(require 'helm-config) (require 'package) (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t) (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/")) (package-initialize)