xwem-devel
[Top] [All Lists]

Tip: Switching to clients specified by MATCH-SPEC

From: Zajcev Evgeny <zevlg@xxxxxxxxx>
Subject: Tip: Switching to clients specified by MATCH-SPEC
Date: Thu, 10 Feb 2005 03:03:14 +0300
Organization: Home
User-agent: Gnus/5.1002 (Gnus v5.10.2) sxemacs/22.1
Firstly lets create a function to find the client among all clients
managed by xwem:

    (defun my-find-client (match-spec)
      "Return client that matches MATCH-SPEC."
      (let ((cls (xwem-clients-list)))
        (while (and cls (not (xwem-cl-match-p (car cls) (list match-spec))))
          (setq cls (cdr cls)))
        (car cls)))

No we can use very flexible clients matching, to search certain
clients.  For example, lets find a firefox with linux related site
loaded:

    (defun my-switch-firefox-linux ()
      "Switch to firefox that shows some linux related site."
      (interactive)
      (xwem-select-client
       (or (my-find-client '(and (application "firefox")
                                 (name "[lL]inux")))
           (xwem-cl-selected))))

Or maybe you want to switch to XEmacs frame with scratch buffer?

    (defun my-switch-xemacs-scratch ()
      "Switch to XEmacs frame with scratch buffer."
      (interactive)
      (xwem-select-client
       (or (my-find-client '(buffer-name "*scratch*"))
           (xwem-cl-selected))))

For full list of matching posibilities see the docstring for
`xwem-cl-match-p'.

Thanks!

-- 
lg

<Prev in Thread] Current Thread [Next in Thread>