[EMAIL PROTECTED] writes: Hi Bill,
>>> (defmacro anything-add-to-actions (var action) >>> `(setq ,var (cons (car ,var) >>> (append >>> (cdr ,var) >>> (list ',action))))) >> >> Yep, that looks nice. I made some little changes, so that multiple >> evaluations don't add an action several times and added >> documentation. > > Thanks for adding it to anything-config.el - that's one less thing I > need to have in my .emacs file! ;-) Yesterday I enhanced it so that it can add an action to both a source or a type actions variable. See its docstring for examples. > An alternative would be to provide (in anything-config.el) a > "standard" transformer function for a "type" and some example > transforms that others can model their transforms after. For example, > for the file transforms: > > (defvar anything-transform-actions-file nil "Transforms for files.") > > (defun anything-transform-file-actions (actions candidate) > "Append useful actions to the list of actions." > (when (and (listp actions) > anything-transform-actions-file) > (loop for func in anything-transform-actions-file > do (setq actions (or (funcall func actions candidate) actions)) > finally (return actions)))) > > (setq anything-transform-actions-file > (append anything-transform-actions-file > '((lambda (actions candidate) > (if (or (string= (file-name-extension candidate) "el") > (string= (file-name-extension candidate) "elc")) > (append actions '(("Load Emacs Lisp File" . > load-file)))))))) > > (setq anything-transform-actions-file > (append anything-transform-actions-file > '((lambda (actions candidate) > (if (string= "darwin" (symbol-name system-type)) > (append actions > '(("Open File with default Tool" . > (lambda (filename) > (call-process "/usr/bin/open" nil 0 nil > filename)))))))))) > > Then, it's just a matter of appending additonal transformers to the > list. > > What do you think? I've though about it already, and it's clear to me that some mechanism like that has to be implemented. I'll give it a try today. Bye, Tassilo -- Little Miss Muffet sat on her tuffet, until Chuck Norris roundhouse kicked her into a glacier. _______________________________________________ gnu-emacs-sources mailing list gnu-emacs-sources@gnu.org http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources