all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Wrong type error in dbus method
@ 2010-07-02  2:23 Patrick Michael Niedzielski
  2010-07-02  9:04 ` Thien-Thi Nguyen
  0 siblings, 1 reply; 12+ messages in thread
From: Patrick Michael Niedzielski @ 2010-07-02  2:23 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1187 bytes --]

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 <http://hummstrumm.blogspot.com/>, a Free Software 3D
adventure game for both Windows and *NIX.

freeSoftwareHacker(); <http://freesoftwarehacker.blogspot.com/>, a blog
about Free Software, music, and law.

[-- Attachment #2: zeitgeist.el --]
[-- Type: text/x-emacs-lisp, Size: 2328 bytes --]

(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)

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

* Re: Wrong type error in dbus method
  2010-07-02  2:23 Wrong type error in dbus method Patrick Michael Niedzielski
@ 2010-07-02  9:04 ` Thien-Thi Nguyen
  2010-07-03  8:59   ` Michael Albinus
  0 siblings, 1 reply; 12+ messages in thread
From: Thien-Thi Nguyen @ 2010-07-02  9:04 UTC (permalink / raw)
  To: Patrick Michael Niedzielski; +Cc: emacs-devel

() Patrick Michael Niedzielski <patrickniedzielski@gmail.com>
() Fri, 02 Jul 2010 02:23:51 +0000

      (zeitgeist-call "InsertEvents"
        '(:string ""
        :string (zeitgeist-event-timestamp)
        ...))

This fragment uses ‘quote’, which results in the expression
‘(zeitgeist-event-timestamp)’ never being evaluated.  To construct a
proper plist for ‘zeitgeist-call’ in this case, use ‘list’, for example:

      (zeitgeist-call "InsertEvents"
        (list :string ""
              :string (zeitgeist-event-timestamp)
              ...))

Alternatively, you can use ‘backquote’ and ‘unquote’.

thi



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

* Re: Wrong type error in dbus method
  2010-07-02  9:04 ` Thien-Thi Nguyen
@ 2010-07-03  8:59   ` Michael Albinus
  2010-07-05  9:00     ` Thien-Thi Nguyen
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Albinus @ 2010-07-03  8:59 UTC (permalink / raw)
  To: Thien-Thi Nguyen; +Cc: Patrick Michael Niedzielski, emacs-devel

Patrick Michael Niedzielski <patrickniedzielski@gmail.com> writes:

> Hi all,

Hi,

> 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:

Which information do you miss in the dbus info manual?

Thien-Thi Nguyen <ttn@gnuvola.org> writes:

> This fragment uses ‘quote’, which results in the expression
> ‘(zeitgeist-event-timestamp)’ never being evaluated.  To construct a
> proper plist for ‘zeitgeist-call’ in this case, use ‘list’, for example:
>
>       (zeitgeist-call "InsertEvents"
>         (list :string ""
>               :string (zeitgeist-event-timestamp)
>               ...))

and you don't need the :string keyword, because it is the default type
when a string is passed as parameter.

Best regards, Michael.



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

* Re: Wrong type error in dbus method
  2010-07-03  8:59   ` Michael Albinus
@ 2010-07-05  9:00     ` Thien-Thi Nguyen
  2010-07-05 15:04       ` Drew Adams
                         ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Thien-Thi Nguyen @ 2010-07-05  9:00 UTC (permalink / raw)
  To: Michael Albinus; +Cc: Patrick Michael Niedzielski, emacs-devel

() Michael Albinus <michael.albinus@gmx.de>
() Sat, 03 Jul 2010 10:59:06 +0200

   Which information do you miss in the dbus info manual?

I typed ‘i’ and Emacs beeped: "No index".  That's a big hole.
[If i were maintaining Emacs, i would add "all manuals have an
index" as a strong requirement in admin/FOR-RELEASE (Manuals).]

Re this particular problem (incorrect list construction), perhaps
where it reads:

     All other arguments args are passed to METHOD as arguments.  They
     are converted into D-Bus types as described in *note Type
     Conversion::.

you could link to the Emacs Lisp manual, node "(elisp) Building Lists".
I see this blurb is repeated in both Synchronous Methods and Asynchronous
Methods, so another idea is to add to Overview a small section "Audience",
with appropriate hints/links on Emacs Lisp programming, message bus fu,
network etiquette, etc.  The primary message there would be "to get the
best out of this manual (& the API it describes & the peers with whom you
will likely be communicating), move your mind here, first".  Of course,
if you are a mechanism/policy separation purist, this might chafe a bit.

thi



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

* RE: Wrong type error in dbus method
  2010-07-05  9:00     ` Thien-Thi Nguyen
@ 2010-07-05 15:04       ` Drew Adams
  2010-07-05 18:34         ` Michael Albinus
  2010-07-05 15:45       ` Patrick Michael Niedzielski
  2010-07-09 19:47       ` Michael Albinus
  2 siblings, 1 reply; 12+ messages in thread
From: Drew Adams @ 2010-07-05 15:04 UTC (permalink / raw)
  To: 'Thien-Thi Nguyen', 'Michael Albinus'
  Cc: 'Patrick Michael Niedzielski', emacs-devel

