From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Patrick Michael Niedzielski Newsgroups: gmane.emacs.devel Subject: Wrong type error in dbus method Date: Fri, 02 Jul 2010 02:23:51 +0000 Message-ID: <4c2d4db9.df0ae50a.241a.0135@mx.google.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-qNTppUuYgH+YHUeYYPZT" X-Trace: dough.gmane.org 1278037444 27068 80.91.229.12 (2 Jul 2010 02:24:04 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 2 Jul 2010 02:24:04 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 02 04:24:03 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OUVv7-0001lF-VA for ged-emacs-devel@m.gmane.org; Fri, 02 Jul 2010 04:24:02 +0200 Original-Received: from localhost ([127.0.0.1]:48001 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OUVv7-0006nV-8a for ged-emacs-devel@m.gmane.org; Thu, 01 Jul 2010 22:24:01 -0400 Original-Received: from [140.186.70.92] (port=45951 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OUVv2-0006lz-27 for emacs-devel@gnu.org; Thu, 01 Jul 2010 22:23:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OUVv0-0000Gs-Ka for emacs-devel@gnu.org; Thu, 01 Jul 2010 22:23:55 -0400 Original-Received: from mail-qy0-f176.google.com ([209.85.216.176]:59598) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OUVv0-0000Gi-H9 for emacs-devel@gnu.org; Thu, 01 Jul 2010 22:23:54 -0400 Original-Received: by qyk12 with SMTP id 12so173996qyk.0 for ; Thu, 01 Jul 2010 19:23:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:content-type :date:message-id:mime-version:x-mailer; bh=gUmqAWcGUdaKcROBvF1BMPOY5JZFnOLWIfqxwNRe2hw=; b=PoUg2Kc0SzOfuGca6y+ucaa6FFkpWnLTjJagEI+8+KL/Xem3hS238ly2hhaVTmUeO1 rKUvq3DqzS/31QBhRxJdavTWLkk0YLNqKG2T9vXRk933WW/H9sFhlmBmGqU31+uIQ/Tz R7BdVvotV7w3g83FNR15PM+eH++I1qJkZpmHs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:content-type:date:message-id:mime-version:x-mailer; b=NWrU3Es7zUcJ4ic1J66kJqXtvrUCkwsFTikgrbCCnXa8VemcGhn4485f2B5U26v3zh AhjRXKu5xoCp7E/R+p4yA0aGcQnG+UwJ58nqE2M2+h9DPx/nVZwHwvcQwk/xyFUbBBr2 IA9U6a2AFYZHDdVXKbTnatGcoCDBzFekSWxrs= Original-Received: by 10.224.61.15 with SMTP id r15mr292281qah.46.1278037433468; Thu, 01 Jul 2010 19:23:53 -0700 (PDT) Original-Received: from [192.168.27.244] (c-98-217-248-163.hsd1.ma.comcast.net [98.217.248.163]) by mx.google.com with ESMTPS id q31sm220392qcq.8.2010.07.01.19.23.52 (version=SSLv3 cipher=RC4-MD5); Thu, 01 Jul 2010 19:23:53 -0700 (PDT) X-Mailer: Evolution 2.30.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:126673 Archived-At: --=-qNTppUuYgH+YHUeYYPZT Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Hi all, I'm new here, but this is the last place I can find to look for help regarding dbus and emacs specifics. I am writing an elisp file to integrate GNU Emacs with Zeitgeist over dbus. Because of the lack of good documentation on dbus in emacs and my lack of experience with advanced elisp, I am coming up with the following error in my method zeitgeist-send: Wrong type argument: D-Bus, (zeitgeist-event-timestamp) I have tried correcting the issue by placing :string before all the arguments, but that gave me the error: Wrong type argument: stringp, (zeitgeist-event-timestamp) This makes no sense, as I am positive that the value of (zeitgeist-event-timestamp) is a string. If you need, the dbus documentation for zeitgeist is here: http://zeitgeist-project.com/docs/0.4/dbus_api.html#index-0 The format for it is asaasay. I have attached the source code (it's a single file, a few functions). Thanks for any help! Patrick Niedzielski -- Humm and Strumm , a Free Software 3D adventure game for both Windows and *NIX. freeSoftwareHacker(); , a blog about Free Software, music, and law. --=-qNTppUuYgH+YHUeYYPZT Content-Disposition: attachment; filename="zeitgeist.el" Content-Type: text/x-emacs-lisp; name="zeitgeist.el"; charset="UTF-8" Content-Transfer-Encoding: 7bit (require 'dbus) (defun zeitgeist-call (method &rest args) "Call the zeitgeist method METHOD with ARGS over dbus" (apply 'dbus-call-method :session ; use the session (not system) bus "org.gnome.zeitgeist.Engine" ; service name "/org/gnome/zeitgeist/log/activity" ; path name "org.gnome.zeitgeist.Log" ; interface name method args)) (defun zeitgeist-event-timestamp () "Get the timestamp in zeitgeist format." (let* ((now-time (current-time)) (hi (car now-time)) (lo (car (cdr now-time))) (msecs (car (cdr (cdr now-time))))) ; This is *micro*seconds. (number-to-string (+ (/ msecs 1000) (* (+ lo (* hi 65536)) 1000))))) ; Convert system time to milliseconds. (defun zeitgeist-event-interpretation (event) "Get the Event Interpretation of EVENT." (case event ('zeitgeist-open-event "http://zeitgeist-project.com/ontologies/2010/01/27/zg#AccessEvent") ('zeitgeist-close-event "http://zeitgeist-project.com/schema/1.0/core#CloseEvent") ('zeitgeist-create-event "http://zeitgeist-project.com/schema/1.0/core#CreateEvent") ('zeitgeist-modify-event "http://zeitgeist-project.com/schema/1.0/core#ModifyEvent") (otherwise nil))) (defun zeitgeist-send (event fileurl filemime) "Send zeitgeist an event EVENT using the list FILEINFO." (let ((event-interpretation (zeitgeist-event-interpretation event))) (if (eq nil event-interpretation) (message "YOU FAIL") (zeitgeist-call "InsertEvents" '(:string "" :string (zeitgeist-event-timestamp) :string event-interpretation "http://zeitgeist-project.com/schema/1.0/core#UserActivity" "app://emacs.desktop") '((fileurl "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo/#Document" "http://www.semanticdesktop.org/ontologies/nfo/#FileDataObject" fileurl filemime (file-name-sans-versions fileurl) "")) ; Some black magic later '(:array))))) (defun zeitgeist-open-file () "Tell zeitgeist we openned a file!" (if (eq nil (buffer-file-name)) (message "You are not on a file.") (zeitgeist-send 'zeitgeist-open-event buffer-file-name "text/plain"))) (zeitgeist-open-file) --=-qNTppUuYgH+YHUeYYPZT--