diff options
| author | Michael Albinus | 2008-08-10 19:36:12 +0000 |
|---|---|---|
| committer | Michael Albinus | 2008-08-10 19:36:12 +0000 |
| commit | 3cf235ebe6511e00848b7c8daa78d53d2cac5e45 (patch) | |
| tree | ee98e74f4b4920dff12bc7017a966aae3b6535ea | |
| parent | 06cc0d1532ad78602d3ffe9ca9791d85da3f0184 (diff) | |
| download | emacs-3cf235ebe6511e00848b7c8daa78d53d2cac5e45.tar.gz emacs-3cf235ebe6511e00848b7c8daa78d53d2cac5e45.zip | |
* net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
(xesam-refresh-entry): Add Debbugs handling. Insert a widget
"DONE", when all hits are retrieved.
(xesam-search): autoload it.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/net/xesam.el | 77 |
2 files changed, 68 insertions, 16 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c38aed8e9c2..73eafca52a0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2008-08-10 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * net/xesam.el (xesam-search-engines): Add Debbugs hit fields. | ||
| 4 | (xesam-refresh-entry): Add Debbugs handling. Insert a widget | ||
| 5 | "DONE", when all hits are retrieved. | ||
| 6 | (xesam-search): autoload it. | ||
| 7 | |||
| 1 | 2008-08-11 John Paul Wallington <jpw@pobox.com> | 8 | 2008-08-11 John Paul Wallington <jpw@pobox.com> |
| 2 | 9 | ||
| 3 | * ibuffer.el (ibuffer-buffer-file-name): Return nil rather than | 10 | * ibuffer.el (ibuffer-buffer-file-name): Return nil rather than |
diff --git a/lisp/net/xesam.el b/lisp/net/xesam.el index f17f28f3ded..e7d56341908 100644 --- a/lisp/net/xesam.el +++ b/lisp/net/xesam.el | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | ;;; Commentary: | 23 | ;;; Commentary: |
| 24 | 24 | ||
| 25 | ;; This package provides an interface to the Xesam, a D-Bus based "eXtEnsible | 25 | ;; This package provides an interface to Xesam, a D-Bus based "eXtEnsible |
| 26 | ;; Search And Metadata specification". It has been tested with | 26 | ;; Search And Metadata specification". It has been tested with |
| 27 | ;; | 27 | ;; |
| 28 | ;; xesam-glib 0.3.4, xesam-tools 0.6.1 | 28 | ;; xesam-glib 0.3.4, xesam-tools 0.6.1 |
| @@ -32,7 +32,7 @@ | |||
| 32 | ;; The precondition for this package is a D-Bus aware Emacs. This is | 32 | ;; The precondition for this package is a D-Bus aware Emacs. This is |
| 33 | ;; configured per default, when Emacs is built on a machine running | 33 | ;; configured per default, when Emacs is built on a machine running |
| 34 | ;; D-Bus. Furthermore, there must be at least one search engine | 34 | ;; D-Bus. Furthermore, there must be at least one search engine |
| 35 | ;; running, which support the Xesam interface. Beagle and strigi have | 35 | ;; running, which supports the Xesam interface. Beagle and strigi have |
| 36 | ;; been tested; tracker, pinot and recoll are also said to support | 36 | ;; been tested; tracker, pinot and recoll are also said to support |
| 37 | ;; Xesam. You can check the existence of such a search engine by | 37 | ;; Xesam. You can check the existence of such a search engine by |
| 38 | ;; | 38 | ;; |
| @@ -380,20 +380,25 @@ If there is no registered search engine at all, the function returns `nil'." | |||
| 380 | ;; That is not the case now, so we set it ourselves. | 380 | ;; That is not the case now, so we set it ourselves. |
| 381 | ;; Hopefully, this will change later. | 381 | ;; Hopefully, this will change later. |
| 382 | (setq hit-fields | 382 | (setq hit-fields |
| 383 | (cond | 383 | (case (intern vendor-id) |
| 384 | ((string-equal vendor-id "Beagle") | 384 | ('Beagle |
| 385 | '("xesam:mimeType" "xesam:url")) | 385 | '("xesam:mimeType" "xesam:url")) |
| 386 | ((string-equal vendor-id "Strigi") | 386 | ('Strigi |
| 387 | '("xesam:author" "xesam:cc" "xesam:charset" | 387 | '("xesam:author" "xesam:cc" "xesam:charset" |
| 388 | "xesam:contentType" "xesam:fileExtension" "xesam:id" | 388 | "xesam:contentType" "xesam:fileExtension" |
| 389 | "xesam:lineCount" "xesam:links" "xesam:mimeType" "xesam:name" | 389 | "xesam:id" "xesam:lineCount" "xesam:links" |
| 390 | "xesam:size" "xesam:sourceModified" "xesam:subject" | 390 | "xesam:mimeType" "xesam:name" "xesam:size" |
| 391 | "xesam:to" "xesam:url")) | 391 | "xesam:sourceModified" "xesam:subject" "xesam:to" |
| 392 | ((string-equal vendor-id "TrackerXesamSession") | 392 | "xesam:url")) |
| 393 | '("xesam:relevancyRating" "xesam:url")) | 393 | ('TrackerXesamSession |
| 394 | ;; xesam-tools yahoo service. | 394 | '("xesam:relevancyRating" "xesam:url")) |
| 395 | (t '("xesam:contentModified" "xesam:mimeType" "xesam:summary" | 395 | ('Debbugs |
| 396 | "xesam:title" "xesam:url" "yahoo:displayUrl")))) | 396 | '("xesam:keyword" "xesam:owner" "xesam:title" |
| 397 | "xesam:url" "xesam:sourceModified" "xesam:mimeType" | ||
| 398 | "debbugs:key")) | ||
| 399 | ;; xesam-tools yahoo service. | ||
| 400 | (t '("xesam:contentModified" "xesam:mimeType" "xesam:summary" | ||
| 401 | "xesam:title" "xesam:url" "yahoo:displayUrl")))) | ||
| 397 | 402 | ||
| 398 | (xesam-set-property engine "hit.fields" hit-fields) | 403 | (xesam-set-property engine "hit.fields" hit-fields) |
| 399 | (xesam-set-property engine "hit.fields.extended" '("xesam:snippet")) | 404 | (xesam-set-property engine "hit.fields.extended" '("xesam:snippet")) |
| @@ -560,6 +565,39 @@ SEARCH is the search identification in that engine. Both must be strings." | |||
| 560 | (string-equal "text/html" (widget-get widget :xesam:mimeType))) | 565 | (string-equal "text/html" (widget-get widget :xesam:mimeType))) |
| 561 | (setcar widget 'url-link)) | 566 | (setcar widget 'url-link)) |
| 562 | 567 | ||
| 568 | ;; Debbugs hits shall be displayed. | ||
| 569 | ((and (widget-member widget :xesam:mimeType) | ||
| 570 | (string-equal "application/x-debbugs" | ||
| 571 | (widget-get widget :xesam:mimeType))) | ||
| 572 | (widget-put | ||
| 573 | widget :notify | ||
| 574 | '(lambda (widget &rest ignore) | ||
| 575 | ;; We toggle. If there are already children, we delete them. | ||
| 576 | (if (widget-get widget :children) | ||
| 577 | (widget-children-value-delete widget) | ||
| 578 | |||
| 579 | ;; No children. Let's display the messages. | ||
| 580 | (widget-end-of-line) | ||
| 581 | ;; Get hit data. Loop over results. | ||
| 582 | (dolist (data | ||
| 583 | ;; "GetHitData" returns a list. But we have | ||
| 584 | ;; requested just one element only. | ||
| 585 | (car | ||
| 586 | (xesam-dbus-call-method | ||
| 587 | :session (car xesam-engine) xesam-path-search | ||
| 588 | xesam-interface-search "GetHitData" xesam-search | ||
| 589 | (list (widget-get widget :debbugs:key)) | ||
| 590 | '("debbugs:key")))) | ||
| 591 | (let ((child | ||
| 592 | (widget-create-child-and-convert | ||
| 593 | ;; The result is a variant. So we must apply `car'. | ||
| 594 | widget '(link) :format "\n%h" :doc (car data)))) | ||
| 595 | ;; Add child to parent's list. Needed, in order to be | ||
| 596 | ;; able to delete it next toggle. | ||
| 597 | (widget-put | ||
| 598 | widget | ||
| 599 | :children (cons child (widget-get widget :children))))))))) | ||
| 600 | |||
| 563 | ;; For local files, we will open the file as default action. | 601 | ;; For local files, we will open the file as default action. |
| 564 | ((string-match "file" | 602 | ((string-match "file" |
| 565 | (url-type (url-generic-parse-url | 603 | (url-type (url-generic-parse-url |
| @@ -654,6 +692,12 @@ SEARCH is the search identification in that engine. Both must be strings." | |||
| 654 | (- (min (+ xesam-hits-per-page xesam-to) xesam-count) | 692 | (- (min (+ xesam-hits-per-page xesam-to) xesam-count) |
| 655 | (length xesam-objects)))))) | 693 | (length xesam-objects)))))) |
| 656 | 694 | ||
| 695 | ;; Add "DONE" widget. | ||
| 696 | (when (= xesam-current xesam-count) | ||
| 697 | (goto-char (point-max)) | ||
| 698 | (widget-create 'link :notify 'ignore "DONE") | ||
| 699 | (widget-beginning-of-line)) | ||
| 700 | |||
| 657 | ;; Return with save settings. | 701 | ;; Return with save settings. |
| 658 | (setq xesam-refreshing nil))))) | 702 | (setq xesam-refreshing nil))))) |
| 659 | 703 | ||
| @@ -762,6 +806,7 @@ search, is returned." | |||
| 762 | ;; Return search id. | 806 | ;; Return search id. |
| 763 | search)) | 807 | search)) |
| 764 | 808 | ||
| 809 | ;;;###autoload | ||
| 765 | (defun xesam-search (engine query) | 810 | (defun xesam-search (engine query) |
| 766 | "Perform an interactive search. | 811 | "Perform an interactive search. |
| 767 | ENGINE is the Xesam search engine to be applied, it must be one of the | 812 | ENGINE is the Xesam search engine to be applied, it must be one of the |