all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* anything.el and emacs lisp
@ 2007-07-12 17:14 weber
  2007-07-12 18:46 ` Vagn Johansen
  0 siblings, 1 reply; 3+ messages in thread
From: weber @ 2007-07-12 17:14 UTC (permalink / raw)
  To: help-gnu-emacs

Hello!
I'm trying to make anything.el include a category called My Places.
The problem is that it's not a simple list, but a list of pairs, like
this:

(setq my-places '(
 ( "Someproject" "c:/user/proj1/")
 ( "Anotherone" "c:/user/proj2/")))

I want to match on "Someproject" but use "c:\user\proj1" on the
action.
Matching on the first element of the pair is just customizing anything-
sources like this:

 ((name . "Places")
	  (candidates . (lambda () (mapcar (lambda (x) (fst x)) my-places)))
	  (action . open-folder ))

Now, anyone can show me how to apply the action on the second element
of the pair ?

Thanks in advance,
weber

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: anything.el and emacs lisp
  2007-07-12 17:14 anything.el and emacs lisp weber
@ 2007-07-12 18:46 ` Vagn Johansen
  2007-07-12 19:16   ` weber
  0 siblings, 1 reply; 3+ messages in thread
From: Vagn Johansen @ 2007-07-12 18:46 UTC (permalink / raw)
  To: help-gnu-emacs

weber <hugows@gmail.com> writes:

> (setq my-places '(
>  ( "Someproject" "c:/user/proj1/")
>  ( "Anotherone" "c:/user/proj2/")))
>
> I want to match on "Someproject" but use "c:\user\proj1" on the
> action.
> Matching on the first element of the pair is just customizing anything-
> sources like this:
>
>  ((name . "Places")
> 	  (candidates . (lambda () (mapcar (lambda (x) (fst x)) my-places)))
> 	  (action . open-folder ))

(defun open-folder (name)
  (find-file (cadr (assoc name my-places))))

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: anything.el and emacs lisp
  2007-07-12 18:46 ` Vagn Johansen
@ 2007-07-12 19:16   ` weber
  0 siblings, 0 replies; 3+ messages in thread
From: weber @ 2007-07-12 19:16 UTC (permalink / raw)
  To: help-gnu-emacs

On 12 jul, 15:46, Vagn Johansen <gonz...@hotmail.com> wrote:
> weber <hug...@gmail.com> writes:
> > (setq my-places '(
> >  ( "Someproject" "c:/user/proj1/")
> >  ( "Anotherone" "c:/user/proj2/")))
>
> > I want to match on "Someproject" but use "c:\user\proj1" on the
> > action.
> > Matching on the first element of the pair is just customizing anything-
> > sources like this:
>
> >  ((name . "Places")
> >      (candidates . (lambda () (mapcar (lambda (x) (fst x)) my-places)))
> >      (action . open-folder ))
>
> (defun open-folder (name)
>   (find-file (cadr (assoc name my-places))))

Yep, works beautifuly.
Many thanks Vagn!
Regards,
weber

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-07-12 19:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-12 17:14 anything.el and emacs lisp weber
2007-07-12 18:46 ` Vagn Johansen
2007-07-12 19:16   ` weber

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.