diff options
| author | Michael Albinus | 2008-02-06 21:31:16 +0000 |
|---|---|---|
| committer | Michael Albinus | 2008-02-06 21:31:16 +0000 |
| commit | 06c0751a07882220836c83256c12b87e723f5877 (patch) | |
| tree | 0e2e197dfc13b714451558befd8a744079f334b7 | |
| parent | 4ba11bcb85896ea1201edb4f03b7b0a30c93334b (diff) | |
| download | emacs-06c0751a07882220836c83256c12b87e723f5877.tar.gz emacs-06c0751a07882220836c83256c12b87e723f5877.zip | |
* dbus.texi (all): Wrap Lisp code examples with @lisp ... @end lisp.
(Inspection): New function dbus-ping.
| -rw-r--r-- | doc/misc/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/misc/dbus.texi | 59 | ||||
| -rw-r--r-- | lisp/ChangeLog | 7 |
3 files changed, 50 insertions, 21 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index eb6958e0485..977def73eed 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2008-02-06 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * dbus.texi (all): Wrap Lisp code examples with @lisp ... @end lisp. | ||
| 4 | (Inspection): New function dbus-ping. | ||
| 5 | |||
| 1 | 2008-02-05 Michael Albinus <michael.albinus@gmx.de> | 6 | 2008-02-05 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 7 | ||
| 3 | * tramp.texi (Remote processes): Add `shell-command'. | 8 | * tramp.texi (Remote processes): Add `shell-command'. |
diff --git a/doc/misc/dbus.texi b/doc/misc/dbus.texi index 27550337b39..392f9a85dab 100644 --- a/doc/misc/dbus.texi +++ b/doc/misc/dbus.texi | |||
| @@ -158,14 +158,33 @@ string. | |||
| 158 | 158 | ||
| 159 | @defun dbus-get-name-owner bus service | 159 | @defun dbus-get-name-owner bus service |
| 160 | For a given service, registered at D-Bus @var{bus} under the name | 160 | For a given service, registered at D-Bus @var{bus} under the name |
| 161 | @var{service}, the unique name of the name owner is returned. The result is a | 161 | @var{service}, the unique name of the name owner is returned. The |
| 162 | string, or @code{nil} when there exist no name owner of @var{service}. | 162 | result is a string, or @code{nil} when there exist no name owner of |
| 163 | @var{service}. | ||
| 163 | 164 | ||
| 164 | @var{bus} must be either the symbol @code{:system} or the symbol | 165 | @var{bus} must be either the symbol @code{:system} or the symbol |
| 165 | @code{:session}. @var{service} must be a known service name as | 166 | @code{:session}. @var{service} must be a known service name as |
| 166 | string. | 167 | string. |
| 167 | @end defun | 168 | @end defun |
| 168 | 169 | ||
| 170 | @defun dbus-ping bus service | ||
| 171 | Check whether the service name @var{service} is registered at D-Bus | ||
| 172 | @var{bus}. @var{service} might not have been started yet. The result | ||
| 173 | is either @code{t} or @code{nil}. | ||
| 174 | |||
| 175 | @var{bus} must be either the symbol @code{:system} or the symbol | ||
| 176 | @code{:session}. @var{service} must be a string. Example: | ||
| 177 | |||
| 178 | @lisp | ||
| 179 | (message | ||
| 180 | "%s screensaver on board." | ||
| 181 | (cond | ||
| 182 | ((dbus-ping :session "org.gnome.ScreenSaver") "Gnome") | ||
| 183 | ((dbus-ping :session "org.freedesktop.ScreenSaver") "KDE") | ||
| 184 | (t "No"))) | ||
| 185 | @end lisp | ||
| 186 | @end defun | ||
| 187 | |||
| 169 | @defun dbus-get-unique-name bus | 188 | @defun dbus-get-unique-name bus |
| 170 | The unique name, under which Emacs is registered at D-Bus @var{bus}, | 189 | The unique name, under which Emacs is registered at D-Bus @var{bus}, |
| 171 | is returned as string. | 190 | is returned as string. |
| @@ -185,7 +204,7 @@ returns all interfaces of @var{service}, registered at object path | |||
| 185 | strings. The result, the introspection data, is a string in XML | 204 | strings. The result, the introspection data, is a string in XML |
| 186 | format. Example: | 205 | format. Example: |
| 187 | 206 | ||
| 188 | @example | 207 | @lisp |
| 189 | (dbus-introspect | 208 | (dbus-introspect |
| 190 | :system "org.freedesktop.Hal" | 209 | :system "org.freedesktop.Hal" |
| 191 | "/org/freedesktop/Hal/devices/computer") | 210 | "/org/freedesktop/Hal/devices/computer") |
| @@ -206,7 +225,7 @@ format. Example: | |||
| 206 | </interface> | 225 | </interface> |
| 207 | @dots{} | 226 | @dots{} |
| 208 | </node>" | 227 | </node>" |
| 209 | @end example | 228 | @end lisp |
| 210 | 229 | ||
| 211 | This example informs us, that the service @code{org.freedesktop.Hal} | 230 | This example informs us, that the service @code{org.freedesktop.Hal} |
| 212 | at object path @code{/org/freedesktop/Hal/devices/computer} offers the | 231 | at object path @code{/org/freedesktop/Hal/devices/computer} offers the |
| @@ -422,20 +441,20 @@ The function returns the resulting values of @var{method} as a list of | |||
| 422 | Lisp objects, according to the type conversion rules described in | 441 | Lisp objects, according to the type conversion rules described in |
| 423 | @ref{Type Conversion}. Example: | 442 | @ref{Type Conversion}. Example: |
| 424 | 443 | ||
| 425 | @example | 444 | @lisp |
| 426 | (dbus-call-method | 445 | (dbus-call-method |
| 427 | :session "org.gnome.seahorse" "/org/gnome/seahorse/keys/openpgp" | 446 | :session "org.gnome.seahorse" "/org/gnome/seahorse/keys/openpgp" |
| 428 | "org.gnome.seahorse.Keys" "GetKeyField" | 447 | "org.gnome.seahorse.Keys" "GetKeyField" |
| 429 | "openpgp:657984B8C7A966DD" "simple-name") | 448 | "openpgp:657984B8C7A966DD" "simple-name") |
| 430 | 449 | ||
| 431 | @result{} (t ("Philip R. Zimmermann")) | 450 | @result{} (t ("Philip R. Zimmermann")) |
| 432 | @end example | 451 | @end lisp |
| 433 | 452 | ||
| 434 | If the result of the method call is just one value, the converted Lisp | 453 | If the result of the method call is just one value, the converted Lisp |
| 435 | object is returned instead of a list containing this single Lisp | 454 | object is returned instead of a list containing this single Lisp |
| 436 | object. Example: | 455 | object. Example: |
| 437 | 456 | ||
| 438 | @example | 457 | @lisp |
| 439 | (dbus-call-method | 458 | (dbus-call-method |
| 440 | :system "org.freedesktop.Hal" | 459 | :system "org.freedesktop.Hal" |
| 441 | "/org/freedesktop/Hal/devices/computer" | 460 | "/org/freedesktop/Hal/devices/computer" |
| @@ -443,7 +462,7 @@ object. Example: | |||
| 443 | "system.kernel.machine") | 462 | "system.kernel.machine") |
| 444 | 463 | ||
| 445 | @result{} "i686" | 464 | @result{} "i686" |
| 446 | @end example | 465 | @end lisp |
| 447 | 466 | ||
| 448 | With the @code{dbus-introspect} function it is possible to explore the | 467 | With the @code{dbus-introspect} function it is possible to explore the |
| 449 | interfaces of @samp{org.freedesktop.Hal} service. It offers the | 468 | interfaces of @samp{org.freedesktop.Hal} service. It offers the |
| @@ -454,7 +473,7 @@ path @samp{/org/freedesktop/Hal/devices}. With the methods | |||
| 454 | @samp{GetAllDevices} and @samp{GetAllProperties}, it is simple to | 473 | @samp{GetAllDevices} and @samp{GetAllProperties}, it is simple to |
| 455 | emulate the @code{lshal} command on GNU/Linux systems: | 474 | emulate the @code{lshal} command on GNU/Linux systems: |
| 456 | 475 | ||
| 457 | @example | 476 | @lisp |
| 458 | (dolist (device | 477 | (dolist (device |
| 459 | (dbus-call-method | 478 | (dbus-call-method |
| 460 | :system "org.freedesktop.Hal" | 479 | :system "org.freedesktop.Hal" |
| @@ -484,7 +503,7 @@ emulate the @code{lshal} command on GNU/Linux systems: | |||
| 484 | system.chassis.type = \"Notebook\" | 503 | system.chassis.type = \"Notebook\" |
| 485 | system.firmware.release_date = \"03/19/2005\" | 504 | system.firmware.release_date = \"03/19/2005\" |
| 486 | @dots{}" | 505 | @dots{}" |
| 487 | @end example | 506 | @end lisp |
| 488 | @end defun | 507 | @end defun |
| 489 | 508 | ||
| 490 | 509 | ||
| @@ -530,7 +549,7 @@ can be composed like the input parameters in @ref{Type Conversion}. | |||
| 530 | as argument in @code{dbus-unregister-object} for removing the | 549 | as argument in @code{dbus-unregister-object} for removing the |
| 531 | registration for @var{method}. Example: | 550 | registration for @var{method}. Example: |
| 532 | 551 | ||
| 533 | @example | 552 | @lisp |
| 534 | (defun my-dbus-method-handler (filename) | 553 | (defun my-dbus-method-handler (filename) |
| 535 | (let (result) | 554 | (let (result) |
| 536 | (if (find-file filename) | 555 | (if (find-file filename) |
| @@ -548,7 +567,7 @@ registration for @var{method}. Example: | |||
| 548 | @result{} ((:system "org.freedesktop.TextEditor" "OpenFile") | 567 | @result{} ((:system "org.freedesktop.TextEditor" "OpenFile") |
| 549 | ("org.freedesktop.TextEditor" "/org/freedesktop/TextEditor" | 568 | ("org.freedesktop.TextEditor" "/org/freedesktop/TextEditor" |
| 550 | my-method-handler)) | 569 | my-method-handler)) |
| 551 | @end example | 570 | @end lisp |
| 552 | 571 | ||
| 553 | If you invoke the method @code{org.freedesktop.TextEditor.OpenFile} | 572 | If you invoke the method @code{org.freedesktop.TextEditor.OpenFile} |
| 554 | from another D-Bus application with a filename as parameter, the file | 573 | from another D-Bus application with a filename as parameter, the file |
| @@ -592,11 +611,11 @@ All other arguments args are passed to @var{signal} as arguments. | |||
| 592 | They are converted into D-Bus types as described in @ref{Type | 611 | They are converted into D-Bus types as described in @ref{Type |
| 593 | Conversion}. Example: | 612 | Conversion}. Example: |
| 594 | 613 | ||
| 595 | @example | 614 | @lisp |
| 596 | (dbus-send-signal | 615 | (dbus-send-signal |
| 597 | :session "org.gnu.Emacs" "/org/gnu/Emacs" | 616 | :session "org.gnu.Emacs" "/org/gnu/Emacs" |
| 598 | "org.gnu.Emacs.FileManager" "FileModified" "/home/albinus/.emacs") | 617 | "org.gnu.Emacs.FileManager" "FileModified" "/home/albinus/.emacs") |
| 599 | @end example | 618 | @end lisp |
| 600 | @end defun | 619 | @end defun |
| 601 | 620 | ||
| 602 | @defun dbus-register-signal bus service path interface signal handler | 621 | @defun dbus-register-signal bus service path interface signal handler |
| @@ -626,7 +645,7 @@ provide @var{signal}. | |||
| 626 | received. It must accept as arguments the output parameters | 645 | received. It must accept as arguments the output parameters |
| 627 | @var{signal} is sending. Example: | 646 | @var{signal} is sending. Example: |
| 628 | 647 | ||
| 629 | @example | 648 | @lisp |
| 630 | (defun my-dbus-signal-handler (device) | 649 | (defun my-dbus-signal-handler (device) |
| 631 | (message "Device %s added" device)) | 650 | (message "Device %s added" device)) |
| 632 | 651 | ||
| @@ -640,7 +659,7 @@ received. It must accept as arguments the output parameters | |||
| 640 | @result{} ((:system "org.freedesktop.Hal.Manager" "DeviceAdded") | 659 | @result{} ((:system "org.freedesktop.Hal.Manager" "DeviceAdded") |
| 641 | ("org.freedesktop.Hal" "/org/freedesktop/Hal/Manager" | 660 | ("org.freedesktop.Hal" "/org/freedesktop/Hal/Manager" |
| 642 | my-signal-handler)) | 661 | my-signal-handler)) |
| 643 | @end example | 662 | @end lisp |
| 644 | 663 | ||
| 645 | As we know from the inspection data of interface | 664 | As we know from the inspection data of interface |
| 646 | @code{org.freedesktop.Hal.Manager}, the signal @code{DeviceAdded} | 665 | @code{org.freedesktop.Hal.Manager}, the signal @code{DeviceAdded} |
| @@ -687,9 +706,9 @@ errors can be made visible when variable @code{dbus-debug} is set to | |||
| 687 | Incoming D-Bus messages are handled as Emacs events (see @pxref{Misc | 706 | Incoming D-Bus messages are handled as Emacs events (see @pxref{Misc |
| 688 | Events, , , elisp}). The generated event has this form: | 707 | Events, , , elisp}). The generated event has this form: |
| 689 | 708 | ||
| 690 | @example | 709 | @lisp |
| 691 | (dbus-event @var{bus} @var{serial} @var{service} @var{path} @var{interface} @var{member} @var{handler} &rest @var{args}) | 710 | (dbus-event @var{bus} @var{serial} @var{service} @var{path} @var{interface} @var{member} @var{handler} &rest @var{args}) |
| 692 | @end example | 711 | @end lisp |
| 693 | 712 | ||
| 694 | @var{bus} identifies the D-Bus the signal is coming from. It is | 713 | @var{bus} identifies the D-Bus the signal is coming from. It is |
| 695 | either the symbol @code{:system} or the symbol @code{:session}. | 714 | either the symbol @code{:system} or the symbol @code{:session}. |
| @@ -708,10 +727,10 @@ arrives, @var{handler} is called with @var{args} as arguments. | |||
| 708 | In order to inspect the @code{dbus-event} data, you could extend the | 727 | In order to inspect the @code{dbus-event} data, you could extend the |
| 709 | definition of the callback function in @ref{Signals}: | 728 | definition of the callback function in @ref{Signals}: |
| 710 | 729 | ||
| 711 | @example | 730 | @lisp |
| 712 | (defun my-dbus-signal-handler (&rest args) | 731 | (defun my-dbus-signal-handler (&rest args) |
| 713 | (message "my-dbus-signal-handler: %S" last-input-event)) | 732 | (message "my-dbus-signal-handler: %S" last-input-event)) |
| 714 | @end example | 733 | @end lisp |
| 715 | 734 | ||
| 716 | There exist convenience functions which could be called inside a | 735 | There exist convenience functions which could be called inside a |
| 717 | callback function in order to retrieve the information from the event. | 736 | callback function in order to retrieve the information from the event. |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0304dd5ea27..6b0c5de8824 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2008-02-06 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * net/dbus.el (dbus-interface-peer): New defconst. | ||
| 4 | (dbus-ping): New defun. | ||
| 5 | |||
| 1 | 2008-02-06 Sam Steingold <sds@gnu.org> | 6 | 2008-02-06 Sam Steingold <sds@gnu.org> |
| 2 | 7 | ||
| 3 | * vc-hooks.el (vc-prefix-key): New user-customizable variable. | 8 | * vc-hooks.el (vc-prefix-key): New user-customizable variable. |
| @@ -4800,7 +4805,7 @@ | |||
| 4800 | 2008-01-06 Dan Nicolaescu <dann@ics.uci.edu> | 4805 | 2008-01-06 Dan Nicolaescu <dann@ics.uci.edu> |
| 4801 | 4806 | ||
| 4802 | * vc.el (vc-status-fileinfo): New defstruct. | 4807 | * vc.el (vc-status-fileinfo): New defstruct. |
| 4803 | (vc-status): New defvar | 4808 | (vc-status): New defvar. |
| 4804 | (vc-status-insert-headers, vc-status-printer, vc-status) | 4809 | (vc-status-insert-headers, vc-status-printer, vc-status) |
| 4805 | (vc-status-mode-map, vc-status-mode, vc-status-mark-file) | 4810 | (vc-status-mode-map, vc-status-mode, vc-status-mark-file) |
| 4806 | (vc-status-unmark-file, vc-status-marked-files): New functions. | 4811 | (vc-status-unmark-file, vc-status-marked-files): New functions. |