Monday 25 April 2011

Installing and Configuring ANYTHING.EL for Emacs

anything.el is an application framework written by TamasPatrovics (current maintainer is rubikitch).
It provides a better way to choose between alternatives when typing a command, switching buffers, searching for help, files, etc.
After you select a candidate option from the list anything provides, you can choose between several actions.

DOWNLOAD ANYTHING
We are going to download anything from its source code repository.
$ cd ~/.emacs.d
$ git clone git://repo.or.cz/anything-config.git

CONFIGURE .emacs FILE

;; Anything.el
(add-to-list 'load-path "~/.emacs.d/anything-config/")
(add-to-list 'load-path "~/.emacs.d/anything-config/extensions/")
(require 'anything-startup)

That it is enough for using anything:
e.g: M-x anything

Also common functions like switch-to-buffer are automatically remapped to anything ones.


However you could also customize your anything buffers, selecting the anything sources you want:
(defun my-anything ()
(interactive)
(anything-other-buffer
'(anything-c-source-buffers
anything-c-source-file-name-history
anything-c-source-info-pages
anything-c-source-info-elisp
anything-c-source-man-pages
anything-c-source-locate
anything-c-source-emacs-commands)
" *my-anything*"))

(defun help-anything-at-point ()
"default to thing at point for anything"
(interactive)
;; (&optional sources input prompt resume preselect buffer keymap).
(anything '(anything-c-source-info-pages
anything-c-source-info-elisp
anything-c-source-man-pages)
(word-at-point)
nil
nil
nil
"*help-anything*"
nil))

(defun help-anything ()
"Show info, man and elisp pages."
(interactive)
;; (&optional sources input prompt resume preselect buffer keymap).
(anything-other-buffer '(anything-c-source-info-pages
anything-c-source-info-elisp
anything-c-source-man-pages)
"*help-anything*"))

(global-set-key (kbd "<f12>") 'help-anything)
(global-set-key (kbd "<f9>") 'help-anything-at-point)
(global-set-key (kbd "C-ñ") 'my-anything)

REFERENCE:

http://www.emacswiki.org/emacs/Anything

0 comentarios: