[Top][All Lists]

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

Re: ;;; anything.el --- open anything

From: Mathias Dahl
Subject: Re: ;;; anything.el --- open anything
Date: Fri, 29 Jun 2007 09:32:18 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (windows-nt)

Mathias Dahl <address@hidden> writes:

> I might also try to extend it to find my Jabber buddies and start
> chatting with them.

Did it. Works. The code below requires jabber.el:

  (defun my-jabber-list-contacts (&optional subset require-match default 
    "List Jabber contacts.
This is a blatant copy-paste from `jabber-chat-with' with some
code removed."
    (let ((jid-at-point (or 
                         (and default
                              ;; default can be either a symbol or a string
                              (if (symbolp default)
                                  (symbol-name default)
                         (get-text-property (point) 'jabber-jid)
                         (bound-and-true-p jabber-chatting-with)
                         (bound-and-true-p jabber-group)))
          (completion-ignore-case t)
          (jid-completion-table (mapcar #'(lambda (item)
                                            (cons (symbol-name item) item))
                                        (or subset (jabber-concat-rosters))))
      (dolist (item (or subset (jabber-concat-rosters)))
        (if (get item 'name)
            (push (cons (get item 'name) item) jid-completion-table)))
      ;; if the default is not in the allowed subset, it's not a good default
      (if (and subset (not (assoc jid-at-point jid-completion-table)))
          (setq jid-at-point nil))

To be more useful the above should probably only list online contacts.

Add this to your anything sources:

  ((name . "Jabber Contacts")
   (candidates . (lambda ()
                    (lambda (x) 
                      (car x)) 
   (action . (lambda (x)


reply via email to

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