emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: more on anything.el inclusion


From: Thierry Volpiatto
Subject: Re: more on anything.el inclusion
Date: Thu, 01 Jul 2010 09:50:30 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux)

Dan Nicolaescu <address@hidden> writes:

> Thierry Volpiatto <address@hidden> writes:
>
>> Dan Nicolaescu <address@hidden> writes:
>>
>>>> Actually installing anything is easy and work out of the box with only:
>>>>
>>>> (require 'anything-config)
>>>> (require 'anything-match-plugin) ; facultatif
>>>
>>> For packages included in emacs we try to avoid using require to
>>> activate the package.  [I don't know anything about this particular
>>> package, so...]
>>
>> A lot of autoload cookies are missing in anything-config, however, 
>>
>> (autoload 'anything-find-files "anything-config.el" "" t)
>>
>> is enough to enable anything.
>
> That's the same as using require.  The preferred way is to do it with
> a function call, or a mode.
>
>>>> Anything is now self documented both in mode-line and with C-h m or your
>>>> usual help command, but yes a manual would be nice.
>>>
>>> Can you please add some brief description of what it actually does?
>>>
>>> ;;;; anything.el --- open anything / QuickSilver-like candidate-selection 
>>> framework
>>>
>>> does not tell much...
>>
>> anything is a framework that allow to setup an interactive and
>> incremental display to select candidate and provide diverses actions on
>> it or many of them.
>>
>> Basically, you can see that as a big completing-read, but incremental
>> with nice display, and providing differents action on candidate selected
>> in collection.
>
> And how do you use it?

On the user side, if you use anything-config.el, there is already build
in sources ready for use, so you can use provided functions like any
other emacs one (e.g M-x anything-xfonts).

For the developper who want to write his own anything source the best
actually is to look at the sources wrote in anything-config.el.

Basically, you run anything like that:

(anything 'source)

source is an alist that you can write like that:
(Where name, candidates, action are anything attributes.
You have a lot of attributes, for full info, use:
M-x anything-describe-anything-attribute)

(defvar mysource
  '((name . "A simple example that open all file with extension .el")
    (candidates . (lambda ()
                   (loop for i in (directory-files default-directory)
                      when (string= (file-name-extension i) "el")
                      collect i)))
    (action . (("Open file" . find-file)
               ("Do something else" . (lambda (candidate)
                                        ;; Write here something more
                                        ;; useful than nil
                                        nil))))))

;; [EVAL] (anything 'mysource)

After evaluating line above to see if your new source work as expected,
you can now define your new anything command:

(defun my-new-anything-command ()
  (interactive)
  (anything 'mysource))


> BTW, this might be obvious to you, but for people that have not used
> the package is not.  Adding a few lines of describing what it does and
> how to use it is very helpful.  [Please note that this has no relation
> to getting this package included in emacs, this is just what a
> potential user would like].
>

-- 
Thierry Volpiatto
Gpg key: http://pgp.mit.edu/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]