]> code.delx.au - gnu-emacs/blobdiff - lisp/net/xesam.el
Merge from trunk.
[gnu-emacs] / lisp / net / xesam.el
index 3883d8553c30ff77d28e8a36fb83b3ddda6d288b..64c26cfb2c9eebfd7138927b02ccf3518b81197a 100644 (file)
@@ -1,6 +1,6 @@
 ;;; xesam.el --- Xesam interface to search engines.
 
-;; Copyright (C) 2008 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2011 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: tools, hypermedia
 (defgroup xesam nil
   "Xesam compatible interface to search engines."
   :group 'extensions
-  :group 'hypermedia
+  :group 'comm
   :version "23.1")
 
 (defcustom xesam-query-type 'user-query
@@ -269,6 +269,8 @@ fields are supported.")
 </request>"
   "The Xesam fulltext query XML.")
 
+(declare-function dbus-get-unique-name "dbusbind.c" (bus))
+
 (defvar xesam-dbus-unique-names
   (list (cons :system (dbus-get-unique-name :system))
        (cons :session (dbus-get-unique-name :session)))
@@ -375,6 +377,8 @@ If PROPERTY is not existing, retrieve it from ENGINE first."
   (setq xesam-search-engines
        (delete (assoc (car args) xesam-search-engines) xesam-search-engines)))
 
+(defvar dbus-debug)
+
 (defun xesam-search-engines ()
   "Return Xesam search engines, stored in `xesam-search-engines'.
 The first search engine is the name owner of `xesam-service-search'.
@@ -410,18 +414,18 @@ If there is no registered search engine at all, the function returns `nil'."
        ;; Hopefully, this will change later.
        (setq hit-fields
              (case (intern vendor-id)
-               ('Beagle
+               (Beagle
                 '("xesam:mimeType" "xesam:url"))
-               ('Strigi
+               (Strigi
                 '("xesam:author" "xesam:cc" "xesam:charset"
                   "xesam:contentType" "xesam:fileExtension"
                   "xesam:id" "xesam:lineCount" "xesam:links"
                   "xesam:mimeType" "xesam:name" "xesam:size"
                   "xesam:sourceModified" "xesam:subject" "xesam:to"
                   "xesam:url"))
-               ('TrackerXesamSession
+               (TrackerXesamSession
                 '("xesam:relevancyRating" "xesam:url"))
-               ('Debbugs
+               (Debbugs
                 '("xesam:keyword" "xesam:owner" "xesam:title"
                   "xesam:url" "xesam:sourceModified" "xesam:mimeType"
                   "debbugs:key"))
@@ -442,7 +446,12 @@ If there is no registered search engine at all, the function returns `nil'."
 \f
 ;;; Search buffers.
 
-(define-derived-mode xesam-mode nil "Xesam"
+(defvar xesam-mode-map
+  (let ((map (copy-keymap special-mode-map)))
+    (set-keymap-parent xesam-mode-map widget-keymap)
+    map))
+
+(define-derived-mode xesam-mode special-mode "Xesam"
   "Major mode for presenting search results of a Xesam search.
 In this mode, widgets represent the search results.
 
@@ -451,12 +460,6 @@ Turning on Xesam mode runs the normal hook `xesam-mode-hook'.  It
 can be used to set `xesam-notify-function', which must a search
 engine specific, widget :notify function to visualize xesam:url."
   (set (make-local-variable 'xesam-notify-function) nil)
-
-  ;; Keymap.
-  (setq xesam-mode-map (copy-keymap special-mode-map))
-  (set-keymap-parent xesam-mode-map widget-keymap)
-  (define-key xesam-mode-map "z" 'kill-this-buffer)
-
   ;; Maybe we implement something useful, later on.
   (set (make-local-variable 'revert-buffer-function) 'ignore)
   ;; `xesam-engine', `xesam-search', `xesam-type', `xesam-query', and
@@ -498,7 +501,7 @@ engine specific, widget :notify function to visualize xesam:url."
                       'face 'xesam-mode-line
                       'help-echo (when xesam-debug xesam-xml-string)))))))
 
-  (when (not (interactive-p))
+  (when (not (called-interactively-p 'interactive))
     ;; Initialize buffer.
     (setq buffer-read-only t)
     (let ((inhibit-read-only t))
@@ -914,5 +917,4 @@ Example:
 ;;     yahoo, ebay, ...
 ;;   - Construct complex queries via widgets, like in mairix.el.
 
-;; arch-tag: 7fb9fc6c-c2ff-4bc7-bb42-bacb80cce2b2
 ;;; xesam.el ends here