From 5535308fffdd58ac17937d676c096fe889acb77e Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Fri, 28 Dec 2012 20:24:20 +0100 Subject: [PATCH] Restructure Put all source files in `src/' and add the `conkeror/' directory from the old project. --- Makefile | 11 ++----- conkeror/linkwave.js | 52 ++++++++++++++++++++++++++++++++ src/Makefile | 11 +++++++ convert.scm => src/convert.scm | 0 linkwave.scm => src/linkwave.scm | 0 paths.scm => src/paths.scm | 0 6 files changed, 65 insertions(+), 9 deletions(-) create mode 100644 conkeror/linkwave.js create mode 100644 src/Makefile rename convert.scm => src/convert.scm (100%) rename linkwave.scm => src/linkwave.scm (100%) rename paths.scm => src/paths.scm (100%) diff --git a/Makefile b/Makefile index c0a9ee8..6bcd90a 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,4 @@ .PHONY: all -all: linkwave convert -linkwave: linkwave.scm paths.o - csc $^ -o $@ - -convert: convert.scm paths.o - csc $^ -o $@ - -paths.o: paths.scm - csc -c $^ +all: + $(MAKE) -C src/ diff --git a/conkeror/linkwave.js b/conkeror/linkwave.js new file mode 100644 index 0000000..8ac3a52 --- /dev/null +++ b/conkeror/linkwave.js @@ -0,0 +1,52 @@ +define_variable("linkwave_program", "/home/slash/projects/nlinkwave/src/linkwave", + "The location of the linkwave executable."); + +function linkwave_add_url(I, url, title) +{ + let url_string = load_spec_uri_string(load_spec(url)); + let title = yield I.minibuffer.read($prompt="name (required): ", + $initial_value=title); + let description = yield I.minibuffer.read( + $prompt="extended description: " + ); + let tags = yield I.minibuffer.read( + $prompt="tags (comma delimited): " + ); + let command = linkwave_program + ' "' + url_string + '" "' + title + + '" "' + description + '" \'' + + tags.split(',').map(function (str) + { return str.trim(); }).join("' '") + + "'"; + yield shell_command(command); +} + +function linkwave_add(I) { + check_buffer(I.buffer, content_buffer); + let result = yield linkwave_add_url(I, I.buffer.top_frame, + I.buffer.title); + + if (!result) + I.window.minibuffer.message('Added to linkwave'); + else + I.window.minibuffer.message('Couldn\'t add to linkwave'); +} +interactive("linkwave-add", + "Bookmark a page in linkwave", + linkwave_add); + +function linkwave_add_link(I) { + check_buffer(I.buffer, content_buffer); + bo = yield read_browser_object(I); + let result = yield linkwave_add_url(I, encodeURIComponent(bo), + bo.textContent); + + if (!result) + I.window.minibuffer.message('Added to linkwave'); + else + I.window.minibuffer.message('Couldn\'t add to linkwave'); +} +interactive("linkwave-add-link", + "Bookmark a link in linkwave", + linkwave_add_link); + +provide("linkwave"); diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..c0a9ee8 --- /dev/null +++ b/src/Makefile @@ -0,0 +1,11 @@ +.PHONY: all + +all: linkwave convert +linkwave: linkwave.scm paths.o + csc $^ -o $@ + +convert: convert.scm paths.o + csc $^ -o $@ + +paths.o: paths.scm + csc -c $^ diff --git a/convert.scm b/src/convert.scm similarity index 100% rename from convert.scm rename to src/convert.scm diff --git a/linkwave.scm b/src/linkwave.scm similarity index 100% rename from linkwave.scm rename to src/linkwave.scm diff --git a/paths.scm b/src/paths.scm similarity index 100% rename from paths.scm rename to src/paths.scm