annotate lisp/net/xesam.el @ 98990:b4de76fc59ca

*** empty log message ***
author Eli Zaretskii <eliz@gnu.org>
date Tue, 21 Oct 2008 14:52:51 +0000
parents 48c669cb45f9
children c52fc3b138ed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
1 ;;; xesam.el --- Xesam interface to search engines.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
2
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
3 ;; Copyright (C) 2008 Free Software Foundation, Inc.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
4
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
5 ;; Author: Michael Albinus <michael.albinus@gmx.de>
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
6 ;; Keywords: tools, hypermedia
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
7
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
9
97381
22514244a76d Standardize license layout.
Glenn Morris <rgm@gnu.org>
parents: 97289
diff changeset
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
97381
22514244a76d Standardize license layout.
Glenn Morris <rgm@gnu.org>
parents: 97289
diff changeset
12 ;; the Free Software Foundation, either version 3 of the License, or
22514244a76d Standardize license layout.
Glenn Morris <rgm@gnu.org>
parents: 97289
diff changeset
13 ;; (at your option) any later version.
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
14
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
18 ;; GNU General Public License for more details.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
19
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
97381
22514244a76d Standardize license layout.
Glenn Morris <rgm@gnu.org>
parents: 97289
diff changeset
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
22
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
23 ;;; Commentary:
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
24
97399
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
25 ;; This package provides an interface to Xesam, a D-Bus based "eXtEnsible
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
26 ;; Search And Metadata specification". It has been tested with
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
27 ;;
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
28 ;; xesam-glib 0.3.4, xesam-tools 0.6.1
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
29 ;; beagle 0.3.7, beagle-xesam 0.2
97170
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
30 ;; strigi 0.5.11
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
31
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
32 ;; The precondition for this package is a D-Bus aware Emacs. This is
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
33 ;; configured per default, when Emacs is built on a machine running
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
34 ;; D-Bus. Furthermore, there must be at least one search engine
97399
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
35 ;; running, which supports the Xesam interface. Beagle and strigi have
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
36 ;; been tested; tracker, pinot and recoll are also said to support
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
37 ;; Xesam. You can check the existence of such a search engine by
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
38 ;;
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
39 ;; (dbus-list-queued-owners :session "org.freedesktop.xesam.searcher")
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
40
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
41 ;; In order to start a search, you must load xesam.el:
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
42 ;;
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
43 ;; (require 'xesam)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
44
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
45 ;; xesam.el supports two types of queries, which are explained *very* short:
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
46 ;;
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
47 ;; * Full text queries. Just search keys shall be given, like
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
48 ;;
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
49 ;; hello world
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
50 ;;
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
51 ;; A full text query in xesam.el is restricted to files.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
52 ;;
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
53 ;; * Xesam End User Search Language queries. The Xesam query language
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
54 ;; is described at <http://xesam.org/main/XesamUserSearchLanguage>,
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
55 ;; which must be consulted for the whole features.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
56 ;;
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
57 ;; A query string consists of search keys, collectors, selectors,
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
58 ;; and phrases. Search keys are words like in a full text query:
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
59 ;;
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
60 ;; hello word
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
61 ;;
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
62 ;; A selector is a tuple <keyword><relation>. <keyword> can be any
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
63 ;; predefined Xesam keyword, the most common keywords are "ext"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
64 ;; (file name extension), "format " (mime type), "tag" (user
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
65 ;; keywords) and "type" (types of items, like "audio", "file",
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
66 ;; "picture", "attachment"). <relation> is a comparison to a value,
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
67 ;; which must be a string (relation ":" or "=") or number (relation
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
68 ;; "<=", ">=", "<", ">"):
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
69 ;;
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
70 ;; type:attachment ext=el
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
71 ;;
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
72 ;; A collector is one of the items "AND", "and", "&&", "OR", "or",
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
73 ;; "||", or "-". The default collector on multiple terms is "AND";
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
74 ;; "-" means "AND NOT".
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
75 ;;
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
76 ;; albinus -type:file
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
77 ;;
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
78 ;; A phrase is a string enclosed in quotes, with appended modifiers
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
79 ;; (single letters). Examples of modifiers are "c" (case
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
80 ;; sensitive), "C" (case insensitive), "e" (exact match), "r"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
81 ;; (regular expression):
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
82 ;;
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
83 ;; "Hello world"c
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
84
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
85 ;; You can customize, whether you want to apply a Xesam user query, or
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
86 ;; a full text query. Note, that not every search engine supports
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
87 ;; both query types.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
88 ;;
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
89 ;; (setq xesam-query-type 'fulltext-query)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
90 ;;
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
91 ;; Another option to be customised is the number of hits to be
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
92 ;; presented at once.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
93 ;;
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
94 ;; (setq xesam-hits-per-page 50)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
95
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
96 ;; A search can be started by the command
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
97 ;;
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
98 ;; M-x xesam-search
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
99 ;;
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
100 ;; When several search engines are registered, the engine to be used
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
101 ;; can be selected via minibuffer completion. Afterwards, the query
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
102 ;; shall be entered in the minibuffer.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
103
97618
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
104 ;; Search results are presented in a new buffer. This buffer has the
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
105 ;; major mode `xesam-mode', with the following keybindings:
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
106
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
107 ;; SPC `scroll-up'
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
108 ;; DEL `scroll-down'
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
109 ;; < `beginning-of-buffer'
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
110 ;; > `end-of-buffer'
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
111 ;; q `quit-window'
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
112 ;; z `kill-this-buffer'
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
113 ;; g `revert-buffer'
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
114
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
115 ;; The search results are represented by widgets. Navigation commands
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
116 ;; are the usual widget navigation commands:
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
117
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
118 ;; TAB `widget-forward'
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
119 ;; <backtab> `widget-backward'
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
120
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
121 ;; Applying RET, <down-mouse-1>, or <down-mouse-2> on a URL belonging
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
122 ;; to the widget, brings up more details of the search hit. The way,
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
123 ;; how this hit is presented, depends on the type of the hit. HTML
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
124 ;; files are opened via `browse-url'. Local files are opened in a new
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
125 ;; buffer, with highlighted search hits (highlighting can be toggled
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
126 ;; by `xesam-minor-mode' in that buffer).
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
127
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
128 ;;; Code:
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
129
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
130 ;; D-Bus support in the Emacs core can be disabled with configuration
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
131 ;; option "--without-dbus". Declare used subroutines and variables.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
132 (declare-function dbus-call-method "dbusbind.c")
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
133 (declare-function dbus-register-signal "dbusbind.c")
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
134
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
135 (require 'dbus)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
136
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
137 ;; Pacify byte compiler.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
138 (eval-when-compile
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
139 (require 'cl))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
140
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
141 ;; Widgets are used to highlight the search results.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
142 (require 'widget)
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
143 (require 'wid-edit)
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
144
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
145 ;; `run-at-time' is used in the signal handler.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
146 (require 'timer)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
147
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
148 ;; The default search field is "xesam:url". It must be inspected.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
149 (require 'url)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
150
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
151 (defgroup xesam nil
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
152 "Xesam compatible interface to search engines."
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
153 :group 'extensions
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
154 :group 'hypermedia
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
155 :version "23.1")
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
156
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
157 (defcustom xesam-query-type 'user-query
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
158 "Xesam query language type."
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
159 :group 'xesam
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
160 :type '(choice
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
161 (const :tag "Xesam user query" user-query)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
162 (const :tag "Xesam fulltext query" fulltext-query)))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
163
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
164 (defcustom xesam-hits-per-page 20
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
165 "Number of search hits to be displayed in the result buffer."
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
166 :group 'xesam
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
167 :type 'integer)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
168
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
169 (defface xesam-mode-line '((t :inherit mode-line-emphasis))
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
170 "Face to highlight mode line."
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
171 :group 'xesam)
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
172
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
173 (defface xesam-highlight '((t :inherit match))
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
174 "Face to highlight query entries.
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
175 It will be overlayed by `widget-documentation-face', so it shall
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
176 be different at least in one face property not set in that face."
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
177 :group 'xesam)
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
178
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
179 (defvar xesam-debug nil
97038
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
180 "Insert debug information in the help echo.")
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
181
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
182 (defconst xesam-service-search "org.freedesktop.xesam.searcher"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
183 "The D-Bus name used to talk to Xesam.")
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
184
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
185 (defconst xesam-path-search "/org/freedesktop/xesam/searcher/main"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
186 "The D-Bus object path used to talk to Xesam.")
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
187
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
188 ;; Methods: "NewSession", "SetProperty", "GetProperty",
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
189 ;; "CloseSession", "NewSearch", "StartSearch", "GetHitCount",
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
190 ;; "GetHits", "GetHitData", "CloseSearch" and "GetState".
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
191 ;; Signals: "HitsAdded", "HitsRemoved", "HitsModified", "SearchDone"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
192 ;; and "StateChanged".
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
193 (defconst xesam-interface-search "org.freedesktop.xesam.Search"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
194 "The D-Bus Xesam search interface.")
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
195
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
196 (defconst xesam-all-fields
97214
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
197 '("xesam:35mmEquivalent" "xesam:aimContactMedium" "xesam:aperture"
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
198 "xesam:aspectRatio" "xesam:attachmentEncoding" "xesam:attendee"
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
199 "xesam:audioBirate" "xesam:audioChannels" "xesam:audioCodec"
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
200 "xesam:audioCodecType" "xesam:audioSampleFormat" "xesam:audioSampleRate"
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
201 "xesam:author" "xesam:bcc" "xesam:birthDate" "xesam:blogContactURL"
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
202 "xesam:cameraManufacturer" "xesam:cameraModel" "xesam:cc" "xesam:ccdWidth"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
203 "xesam:cellPhoneNumber" "xesam:characterCount" "xesam:charset"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
204 "xesam:colorCount" "xesam:colorSpace" "xesam:columnCount" "xesam:comment"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
205 "xesam:commentCharacterCount" "xesam:conflicts" "xesam:contactMedium"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
206 "xesam:contactName" "xesam:contactNick" "xesam:contactPhoto"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
207 "xesam:contactURL" "xesam:contains" "xesam:contenKeyword"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
208 "xesam:contentComment" "xesam:contentCreated" "xesam:contentModified"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
209 "xesam:contentType" "xesam:contributor" "xesam:copyright" "xesam:creator"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
210 "xesam:definesClass" "xesam:definesFunction" "xesam:definesGlobalVariable"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
211 "xesam:deletionTime" "xesam:depends" "xesam:description" "xesam:device"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
212 "xesam:disclaimer" "xesam:documentCategory" "xesam:duration"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
213 "xesam:emailAddress" "xesam:eventEnd" "xesam:eventLocation"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
214 "xesam:eventStart" "xesam:exposureBias" "xesam:exposureProgram"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
215 "xesam:exposureTime" "xesam:faxPhoneNumber" "xesam:fileExtension"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
216 "xesam:fileSystemType" "xesam:flashUsed" "xesam:focalLength"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
217 "xesam:focusDistance" "xesam:formatSubtype" "xesam:frameCount"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
218 "xesam:frameRate" "xesam:freeSpace" "xesam:gender" "xesam:generator"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
219 "xesam:generatorOptions" "xesam:group" "xesam:hash" "xesam:hash"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
220 "xesam:height" "xesam:homeEmailAddress" "xesam:homePhoneNumber"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
221 "xesam:homePostalAddress" "xesam:homepageContactURL"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
222 "xesam:horizontalResolution" "xesam:icqContactMedium" "xesam:id"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
223 "xesam:imContactMedium" "xesam:interests" "xesam:interlaceMode"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
224 "xesam:isEncrypted" "xesam:isImportant" "xesam:isInProgress"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
225 "xesam:isPasswordProtected" "xesam:isRead" "xesam:isoEquivalent"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
226 "xesam:jabberContactMedium" "xesam:keyword" "xesam:language" "xesam:legal"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
227 "xesam:license" "xesam:licenseType" "xesam:lineCount" "xesam:links"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
228 "xesam:mailingPostalAddress" "xesam:maintainer" "xesam:md5Hash"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
229 "xesam:mediaCodec" "xesam:mediaCodecBitrate" "xesam:mediaCodecType"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
230 "xesam:meteringMode" "xesam:mimeType" "xesam:mountPoint"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
231 "xesam:msnContactMedium" "xesam:name" "xesam:occupiedSpace"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
232 "xesam:orientation" "xesam:originalLocation" "xesam:owner"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
233 "xesam:pageCount" "xesam:permissions" "xesam:phoneNumber"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
234 "xesam:physicalAddress" "xesam:pixelFormat" "xesam:primaryRecipient"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
235 "xesam:programmingLanguage" "xesam:rating" "xesam:receptionTime"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
236 "xesam:recipient" "xesam:related" "xesam:remoteUser" "xesam:rowCount"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
237 "xesam:sampleBitDepth" "xesam:sampleFormat" "xesam:secondaryRecipient"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
238 "xesam:sha1Hash" "xesam:size" "xesam:skypeContactMedium"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
239 "xesam:sourceCreated" "xesam:sourceModified" "xesam:storageSize"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
240 "xesam:subject" "xesam:supercedes" "xesam:title" "xesam:to"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
241 "xesam:totalSpace" "xesam:totalUncompressedSize" "xesam:url"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
242 "xesam:usageIntensity" "xesam:userComment" "xesam:userKeyword"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
243 "xesam:uuid" "xesam:version" "xesam:verticalResolution" "xesam:videoBirate"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
244 "xesam:videoCodec" "xesam:videoCodecType" "xesam:whiteBalance"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
245 "xesam:width" "xesam:wordCount" "xesam:workEmailAddress"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
246 "xesam:workPhoneNumber" "xesam:workPostalAddress"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
247 "xesam:yahooContactMedium")
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
248 "All fields from the Xesam Core Ontology.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
249 This defconst can be used to check for a new search engine, which
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
250 fields are supported.")
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
251
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
252 (defconst xesam-user-query
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
253 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
254 <request xmlns=\"http://freedesktop.org/standards/xesam/1.0/query\">
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
255 <userQuery>
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
256 %s
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
257 </userQuery>
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
258 </request>"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
259 "The Xesam user query XML.")
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
260
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
261 (defconst xesam-fulltext-query
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
262 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
263 <request xmlns=\"http://freedesktop.org/standards/xesam/1.0/query\">
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
264 <query content=\"xesam:Document\" source=\"xesam:File\">
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
265 <fullText>
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
266 <string>%s</string>
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
267 </fullText>
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
268 </query>
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
269 </request>"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
270 "The Xesam fulltext query XML.")
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
271
97214
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
272 (defvar xesam-dbus-unique-names
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
273 (list (cons :system (dbus-get-unique-name :system))
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
274 (cons :session (dbus-get-unique-name :session)))
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
275 "The unique names, under which Emacs is registered at D-Bus.")
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
276
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
277 (defun xesam-dbus-call-method (&rest args)
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
278 "Apply a D-Bus method call.
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
279 `dbus-call-method' is to be preferred, because it is more
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
280 performant. If the target D-Bus service is owned by Emacs, this
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
281 is not applicable, and `dbus-call-method-non-blocking' must be
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
282 used instead. ARGS are identical to the argument list of both
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
283 functions."
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
284 (apply
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
285 ;; The first argument is the bus, the second argument the targt service.
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
286 (if (string-equal (cdr (assoc (car args) xesam-dbus-unique-names))
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
287 (cadr args))
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
288 'dbus-call-method-non-blocking 'dbus-call-method)
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
289 args))
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
290
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
291 (defun xesam-get-property (engine property)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
292 "Return the PROPERTY value of ENGINE."
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
293 ;; "GetProperty" returns a variant, so we must use the car.
97214
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
294 (car (xesam-dbus-call-method
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
295 :session (car engine) xesam-path-search
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
296 xesam-interface-search "GetProperty"
97214
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
297 (xesam-get-cached-property engine "session") property)))
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
298
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
299 (defun xesam-set-property (engine property value)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
300 "Set the PROPERTY of ENGINE to VALUE.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
301 VALUE can be a string, a non-negative integer, a boolean
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
302 value (nil or t), or a list of them. It returns the new value of
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
303 PROPERTY in the search engine. This new value can be different
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
304 from VALUE, depending on what the search engine accepts."
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
305 ;; "SetProperty" returns a variant, so we must use the car.
97214
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
306 (car (xesam-dbus-call-method
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
307 :session (car engine) xesam-path-search
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
308 xesam-interface-search "SetProperty"
97214
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
309 (xesam-get-cached-property engine "session") property
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
310 ;; The value must be a variant. It can be only a string, an
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
311 ;; unsigned int, a boolean, or an array of them. So we need
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
312 ;; no type keyword; we let the type check to the search
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
313 ;; engine.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
314 (list :variant value))))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
315
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
316 (defvar xesam-minibuffer-vendor-history nil
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
317 "Interactive vendor history.")
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
318
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
319 (defvar xesam-minibuffer-query-history nil
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
320 "Interactive query history.")
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
321
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
322 ;; Pacify byte compiler.
97517
352b14f1dab0 * net/xesam.el (xesam-vendor, xesam-notify-function): New local
Michael Albinus <michael.albinus@gmx.de>
parents: 97455
diff changeset
323 (defvar xesam-vendor nil)
352b14f1dab0 * net/xesam.el (xesam-vendor, xesam-notify-function): New local
Michael Albinus <michael.albinus@gmx.de>
parents: 97455
diff changeset
324 (make-variable-buffer-local 'xesam-vendor)
352b14f1dab0 * net/xesam.el (xesam-vendor, xesam-notify-function): New local
Michael Albinus <michael.albinus@gmx.de>
parents: 97455
diff changeset
325 (put 'xesam-vendor 'permanent-local t)
352b14f1dab0 * net/xesam.el (xesam-vendor, xesam-notify-function): New local
Michael Albinus <michael.albinus@gmx.de>
parents: 97455
diff changeset
326
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
327 (defvar xesam-engine nil)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
328 (defvar xesam-search nil)
97170
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
329 (defvar xesam-type nil)
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
330 (defvar xesam-query nil)
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
331 (defvar xesam-xml-string nil)
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
332 (defvar xesam-objects nil)
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
333 (defvar xesam-current nil)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
334 (defvar xesam-count nil)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
335 (defvar xesam-to nil)
97517
352b14f1dab0 * net/xesam.el (xesam-vendor, xesam-notify-function): New local
Michael Albinus <michael.albinus@gmx.de>
parents: 97455
diff changeset
336 (defvar xesam-notify-function nil)
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
337 (defvar xesam-refreshing nil)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
338
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
339
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
340 ;;; Search engines.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
341
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
342 (defvar xesam-search-engines nil
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
343 "List of available Xesam search engines.
97214
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
344 Every entry is an association list, with a car denoting the
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
345 unique D-Bus service name of the engine. The rest of the entry
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
346 are cached associations of engine attributes, like the session
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
347 identifier, and the display name. Example:
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
348
97214
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
349 \(\(\":1.59\"
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
350 \(\"session\" . \"0t1214948020ut358230u0p2698r3912347765k3213849828\")
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
351 \(\"vendor.display\" . \"Tracker Xesam Service\"))
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
352 \(\":1.27\"
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
353 \(\"session\" . \"strigisession1369133069\")
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
354 \(\"vendor.display\" . \"Strigi Desktop Search\")))
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
355
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
356 A Xesam-compatible search engine is identified as a queued D-Bus
97214
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
357 service of the known service `xesam-service-search'.")
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
358
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
359 (defun xesam-get-cached-property (engine property)
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
360 "Return the PROPERTY value of ENGINE from the cache.
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
361 If PROPERTY is not existing, retrieve it from ENGINE first."
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
362 ;; If the property has not been cached yet, we retrieve it from the
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
363 ;; engine, and cache it.
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
364 (unless (assoc property engine)
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
365 (xesam-set-cached-property
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
366 engine property (xesam-get-property engine property)))
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
367 (cdr (assoc property engine)))
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
368
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
369 (defun xesam-set-cached-property (engine property value)
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
370 "Set the PROPERTY of ENGINE to VALUE in the cache."
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
371 (setcdr engine (append (cdr engine) (list (cons property value)))))
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
372
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
373 (defun xesam-delete-search-engine (&rest args)
97214
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
374 "Remove service from `xesam-search-engines'."
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
375 (setq xesam-search-engines
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
376 (delete (assoc (car args) xesam-search-engines) xesam-search-engines)))
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
377
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
378 (defun xesam-search-engines ()
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
379 "Return Xesam search engines, stored in `xesam-search-engines'.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
380 The first search engine is the name owner of `xesam-service-search'.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
381 If there is no registered search engine at all, the function returns `nil'."
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
382 (let ((services (dbus-ignore-errors
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
383 (dbus-list-queued-owners
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
384 :session xesam-service-search)))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
385 engine vendor-id hit-fields)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
386 (dolist (service services)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
387 (unless (assoc-string service xesam-search-engines)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
388
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
389 ;; Open a new session, and add it to the search engines list.
97214
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
390 (add-to-list 'xesam-search-engines (list service) 'append)
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
391 (setq engine (assoc service xesam-search-engines))
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
392
97214
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
393 ;; Add the session string.
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
394 (xesam-set-cached-property
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
395 engine "session"
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
396 (xesam-dbus-call-method
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
397 :session service xesam-path-search
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
398 xesam-interface-search "NewSession"))
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
399
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
400 ;; Unset the "search.live" property; we don't want to be
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
401 ;; informed by changed results.
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
402 (xesam-set-property engine "search.live" nil)
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
403
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
404 ;; Check the vendor properties.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
405 (setq vendor-id (xesam-get-property engine "vendor.id")
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
406 hit-fields (xesam-get-property engine "hit.fields"))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
407
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
408 ;; Ususally, `hit.fields' shall describe supported fields.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
409 ;; That is not the case now, so we set it ourselves.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
410 ;; Hopefully, this will change later.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
411 (setq hit-fields
97399
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
412 (case (intern vendor-id)
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
413 ('Beagle
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
414 '("xesam:mimeType" "xesam:url"))
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
415 ('Strigi
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
416 '("xesam:author" "xesam:cc" "xesam:charset"
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
417 "xesam:contentType" "xesam:fileExtension"
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
418 "xesam:id" "xesam:lineCount" "xesam:links"
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
419 "xesam:mimeType" "xesam:name" "xesam:size"
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
420 "xesam:sourceModified" "xesam:subject" "xesam:to"
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
421 "xesam:url"))
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
422 ('TrackerXesamSession
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
423 '("xesam:relevancyRating" "xesam:url"))
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
424 ('Debbugs
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
425 '("xesam:keyword" "xesam:owner" "xesam:title"
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
426 "xesam:url" "xesam:sourceModified" "xesam:mimeType"
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
427 "debbugs:key"))
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
428 ;; xesam-tools yahoo service.
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
429 (t '("xesam:contentModified" "xesam:mimeType" "xesam:summary"
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
430 "xesam:title" "xesam:url" "yahoo:displayUrl"))))
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
431
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
432 (xesam-set-property engine "hit.fields" hit-fields)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
433 (xesam-set-property engine "hit.fields.extended" '("xesam:snippet"))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
434
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
435 ;; Let us notify, when the search engine disappears.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
436 (dbus-register-signal
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
437 :session dbus-service-dbus dbus-path-dbus
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
438 dbus-interface-dbus "NameOwnerChanged"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
439 'xesam-delete-search-engine service))))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
440 xesam-search-engines)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
441
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
442
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
443 ;;; Search buffers.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
444
97170
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
445 (define-derived-mode xesam-mode nil "Xesam"
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
446 "Major mode for presenting search results of a Xesam search.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
447 In this mode, widgets represent the search results.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
448
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
449 \\{xesam-mode-map}
97517
352b14f1dab0 * net/xesam.el (xesam-vendor, xesam-notify-function): New local
Michael Albinus <michael.albinus@gmx.de>
parents: 97455
diff changeset
450 Turning on Xesam mode runs the normal hook `xesam-mode-hook'. It
352b14f1dab0 * net/xesam.el (xesam-vendor, xesam-notify-function): New local
Michael Albinus <michael.albinus@gmx.de>
parents: 97455
diff changeset
451 can be used to set `xesam-notify-function', which must a search
352b14f1dab0 * net/xesam.el (xesam-vendor, xesam-notify-function): New local
Michael Albinus <michael.albinus@gmx.de>
parents: 97455
diff changeset
452 engine specific, widget :notify function to visualize xesam:url."
352b14f1dab0 * net/xesam.el (xesam-vendor, xesam-notify-function): New local
Michael Albinus <michael.albinus@gmx.de>
parents: 97455
diff changeset
453 (set (make-local-variable 'xesam-notify-function) nil)
352b14f1dab0 * net/xesam.el (xesam-vendor, xesam-notify-function): New local
Michael Albinus <michael.albinus@gmx.de>
parents: 97455
diff changeset
454
97170
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
455 ;; Keymap.
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
456 (setq xesam-mode-map (copy-keymap special-mode-map))
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
457 (set-keymap-parent xesam-mode-map widget-keymap)
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
458 (define-key xesam-mode-map "z" 'kill-this-buffer)
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
459
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
460 ;; Maybe we implement something useful, later on.
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
461 (set (make-local-variable 'revert-buffer-function) 'ignore)
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
462 ;; `xesam-engine', `xesam-search', `xesam-type', `xesam-query', and
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
463 ;; `xesam-xml-string' will be set in `xesam-new-search'.
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
464 (set (make-local-variable 'xesam-engine) nil)
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
465 (set (make-local-variable 'xesam-search) nil)
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
466 (set (make-local-variable 'xesam-type) "")
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
467 (set (make-local-variable 'xesam-query) "")
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
468 (set (make-local-variable 'xesam-xml-string) "")
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
469 (set (make-local-variable 'xesam-objects) nil)
97170
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
470 ;; `xesam-current' is the last hit put into the search buffer,
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
471 (set (make-local-variable 'xesam-current) 0)
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
472 ;; `xesam-count' is the number of hits reported by the search engine.
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
473 (set (make-local-variable 'xesam-count) 0)
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
474 ;; `xesam-to' is the upper hit number to be presented.
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
475 (set (make-local-variable 'xesam-to) xesam-hits-per-page)
97517
352b14f1dab0 * net/xesam.el (xesam-vendor, xesam-notify-function): New local
Michael Albinus <michael.albinus@gmx.de>
parents: 97455
diff changeset
476 ;; `xesam-notify-function' can be a search engine specific function
352b14f1dab0 * net/xesam.el (xesam-vendor, xesam-notify-function): New local
Michael Albinus <michael.albinus@gmx.de>
parents: 97455
diff changeset
477 ;; to visualize xesam:url. It can be overwritten in `xesam-mode'.
352b14f1dab0 * net/xesam.el (xesam-vendor, xesam-notify-function): New local
Michael Albinus <michael.albinus@gmx.de>
parents: 97455
diff changeset
478 (set (make-local-variable 'xesam-notify-function) nil)
97170
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
479 ;; `xesam-refreshing' is an indicator, whether the buffer is just
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
480 ;; being updated. Needed, because `xesam-refresh-search-buffer'
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
481 ;; can be triggered by an event.
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
482 (set (make-local-variable 'xesam-refreshing) nil)
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
483 ;; Mode line position returns hit counters.
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
484 (set (make-local-variable 'mode-line-position)
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
485 (list '(-3 "%p%")
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
486 '(10 (:eval (format " (%d/%d)" xesam-current xesam-count)))))
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
487 ;; Header line contains the query string.
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
488 (set (make-local-variable 'header-line-format)
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
489 (list '(20
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
490 (:eval
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
491 (list "Type: "
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
492 (propertize xesam-type 'face 'xesam-mode-line))))
97170
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
493 '(10
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
494 (:eval
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
495 (list " Query: "
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
496 (propertize
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
497 xesam-query
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
498 'face 'xesam-mode-line
97214
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
499 'help-echo (when xesam-debug xesam-xml-string)))))))
97170
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
500
97038
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
501 (when (not (interactive-p))
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
502 ;; Initialize buffer.
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
503 (setq buffer-read-only t)
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
504 (let ((inhibit-read-only t))
97170
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
505 (erase-buffer))))
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
506
97170
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
507 ;; It doesn't make sense to call it interactively.
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
508 (put 'xesam-mode 'disabled t)
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
509
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
510 ;; The very first buffer created with `xesam-mode' does not have the
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
511 ;; keymap etc. So we create a dummy buffer. Stupid.
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
512 (with-temp-buffer (xesam-mode))
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
513
97618
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
514 (define-minor-mode xesam-minor-mode
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
515 "Toggle Xesam minor mode.
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
516 With no argument, this command toggles the mode.
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
517 Non-null prefix argument turns on the mode.
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
518 Null prefix argument turns off the mode.
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
519
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
520 When Xesam minor mode is enabled, all text which matches a
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
521 previous Xesam query in this buffer is highlighted."
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
522 :group 'xesam
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
523 :init-value nil
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
524 :lighter " Xesam"
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
525 (when (local-variable-p 'xesam-query)
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
526 ;; Run only if the buffer is related to a Xesam search.
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
527 (save-excursion
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
528 (if xesam-minor-mode
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
529 ;; Highlight hits.
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
530 (let ((query-regexp (regexp-opt (split-string xesam-query nil t) t))
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
531 (case-fold-search t))
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
532 ;; I have no idea whether people will like setting
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
533 ;; `isearch-case-fold-search' and `query-regexp'. Maybe
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
534 ;; this shall be controlled by a custom option.
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
535 (unless isearch-case-fold-search (isearch-toggle-case-fold))
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
536 (isearch-update-ring query-regexp t)
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
537 ;; Create overlays.
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
538 (goto-char (point-min))
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
539 (while (re-search-forward query-regexp nil t)
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
540 (overlay-put
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
541 (make-overlay
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
542 (match-beginning 0) (match-end 0)) 'face 'xesam-highlight)))
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
543 ;; Remove overlays.
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
544 (dolist (ov (overlays-in (point-min) (point-max)))
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
545 (delete-overlay ov))))))
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
546
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
547 (defun xesam-buffer-name (service search)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
548 "Return the buffer name where to present search results.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
549 SERVICE is the D-Bus unique service name of the Xesam search engine.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
550 SEARCH is the search identification in that engine. Both must be strings."
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
551 (format "*%s/%s*" service search))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
552
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
553 (defun xesam-highlight-string (string)
97572
9fb28094a3cf * net/xesam.el (xesam-highlight-string): Precise doc string.
Michael Albinus <michael.albinus@gmx.de>
parents: 97517
diff changeset
554 "Highlight text enclosed by <b> and </b>.
9fb28094a3cf * net/xesam.el (xesam-highlight-string): Precise doc string.
Michael Albinus <michael.albinus@gmx.de>
parents: 97517
diff changeset
555 Return propertized STRING."
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
556 (while (string-match "\\(.*\\)\\(<b>\\)\\(.*\\)\\(</b>\\)\\(.*\\)" string)
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
557 (setq string
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
558 (format
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
559 "%s%s%s"
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
560 (match-string 1 string)
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
561 (propertize (match-string 3 string) 'face 'xesam-highlight)
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
562 (match-string 5 string))))
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
563 string)
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
564
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
565 (defun xesam-refresh-entry (engine entry)
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
566 "Refreshes one entry in the search buffer."
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
567 (let* ((result (nth (1- xesam-current) xesam-objects))
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
568 widget)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
569
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
570 ;; Create widget.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
571 (setq widget (widget-convert 'link))
97038
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
572 (when xesam-debug
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
573 (widget-put widget :help-echo ""))
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
574
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
575 ;; Take all results.
97214
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
576 (dolist (field (xesam-get-cached-property engine "hit.fields"))
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
577 (when (cond
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
578 ((stringp (caar result)) (not (zerop (length (caar result)))))
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
579 ((numberp (caar result)) (not (zerop (caar result))))
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
580 ((caar result) t))
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
581 (when xesam-debug
97038
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
582 (widget-put
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
583 widget :help-echo
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
584 (format "%s%s: %s\n"
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
585 (widget-get widget :help-echo) field (caar result))))
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
586 (widget-put widget (intern (concat ":" field)) (caar result)))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
587 (setq result (cdr result)))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
588
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
589 ;; Strigi doesn't return URLs in xesam:url. We must fix this.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
590 (when
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
591 (not (url-type (url-generic-parse-url (widget-get widget :xesam:url))))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
592 (widget-put
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
593 widget :xesam:url (concat "file://" (widget-get widget :xesam:url))))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
594
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
595 ;; Strigi returns xesam:size as string. We must fix this.
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
596 (when (and (widget-member widget :xesam:size)
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
597 (stringp (widget-get widget :xesam:size)))
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
598 (widget-put
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
599 widget :xesam:size (string-to-number (widget-get widget :xesam:url))))
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
600
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
601 ;; First line: :tag.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
602 (cond
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
603 ((widget-member widget :xesam:title)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
604 (widget-put widget :tag (widget-get widget :xesam:title)))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
605 ((widget-member widget :xesam:subject)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
606 (widget-put widget :tag (widget-get widget :xesam:subject)))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
607 ((widget-member widget :xesam:mimeType)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
608 (widget-put widget :tag (widget-get widget :xesam:mimeType)))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
609 ((widget-member widget :xesam:name)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
610 (widget-put widget :tag (widget-get widget :xesam:name))))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
611
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
612 ;; Highlight the search items.
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
613 (when (widget-member widget :tag)
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
614 (widget-put
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
615 widget :tag (xesam-highlight-string (widget-get widget :tag))))
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
616
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
617 ;; Last Modified.
97572
9fb28094a3cf * net/xesam.el (xesam-highlight-string): Precise doc string.
Michael Albinus <michael.albinus@gmx.de>
parents: 97517
diff changeset
618 (when (and (widget-member widget :xesam:sourceModified)
9fb28094a3cf * net/xesam.el (xesam-highlight-string): Precise doc string.
Michael Albinus <michael.albinus@gmx.de>
parents: 97517
diff changeset
619 (not
9fb28094a3cf * net/xesam.el (xesam-highlight-string): Precise doc string.
Michael Albinus <michael.albinus@gmx.de>
parents: 97517
diff changeset
620 (zerop
9fb28094a3cf * net/xesam.el (xesam-highlight-string): Precise doc string.
Michael Albinus <michael.albinus@gmx.de>
parents: 97517
diff changeset
621 (string-to-number (widget-get widget :xesam:sourceModified)))))
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
622 (widget-put
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
623 widget :tag
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
624 (format
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
625 "%s\nLast Modified: %s"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
626 (or (widget-get widget :tag) "")
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
627 (format-time-string
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
628 "%d %B %Y, %T"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
629 (seconds-to-time
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
630 (string-to-number (widget-get widget :xesam:sourceModified)))))))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
631
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
632 ;; Second line: :value.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
633 (widget-put widget :value (widget-get widget :xesam:url))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
634
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
635 (cond
97517
352b14f1dab0 * net/xesam.el (xesam-vendor, xesam-notify-function): New local
Michael Albinus <michael.albinus@gmx.de>
parents: 97455
diff changeset
636 ;; A search engine can set `xesam-notify-function' via
352b14f1dab0 * net/xesam.el (xesam-vendor, xesam-notify-function): New local
Michael Albinus <michael.albinus@gmx.de>
parents: 97455
diff changeset
637 ;; `xesam-mode-hooks'.
352b14f1dab0 * net/xesam.el (xesam-vendor, xesam-notify-function): New local
Michael Albinus <michael.albinus@gmx.de>
parents: 97455
diff changeset
638 (xesam-notify-function
352b14f1dab0 * net/xesam.el (xesam-vendor, xesam-notify-function): New local
Michael Albinus <michael.albinus@gmx.de>
parents: 97455
diff changeset
639 (widget-put widget :notify xesam-notify-function))
352b14f1dab0 * net/xesam.el (xesam-vendor, xesam-notify-function): New local
Michael Albinus <michael.albinus@gmx.de>
parents: 97455
diff changeset
640
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
641 ;; In case of HTML, we use a URL link.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
642 ((and (widget-member widget :xesam:mimeType)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
643 (string-equal "text/html" (widget-get widget :xesam:mimeType)))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
644 (setcar widget 'url-link))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
645
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
646 ;; For local files, we will open the file as default action.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
647 ((string-match "file"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
648 (url-type (url-generic-parse-url
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
649 (widget-get widget :xesam:url))))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
650 (widget-put
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
651 widget :notify
97455
a5d0ee62856d * net/xesam.el (xesam-refresh-entry): Use `save-excursion' in the
Michael Albinus <michael.albinus@gmx.de>
parents: 97399
diff changeset
652 (lambda (widget &rest ignore)
97572
9fb28094a3cf * net/xesam.el (xesam-highlight-string): Precise doc string.
Michael Albinus <michael.albinus@gmx.de>
parents: 97517
diff changeset
653 (let ((query xesam-query))
9fb28094a3cf * net/xesam.el (xesam-highlight-string): Precise doc string.
Michael Albinus <michael.albinus@gmx.de>
parents: 97517
diff changeset
654 (find-file
9fb28094a3cf * net/xesam.el (xesam-highlight-string): Precise doc string.
Michael Albinus <michael.albinus@gmx.de>
parents: 97517
diff changeset
655 (url-filename (url-generic-parse-url (widget-value widget))))
97618
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
656 (set (make-local-variable 'xesam-query) query)
1f7e10e015fd * net/xesam.el (xesam-minor-mode): New minor mode.
Michael Albinus <michael.albinus@gmx.de>
parents: 97572
diff changeset
657 (xesam-minor-mode 1))))
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
658 (widget-put
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
659 widget :value
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
660 (url-filename (url-generic-parse-url (widget-get widget :xesam:url))))))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
661
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
662 ;; Third line: :doc.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
663 (cond
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
664 ((widget-member widget :xesam:summary)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
665 (widget-put widget :doc (widget-get widget :xesam:summary)))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
666 ((widget-member widget :xesam:snippet)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
667 (widget-put widget :doc (widget-get widget :xesam:snippet))))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
668
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
669 (when (widget-member widget :doc)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
670 (with-temp-buffer
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
671 (insert
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
672 (xesam-highlight-string (widget-get widget :doc)))
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
673 (fill-region-as-paragraph (point-min) (point-max))
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
674 (widget-put widget :doc (buffer-string)))
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
675 (widget-put widget :help-echo (widget-get widget :doc)))
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
676
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
677 ;; Format the widget.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
678 (widget-put
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
679 widget :format
97038
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
680 (format "%d. %s%%[%%v%%]\n%s\n" xesam-current
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
681 (if (widget-member widget :tag) "%{%t%}\n" "")
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
682 (if (widget-member widget :doc) "%h" "")))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
683
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
684 ;; Write widget.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
685 (goto-char (point-max))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
686 (widget-default-create widget)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
687 (set-buffer-modified-p nil)
97038
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
688 (force-mode-line-update)
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
689 (redisplay)))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
690
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
691 (defun xesam-get-hits (engine search hits)
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
692 "Retrieve hits from ENGINE."
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
693 (with-current-buffer (xesam-buffer-name (car engine) search)
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
694 (setq xesam-objects
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
695 (append xesam-objects
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
696 (xesam-dbus-call-method
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
697 :session (car engine) xesam-path-search
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
698 xesam-interface-search "GetHits" search hits)))))
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
699
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
700 (defun xesam-refresh-search-buffer (engine search)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
701 "Refreshes the buffer, presenting results of SEARCH."
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
702 (with-current-buffer (xesam-buffer-name (car engine) search)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
703 ;; Work only if nobody else is here.
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
704 (unless (or xesam-refreshing (>= xesam-current xesam-to))
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
705 (setq xesam-refreshing t)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
706 (unwind-protect
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
707 (let (widget)
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
708
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
709 ;; Retrieve needed hits for visualization.
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
710 (while (> (min xesam-to xesam-count) (length xesam-objects))
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
711 (xesam-get-hits
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
712 engine search
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
713 (min xesam-hits-per-page
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
714 (- (min xesam-to xesam-count) (length xesam-objects)))))
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
715
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
716 ;; Add all result widgets.
97038
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
717 (while (< xesam-current (min xesam-to xesam-count))
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
718 (setq xesam-current (1+ xesam-current))
97038
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
719 (xesam-refresh-entry engine search))
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
720
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
721 ;; Add "NEXT" widget.
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
722 (when (> xesam-count xesam-to)
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
723 (goto-char (point-max))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
724 (widget-create
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
725 'link
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
726 :notify
97455
a5d0ee62856d * net/xesam.el (xesam-refresh-entry): Use `save-excursion' in the
Michael Albinus <michael.albinus@gmx.de>
parents: 97399
diff changeset
727 (lambda (widget &rest ignore)
a5d0ee62856d * net/xesam.el (xesam-refresh-entry): Use `save-excursion' in the
Michael Albinus <michael.albinus@gmx.de>
parents: 97399
diff changeset
728 (setq xesam-to (+ xesam-to xesam-hits-per-page))
a5d0ee62856d * net/xesam.el (xesam-refresh-entry): Use `save-excursion' in the
Michael Albinus <michael.albinus@gmx.de>
parents: 97399
diff changeset
729 (widget-delete widget)
a5d0ee62856d * net/xesam.el (xesam-refresh-entry): Use `save-excursion' in the
Michael Albinus <michael.albinus@gmx.de>
parents: 97399
diff changeset
730 (xesam-refresh-search-buffer xesam-engine xesam-search))
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
731 "NEXT")
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
732 (widget-beginning-of-line))
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
733
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
734 ;; Prefetch next hits.
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
735 (when (> (min (+ xesam-hits-per-page xesam-to) xesam-count)
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
736 (length xesam-objects))
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
737 (xesam-get-hits
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
738 engine search
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
739 (min xesam-hits-per-page
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
740 (- (min (+ xesam-hits-per-page xesam-to) xesam-count)
97455
a5d0ee62856d * net/xesam.el (xesam-refresh-entry): Use `save-excursion' in the
Michael Albinus <michael.albinus@gmx.de>
parents: 97399
diff changeset
741 (length xesam-objects)))))
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
742
97399
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
743 ;; Add "DONE" widget.
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
744 (when (= xesam-current xesam-count)
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
745 (goto-char (point-max))
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
746 (widget-create 'link :notify 'ignore "DONE")
97455
a5d0ee62856d * net/xesam.el (xesam-refresh-entry): Use `save-excursion' in the
Michael Albinus <michael.albinus@gmx.de>
parents: 97399
diff changeset
747 (widget-beginning-of-line)))
97399
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
748
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
749 ;; Return with save settings.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
750 (setq xesam-refreshing nil)))))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
751
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
752
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
753 ;;; Search functions.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
754
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
755 (defun xesam-signal-handler (&rest args)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
756 "Handles the different D-Bus signals of a Xesam search."
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
757 (let* ((service (dbus-event-service-name last-input-event))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
758 (member (dbus-event-member-name last-input-event))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
759 (search (nth 0 args))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
760 (buffer (xesam-buffer-name service search)))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
761
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
762 (when (get-buffer buffer)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
763 (with-current-buffer buffer
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
764 (cond
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
765
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
766 ((string-equal member "HitsAdded")
97038
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
767 (setq xesam-count (+ xesam-count (nth 1 args)))
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
768 ;; We use `run-at-time' in order to not block the event queue.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
769 (run-at-time
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
770 0 nil
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
771 'xesam-refresh-search-buffer
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
772 (assoc service xesam-search-engines) search))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
773
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
774 ((string-equal member "SearchDone")
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
775 (setq mode-line-process
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
776 (propertize " Done" 'face 'xesam-mode-line))
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
777 (force-mode-line-update)))))))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
778
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
779 (defun xesam-kill-buffer-function ()
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
780 "Send the CloseSearch indication."
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
781 (when (and (eq major-mode 'xesam-mode) (stringp xesam-search))
97802
48c669cb45f9 * net/xesam.el (xesam-kill-buffer-function): Wrap code by
Michael Albinus <michael.albinus@gmx.de>
parents: 97618
diff changeset
782 (ignore-errors ;; The D-Bus service could have disappeared.
48c669cb45f9 * net/xesam.el (xesam-kill-buffer-function): Wrap code by
Michael Albinus <michael.albinus@gmx.de>
parents: 97618
diff changeset
783 (xesam-dbus-call-method
48c669cb45f9 * net/xesam.el (xesam-kill-buffer-function): Wrap code by
Michael Albinus <michael.albinus@gmx.de>
parents: 97618
diff changeset
784 :session (car xesam-engine) xesam-path-search
48c669cb45f9 * net/xesam.el (xesam-kill-buffer-function): Wrap code by
Michael Albinus <michael.albinus@gmx.de>
parents: 97618
diff changeset
785 xesam-interface-search "CloseSearch" xesam-search))))
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
786
97170
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
787 (defun xesam-new-search (engine type query)
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
788 "Create a new search session.
97170
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
789 ENGINE identifies the search engine. TYPE is the query type, it
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
790 can be either `fulltext-query', or `user-query'. QUERY is a
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
791 string in the Xesam query language. A string, identifying the
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
792 search, is returned."
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
793 (let* ((service (car engine))
97214
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
794 (session (xesam-get-cached-property engine "session"))
97170
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
795 (xml-string
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
796 (format
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
797 (if (eq type 'user-query) xesam-user-query xesam-fulltext-query)
97455
a5d0ee62856d * net/xesam.el (xesam-refresh-entry): Use `save-excursion' in the
Michael Albinus <michael.albinus@gmx.de>
parents: 97399
diff changeset
798 (url-insert-entities-in-string query)))
97214
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
799 (search (xesam-dbus-call-method
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
800 :session service xesam-path-search
97170
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
801 xesam-interface-search "NewSearch" session xml-string)))
97038
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
802
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
803 ;; Let us notify for relevant signals. We ignore "HitsRemoved",
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
804 ;; "HitsModified" and "StateChanged"; there is nothing to do for
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
805 ;; us.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
806 (dbus-register-signal
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
807 :session service xesam-path-search
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
808 xesam-interface-search "HitsAdded"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
809 'xesam-signal-handler search)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
810 (dbus-register-signal
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
811 :session service xesam-path-search
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
812 xesam-interface-search "SearchDone"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
813 'xesam-signal-handler search)
97038
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
814
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
815 ;; Create the search buffer.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
816 (with-current-buffer
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
817 (generate-new-buffer (xesam-buffer-name service search))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
818 (switch-to-buffer-other-window (current-buffer))
97517
352b14f1dab0 * net/xesam.el (xesam-vendor, xesam-notify-function): New local
Michael Albinus <michael.albinus@gmx.de>
parents: 97455
diff changeset
819 ;; Inialize buffer with `xesam-mode'. `xesam-vendor' must be
352b14f1dab0 * net/xesam.el (xesam-vendor, xesam-notify-function): New local
Michael Albinus <michael.albinus@gmx.de>
parents: 97455
diff changeset
820 ;; set before calling `xesam-mode', because we want to give the
352b14f1dab0 * net/xesam.el (xesam-vendor, xesam-notify-function): New local
Michael Albinus <michael.albinus@gmx.de>
parents: 97455
diff changeset
821 ;; hook functions a chance to identify their search engine.
352b14f1dab0 * net/xesam.el (xesam-vendor, xesam-notify-function): New local
Michael Albinus <michael.albinus@gmx.de>
parents: 97455
diff changeset
822 (setq xesam-vendor (xesam-get-cached-property engine "vendor.id"))
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
823 (xesam-mode)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
824 (setq xesam-engine engine
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
825 xesam-search search
97170
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
826 ;; `xesam-type', `xesam-query' and `xesam-xml-string'
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
827 ;; are displayed in the header line.
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
828 xesam-type (symbol-name type)
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
829 xesam-query query
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
830 xesam-xml-string xml-string
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
831 xesam-objects nil
97038
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
832 ;; The buffer identification shall indicate the search
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
833 ;; engine. The `help-echo' property is used for debug
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
834 ;; information, when applicable.
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
835 mode-line-buffer-identification
97038
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
836 (if (not xesam-debug)
97517
352b14f1dab0 * net/xesam.el (xesam-vendor, xesam-notify-function): New local
Michael Albinus <michael.albinus@gmx.de>
parents: 97455
diff changeset
837 (list 12 (propertized-buffer-identification xesam-vendor))
97038
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
838 (propertize
97517
352b14f1dab0 * net/xesam.el (xesam-vendor, xesam-notify-function): New local
Michael Albinus <michael.albinus@gmx.de>
parents: 97455
diff changeset
839 xesam-vendor
97214
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
840 'help-echo
97038
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
841 (mapconcat
97455
a5d0ee62856d * net/xesam.el (xesam-refresh-entry): Use `save-excursion' in the
Michael Albinus <michael.albinus@gmx.de>
parents: 97399
diff changeset
842 (lambda (x)
a5d0ee62856d * net/xesam.el (xesam-refresh-entry): Use `save-excursion' in the
Michael Albinus <michael.albinus@gmx.de>
parents: 97399
diff changeset
843 (format "%s: %s" x (xesam-get-cached-property engine x)))
97038
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
844 '("vendor.id" "vendor.version" "vendor.display" "vendor.xesam"
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
845 "vendor.ontology.fields" "vendor.ontology.contents"
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
846 "vendor.ontology.sources" "vendor.extensions"
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
847 "vendor.ontologies" "vendor.maxhits")
97170
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
848 "\n"))))
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
849 (add-hook 'kill-buffer-hook 'xesam-kill-buffer-function)
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
850 (force-mode-line-update))
97170
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
851
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
852 ;; Start the search.
97214
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
853 (xesam-dbus-call-method
97170
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
854 :session (car engine) xesam-path-search
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
855 xesam-interface-search "StartSearch" search)
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
856
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
857 ;; Return search id.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
858 search))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
859
97399
7806c35019cb * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
Michael Albinus <michael.albinus@gmx.de>
parents: 97381
diff changeset
860 ;;;###autoload
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
861 (defun xesam-search (engine query)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
862 "Perform an interactive search.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
863 ENGINE is the Xesam search engine to be applied, it must be one of the
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
864 entries of `xesam-search-engines'. QUERY is the search string in the
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
865 Xesam user query language. If the search engine does not support
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
866 the Xesam user query language, a Xesam fulltext search is applied.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
867
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
868 The default search engine is the first entry in `xesam-search-engines'.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
869 Example:
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
870
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
871 (xesam-search (car (xesam-search-engines)) \"emacs\")"
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
872 (interactive
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
873 (let* ((vendors (mapcar
97455
a5d0ee62856d * net/xesam.el (xesam-refresh-entry): Use `save-excursion' in the
Michael Albinus <michael.albinus@gmx.de>
parents: 97399
diff changeset
874 (lambda (x) (xesam-get-cached-property x "vendor.display"))
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
875 (xesam-search-engines)))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
876 (vendor
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
877 (if (> (length vendors) 1)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
878 (completing-read
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
879 "Enter search engine: " vendors nil t
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
880 (try-completion "" vendors) 'xesam-minibuffer-vendor-history)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
881 (car vendors))))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
882 (list
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
883 ;; ENGINE.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
884 (when vendor
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
885 (dolist (elt (xesam-search-engines) engine)
97214
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
886 (when (string-equal
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
887 (xesam-get-cached-property elt "vendor.display") vendor)
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
888 (setq engine elt))))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
889 ;; QUERY.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
890 (when vendor
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
891 (read-from-minibuffer
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
892 "Enter search string: " nil nil nil
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
893 'xesam-minibuffer-query-history)))))
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
894
97170
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
895 (if (null engine)
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
896 (message "No search engine running")
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
897 (if (zerop (length query))
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
898 (message "No query applied")
dfc12ea9589f * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New
Michael Albinus <michael.albinus@gmx.de>
parents: 97038
diff changeset
899 (xesam-new-search engine xesam-query-type query))))
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
900
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
901 (provide 'xesam)
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
902
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
903 ;;; TODO:
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
904
97572
9fb28094a3cf * net/xesam.el (xesam-highlight-string): Precise doc string.
Michael Albinus <michael.albinus@gmx.de>
parents: 97517
diff changeset
905 ;; * Buffer highlighting needs better analysis of query string.
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
906 ;; * Accept input while retrieving prefetched hits. `run-at-time'?
97214
004f6dc1c1a0 * net/xesam.el (xesam-all-fields): Remove source and content
Michael Albinus <michael.albinus@gmx.de>
parents: 97170
diff changeset
907 ;; * With prefix, let's choose search engine.
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
908 ;; * Minibuffer completion for user queries.
97038
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
909 ;; * `revert-buffer-function' implementation.
b201d17750ad * net/xesam.el (xesam-from): Remove defvar.
Michael Albinus <michael.albinus@gmx.de>
parents: 96996
diff changeset
910 ;;
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
911 ;; * Mid term
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
912 ;; - If available, use ontologies for field selection.
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
913 ;; - Search engines for Emacs bugs database, wikipedia, google,
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
914 ;; yahoo, ebay, ...
97289
6cec2902d7b8 * net/xesam.el (top): Require `wid-edit' always.
Michael Albinus <michael.albinus@gmx.de>
parents: 97214
diff changeset
915 ;; - Construct complex queries via widgets, like in mairix.el.
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
916
96996
3035988dd0b3 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 96989
diff changeset
917 ;; arch-tag: 7fb9fc6c-c2ff-4bc7-bb42-bacb80cce2b2
96989
691e8bf892cb * net/xesam.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
918 ;;; xesam.el ends here