aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2013-02-12 20:44:47 +0100
committerGravatar Tom Willemsen2013-02-12 20:44:47 +0100
commita880a719e54c6f41657c57e67e49b1c2dde97792 (patch)
tree51730b76410a03edb0018a4dbb2cff74dc1be149
parent6fdc8f2f5ab88b0ce0077a2450af215992e1d23c (diff)
downloadmarkam-a880a719e54c6f41657c57e67e49b1c2dde97792.tar.gz
markam-a880a719e54c6f41657c57e67e49b1c2dde97792.zip
conkeror: Filter results with search string
When using the conkeror interface commands `find-markam-url' and `find-markam-url-new-buffer', the input is sent along to markam and it then searches the titles and tags for the input given.
-rw-r--r--conkeror/markam.js20
1 files changed, 14 insertions, 6 deletions
diff --git a/conkeror/markam.js b/conkeror/markam.js
index 8c7c2f1..f06b307 100644
--- a/conkeror/markam.js
+++ b/conkeror/markam.js
@@ -93,11 +93,20 @@ function markam_complete(input, pos, conservative)
let str = input.substring(0, pos);
var data = "", error = "", ret = [];
- var result = yield shell_command(
- markam_program + " --script",
- $fds = [{ output: async_binary_string_writer("") },
- { input: async_binary_reader(function (s) data += s || "") },
- { input: async_binary_reader(function (s) error += s || "") }]);
+ var result = 0;
+
+ if (str == "")
+ result = yield shell_command(
+ markam_program + " --script",
+ $fds = [{ output: async_binary_string_writer("") },
+ { input: async_binary_reader(function (s) data += s || "") },
+ { input: async_binary_reader(function (s) error += s || "") }]);
+ else
+ result = yield shell_command_with_argument(
+ markam_program + " --script search {}", str,
+ $fds = [{ output: async_binary_string_writer("") },
+ { input: async_binary_reader(function (s) data += s || "") },
+ { input: async_binary_reader(function (s) error += s || "") }]);
if (result != 0 || error != "")
throw new interactive_exception("result: " + result +
@@ -110,7 +119,6 @@ function markam_complete(input, pos, conservative)
let c = { count: ret.length,
get_string: function (i) ret[i][0],
get_description: function (i) ret[i][1],
- // get_value: function (i) ret[i][2],
get_input_state: function (i) [ret[i][2]] };
yield co_return(c);
}