> I typed 'i' and Emacs beeped: "No index".  That's a big hole.
> [If i were maintaining Emacs, i would add "all manuals have an
> index" as a strong requirement in admin/FOR-RELEASE (Manuals).]

+1




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

* Re: Wrong type error in dbus method
  2010-07-05  9:00     ` Thien-Thi Nguyen
  2010-07-05 15:04       ` Drew Adams
@ 2010-07-05 15:45       ` Patrick Michael Niedzielski
  2010-07-05 18:40         ` Michael Albinus
  2010-07-09 19:47       ` Michael Albinus
  2 siblings, 1 reply; 12+ messages in thread
From: Patrick Michael Niedzielski @ 2010-07-05 15:45 UTC (permalink / raw)
  To: emacs-devel

Hi,

On Mon, 2010-07-05 at 11:00 +0200, Thien-Thi Nguyen wrote: 
> () Michael Albinus <michael.albinus@gmx.de>
> () Sat, 03 Jul 2010 10:59:06 +0200
> 
>    Which information do you miss in the dbus info manual?
> 
> I typed ‘i’ and Emacs beeped: "No index".  That's a big hole.
> [If i were maintaining Emacs, i would add "all manuals have an
> index" as a strong requirement in admin/FOR-RELEASE (Manuals).]

I cannot confirm this particular problem, because I use Debian, which
doesn't give me manuals by default.  I found the dbus documntation only
by going to the CVS repo and downloading the texinfo file.

> Re this particular problem (incorrect list construction), perhaps
> where it reads:
> 
>      All other arguments args are passed to METHOD as arguments.  They
>      are converted into D-Bus types as described in *note Type
>      Conversion::.
> 
> you could link to the Emacs Lisp manual, node "(elisp) Building Lists".
> I see this blurb is repeated in both Synchronous Methods and Asynchronous
> Methods, so another idea is to add to Overview a small section "Audience",
> with appropriate hints/links on Emacs Lisp programming, message bus fu,
> network etiquette, etc.  The primary message there would be "to get the
> best out of this manual (& the API it describes & the peers with whom you
> will likely be communicating), move your mind here, first".  Of course,
> if you are a mechanism/policy separation purist, this might chafe a bit.

I believe my infamiliarity with LISP was the biggest problem; I didn't
think that quote would not evalute anything, just not evalute the list
as a function.  However, what you are suggesting probably would have
helped me.  In fact, if placed with the Type Conversion section, I think
it would have solved my problem completely.


Oh, and does this list not set the reply-to header?

Cheers,
Patrick Niedzielski




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

* Re: Wrong type error in dbus method
  2010-07-05 15:04       ` Drew Adams
@ 2010-07-05 18:34         ` Michael Albinus
  2010-07-05 19:03           ` Thien-Thi Nguyen
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Albinus @ 2010-07-05 18:34 UTC (permalink / raw)
  To: Drew Adams
  Cc: 'Patrick Michael Niedzielski', 'Thien-Thi Nguyen',
	emacs-devel

"Drew Adams" <drew.adams@oracle.com> writes:

>> I typed 'i' and Emacs beeped: "No index".  That's a big hole.
>> [If i were maintaining Emacs, i would add "all manuals have an
>> index" as a strong requirement in admin/FOR-RELEASE (Manuals).]
>
> +1

Understood. I'm a little bit busy just after vacations; I'll try to
polish the manual when my head is back over the water line.

Best regards, Michael.



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

* Re: Wrong type error in dbus method
  2010-07-05 15:45       ` Patrick Michael Niedzielski
@ 2010-07-05 18:40         ` Michael Albinus
  0 siblings, 0 replies; 12+ messages in thread
From: Michael Albinus @ 2010-07-05 18:40 UTC (permalink / raw)
  To: Patrick Michael Niedzielski; +Cc: emacs-devel

Patrick Michael Niedzielski <patrickniedzielski@gmail.com> writes:

> Hi,

Hi,

> I cannot confirm this particular problem, because I use Debian, which
> doesn't give me manuals by default.  I found the dbus documntation only
> by going to the CVS repo and downloading the texinfo file.

You should switch to the bzr repository. CVS is outdated for Emacs.

> Oh, and does this list not set the reply-to header?

There are several posters who do not read the list on a regular basis.

Or who are not subscribed but read the list via gmane (like me), which
could cause delay.

> Cheers,
> Patrick Niedzielski

Best regards, Michael.



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

* Re: Wrong type error in dbus method
  2010-07-05 18:34         ` Michael Albinus
@ 2010-07-05 19:03           ` Thien-Thi Nguyen
  2010-07-05 19:35             ` Michael Albinus
  0 siblings, 1 reply; 12+ messages in thread
From: Thien-Thi Nguyen @ 2010-07-05 19:03 UTC (permalink / raw)
  To: Michael Albinus
  Cc: 'Patrick Michael Niedzielski', Drew Adams, emacs-devel

() Michael Albinus <michael.albinus@gmx.de>
() Mon, 05 Jul 2010 20:34:12 +0200

   Understood. I'm a little bit busy just after vacations; I'll try to
   polish the manual when my head is back over the water line.

All the @defun lines register function implicitly (like explicit @findex).
I see a few @cindex lines, too.  So it sounds like the standard "single
index composed of concepts and functions and variables" is indicated.

Fortunately, that's not hard to do:

Add these lines near the top:

@syncodeindex vr cp
@syncodeindex fn cp

Then add the index as the last node:

@node Index
@unnumbered Index

@printindex cp

Also, don't forget to add

* Index::

to the top-level menu.  I would post a patch, but i'm afraid of bazaar.

thi



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

* Re: Wrong type error in dbus method
  2010-07-05 19:03           ` Thien-Thi Nguyen
@ 2010-07-05 19:35             ` Michael Albinus
  2010-07-05 20:40               ` Chad Brown
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Albinus @ 2010-07-05 19:35 UTC (permalink / raw)
  To: Thien-Thi Nguyen
  Cc: 'Patrick Michael Niedzielski', Drew Adams, emacs-devel

Thien-Thi Nguyen <ttn@gnuvola.org> writes:

> I would post a patch, but i'm afraid of bazaar.

Thanks a lot, I'll do later this week. (Or you send the patch to me;
I'll commit it for you).

Btw, I do all commits via vc, so I don't need to remember which traps I
could enter with bzr. Maybe I will learn once all the advantages bzr has
brought to us, for the time being my cvs-like behaviour seems to be
sufficient.

> thi

Best regards, Michael.



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

* Re: Wrong type error in dbus method
  2010-07-05 19:35             ` Michael Albinus
@ 2010-07-05 20:40               ` Chad Brown
  0 siblings, 0 replies; 12+ messages in thread
From: Chad Brown @ 2010-07-05 20:40 UTC (permalink / raw)
  To: Michael Albinus; +Cc: Thien-Thi Nguyen, Emacs development discussions

On Jul 5, 2010, at 12:35 PM, Michael Albinus wrote:
> Maybe I will learn once all the advantages bzr has
> brought to us, for the time being my cvs-like behaviour seems to be
> sufficient.


While I'm not a big fan of bazaar, I've seen a few people say things like this recently.  IMHO, the best answer is probably:

	http://bzr.savannah.gnu.org/r/emacs/

Or, to be slightly less mysterious: exploration and experimentation branches in a system that (theoretically) doesn't suck.

Hope that helps,
*Chad





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

* Re: Wrong type error in dbus method
  2010-07-05  9:00     ` Thien-Thi Nguyen
  2010-07-05 15:04       ` Drew Adams
  2010-07-05 15:45       ` Patrick Michael Niedzielski
@ 2010-07-09 19:47       ` Michael Albinus
  2 siblings, 0 replies; 12+ messages in thread
From: Michael Albinus @ 2010-07-09 19:47 UTC (permalink / raw)
  To: Thien-Thi Nguyen; +Cc: Patrick Michael Niedzielski, emacs-devel

Thien-Thi Nguyen <ttn@gnuvola.org> writes:

> I typed ‘i’ and Emacs beeped: "No index".  That's a big hole.
> [If i were maintaining Emacs, i would add "all manuals have an
> index" as a strong requirement in admin/FOR-RELEASE (Manuals).]

Added.

> Re this particular problem (incorrect list construction), perhaps
> where it reads:
>
>      All other arguments args are passed to METHOD as arguments.  They
>      are converted into D-Bus types as described in *note Type
>      Conversion::.
>
> you could link to the Emacs Lisp manual, node "(elisp) Building Lists".

I've refrained from adding this. The concrete error was not related to
special dbus.el handling; pointing to list construction could be added
to any package specific manual otherwise ...

> I see this blurb is repeated in both Synchronous Methods and Asynchronous
> Methods, so another idea is to add to Overview a small section "Audience",
> with appropriate hints/links on Emacs Lisp programming, message bus fu,
> network etiquette, etc.  The primary message there would be "to get the
> best out of this manual (& the API it describes & the peers with whom you
> will likely be communicating), move your mind here, first".  Of course,
> if you are a mechanism/policy separation purist, this might chafe a bit.

This might be worth to add. But I still need some thinking about,
because it could tend to explain DBus itself, which shouldn't be done in
dbus.texi.

> thi

Best regards, Michael.



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

end of thread, other threads:[~2010-07-09 19:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-02  2:23 Wrong type error in dbus method Patrick Michael Niedzielski
2010-07-02  9:04 ` Thien-Thi Nguyen
2010-07-03  8:59   ` Michael Albinus
2010-07-05  9:00     ` Thien-Thi Nguyen
2010-07-05 15:04       ` Drew Adams
2010-07-05 18:34         ` Michael Albinus
2010-07-05 19:03           ` Thien-Thi Nguyen
2010-07-05 19:35             ` Michael Albinus
2010-07-05 20:40               ` Chad Brown
2010-07-05 15:45       ` Patrick Michael Niedzielski
2010-07-05 18:40         ` Michael Albinus
2010-07-09 19:47       ` Michael Albinus

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.