From e4dc1824b28e00f3aa6f18201e719e1e05f6d397 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 26 Aug 2013 23:58:50 +0200 Subject: Remove js/ The conkeror interface has been moved to its own repository: [http://code.ryuslash.org/clark-conkeror/] --- Makefile | 2 +- js/Makefile | 31 ------ js/README.org | 100 ------------------- js/clark.js | 314 ---------------------------------------------------------- 4 files changed, 1 insertion(+), 446 deletions(-) delete mode 100644 js/Makefile delete mode 100644 js/README.org delete mode 100644 js/clark.js diff --git a/Makefile b/Makefile index 3cd8efd..061e018 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ export DESTDIR ?= /usr/local export INSTALL_PROGRAM = $(INSTALL) export INSTALL_DATA = $(INSTALL) -m 644 -dirs = lisp doc js +dirs = lisp doc install-dirs = $(addprefix install-,$(dirs)) uninstall-dirs = $(addprefix uninstall-,$(dirs)) install-strip-dirs = $(addprefix installstrip-,$(dirs)) diff --git a/js/Makefile b/js/Makefile deleted file mode 100644 index d808baa..0000000 --- a/js/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (C) 2013 Tom Willemsen -# -# This file is part of CLark -# -# CLark is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# CLark is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with CLark. If not, see . - -DESTDIR ?= /usr/local - -.PHONY: all install uninstall - -all: -install: clark.js - $(INSTALL_DATA) clark.js \ - "$(DESTDIR)/share/conkeror/modules/clark.js" - -install-strip: - $(MAKE) install - -uninstall: - rm -f "$(DESTDIR)/share/conkeror/modules/clark.js" diff --git a/js/README.org b/js/README.org deleted file mode 100644 index c10acaa..0000000 --- a/js/README.org +++ /dev/null @@ -1,100 +0,0 @@ -# Copyright (C) 2013 Tom Willemsen -# -# This file is part of CLark -# -# CLark is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# CLark is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with CLark. If not, see . - -#+TITLE: Conkeror -#+STARTUP: showall - -[[http://conkeror.org][Conkeror]] is an awesome xulrunner-based web browser with Emacs-like -functionality. It is easily extended and if you like Emacs, a -pleasure to use. It does not seem to have great bookmark management -capabilities, unless you use firefox's bookmarking tools. This is one -of the reasons CLark was written. - -* Set-up - - To use the CLark Conkeror module you need to put its location in - Conkeror's load path, afterwards you should load or require it. So - in your ~.conkerorrc~ you should put: - #+BEGIN_EXAMPLE - load_paths.push("file:///path/to/clark/js/"); - require("clark"); - #+END_EXAMPLE - - If you don't have the CLark executable in your path you should set - the =clark_program= user variable to the location of the CLark - executable: - #+BEGIN_EXAMPLE - clark_program = "/path/to/clark"; - #+END_EXAMPLE - - Once that is done you kan either bind the available functions to - the keys you like, or you could bind =clark_keymap= to a key, for - example: - #+BEGIN_EXAMPLE - define_key(content_buffer_normal_keymap, "b", clark_keymap); - #+END_EXAMPLE - - If you would like to see whether or not you've bookmarked the - current URL, you could add the =clark_bookmarked_widget= to your - Conkeror mode-line: - #+BEGIN_EXAMPLE - add_hook("mode_line_hook", mode_line_adder(clark_bookmarked_widget), true); - #+END_EXAMPLE - - If you don't like the way the =clark_bookmarked_widget= shows you - whether or not the current URL has been bookmarked, you can - customize these by setting either or both of the variables - =clark_bookmarked_string= and =clark_not_bookmarked_string=. - -* Usage - - The Conkeror module is written to mirror the functionality found in - CLark, here's a list of its commands: - - - =clark-exists-p= :: Prints an indication of whether or not the - current URL has been bookmarked. Uses the same - command the =clark_bookmarked_widget= does, only - requires the user to explicitly call it. - - - =clark-add= :: Add the curren URL to CLark. Asks for a title, - description and any tags you wish to assign it. - - - =clark-add-link= :: Does the same thing =clark-add= does, except it - also asks which link found on the current page - to bookmark, instead of using the current URL. - - - =clark-edit= :: Edit the current URL's data. Asks for a name and a - description, if either one is left empty, it is not - sent to CLark and thus not changed. - - - =clark-find-url= :: Calls =find-url= with completions gathered from - CLark. Uses the =search= command, so any text - typed into the minibuffer gets matched as a - substring of a bookmark's title, or a tag. - - - =clark-find-url-new-buffer= :: Does thee same thing =clark-find-url= - does, except it opens the URL in a new buffer, instead of the - current buffer. - - - =clark-remove= :: Removes the current URL from CLark. - - - =clark-set-tags= :: Replace or remove the tags for the current url's - bookmark. If any tags are given they replace the - bookmark's old tags, if the field is left empty, - all tags are removed. - - All of these are included in the =clark_keymap=. diff --git a/js/clark.js b/js/clark.js deleted file mode 100644 index 31dbc26..0000000 --- a/js/clark.js +++ /dev/null @@ -1,314 +0,0 @@ -/* Copyright (C) 2013 Tom Willemsen - - This file is part of CLark - - CLark is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - CLark is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with CLark. If not, see . - */ -/// Commentary: - -// A wrapper script that should allow conkeror to interface with -// CLark. - -/// Code: - -define_variable("clark_program", "clark", - "The location of the clark executable."); -define_variable("clark_bookmarked_string", "+", - "Text to show if the current url has been bookmarked."); -define_variable("clark_not_bookmarked_string", "-", - "Text to show it the current url has not been" - + " bookmarked."); - -define_browser_object_class( - "clark-bookmark", null, - function (I, prompt) { - check_buffer(I.buffer, content_buffer); - var result = yield I.buffer.window.minibuffer.read( - $prompt = prompt, $completer = clark_complete - ); - yield co_return(result); - } -); - -// Add URL to clark, ask for a title (provide TITLE as a -// default), description and any number of tags. -function clark_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 = clark_program + ' add "' + url_string + '" "' + title - + '" "' + description + '" \'' - + tags.split(',').map(function (str) - { return str.trim(); }).join("' '") - + "'"; - let result = yield clark_shell_command(command); - - yield co_return(result); -} - -function clark_add(I) { - check_buffer(I.buffer, content_buffer); - let result = yield clark_add_url(I, I.buffer.top_frame, - I.buffer.title); - - if (result === "") - I.window.minibuffer.message('Added to clark'); - else - I.window.minibuffer.message('Couldn\'t add to clark'); -} -interactive("clark-add", - "Bookmark the current page in clark", - clark_add); - -function clark_add_link(I) { - check_buffer(I.buffer, content_buffer); - var bo = yield read_browser_object(I); - let result = yield clark_add_url(I, encodeURIComponent(bo), - bo.textContent); - - if (result === "") - I.window.minibuffer.message('Added to clark'); - else - I.window.minibuffer.message('Couldn\'t add to clark'); -} -interactive("clark-add-link", - "Select and bookmark a link in clark", - clark_add_link); - -function clark_bookmarked_widget(window) { - this.class_name = "clark-bookmark-widget"; - text_widget.call(this, window); - this.add_hook("current_content_buffer_location_change_hook"); - this.add_hook("select_buffer_hook"); -} -clark_bookmarked_widget.prototype = { - constructor: clark_bookmarked_widget, - __proto__: text_widget.prototype, - update: function () { - var obj = this; - function doit () { - var result = yield clark_exists_p( - obj.window.buffers.current.description - ); - obj.view.text = result == "yes" - ? clark_bookmarked_string - : clark_not_bookmarked_string; - } - co_call(doit()); - } -}; - -function clark_complete(input, pos, conservative) -{ - if (pos == 0 && conservative) - yield co_return(undefined); - - let str = input.substring(0, pos); - - var data = "", error = "", ret = []; - var result = 0; - - if (str == "") - result = yield shell_command( - clark_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( - clark_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 Error("result: " + result + ", error: " + error); - else if (data != "") { - data.split('').forEach(function (row) { - ret.push(row.split('')); - }); - - let c = { count: ret.length, - get_string: function (i) ret[i][1], - get_description: function (i) ret[i][2], - get_input_state: function (i) [ret[i][0]] }; - yield co_return(c); - } -} - -interactive("clark-find-url", - "Find a page from clark in the current buffer", - "find-url", - $browser_object = browser_object_clark_bookmark); -interactive("clark-find-url-new-buffer", - "Find a page from clark in a new buffer", - "find-url-new-buffer", - $browser_object = browser_object_clark_bookmark); - -function clark_edit(I) { - check_buffer(I.buffer, content_buffer); - - let url_string = - load_spec_uri_string(load_spec(I.buffer.top_frame)); - let title = yield I.minibuffer.read( - $prompt="name (leave empty to skip): ", - $initial_value=I.buffer.title - ); - let description = yield I.minibuffer.read( - $prompt="description (leave empty to skip): " - ); - let command = clark_program + ' edit "' + url_string + '" '; - - if (title == "" && description == "") - I.window.minibuffer.message('Nothing to change'); - else { - if (title != "") - command += "--name '" + title + "' "; - if (description != "") - command += "--description '" + description + "' "; - - var result = yield clark_shell_command(command); - - if (result === "") - I.window.minibuffer.message("CLark done"); - else - I.window.minibuffer.message("Error during CLark operation."); - } -} -interactive("clark-edit", "Edit information for the current URL.", - clark_edit); - -function clark_exists_p(url) { - let command = clark_program + ' exists "' + url + '"'; - var data = "", error = ""; - - var result = yield shell_command( - command, - $fds = [{ output: async_binary_string_writer("") }, - { input: async_binary_reader( - function (s) data += s || "") }, - { input: async_binary_reader( - function (s) error += s || "") }] - ); - - if (error != "") - throw new Error("Error occurred with CLark: " + error); - - yield co_return(data.trim()); -} - -interactive("clark-exists-p", "Check to see if the current url" - + " exists in the database.", - function (I) { - check_buffer(I.buffer, content_buffer); - let data = yield clark_exists_p( - load_spec_uri_string(load_spec(I.buffer.top_frame)) - ); - I.window.minibuffer.message(data); - }); - -function clark_remove(I) { - check_buffer(I.buffer, content_buffer); - - let url_string = - load_spec_uri_string(load_spec(I.buffer.top_frame)); - let command = clark_program + ' remove "' + url_string + '"'; - let result = yield clark_shell_command(command); - - if (result === "") - I.window.minibuffer.message("CLark done"); - else - I.window.minibuffer.message("Error during CLark operation."); -} -interactive("clark-remove", "Remove the bookmark of the current URL" - + " from the database.", clark_remove); - -function clark_set_tags(I) { - check_buffer(I.buffer, content_buffer); - - let url_string = - load_spec_uri_string(load_spec(I.buffer.top_frame)); - let tags = yield I.minibuffer.read( - $prompt="tags (comma delimited): " - ); - let command = clark_program + ' set-tags "' + url_string + '" ' - + tags.split(',').map( - function (str) { return "'" + str.trim() + "'"; } - ).join(" "); - let result = yield clark_shell_command(command); - - if (result === "") - I.window.minibuffer.message("CLark done"); - else - I.window.minibuffer.message("Error during CLark operation."); -} -interactive("clark-set-tags", "Replace the tags for the bookmark of" - + " the current URL.", clark_set_tags); - -function clark_random(I) -{ - check_buffer(I.buffer, content_buffer); - - let tag = yield I.minibuffer.read($prompt="tag: "); - let command = clark_program + ' random'; - if (tag != "") - command += ' ' + tag; - - let result = yield clark_shell_command(command); - - if (result) - I.buffer.load(result); -} -interactive("clark-random", "Open a random bookmark", clark_random); - -function clark_shell_command(command) -{ - let data = "", error = ""; - let res = yield shell_command( - command, - $fds = [{ output: async_binary_string_writer("") }, - { input: async_binary_reader( - function (s) data += s || "" - )}, - { input: async_binary_reader( - function (s) error += s || "" - )}] - ); - - yield co_return(res == 0 && error == "" && data); -} - -define_keymap("clark_keymap"); - -define_key(clark_keymap, "#", "clark-random"); -define_key(clark_keymap, "?", "clark-exists-p"); -define_key(clark_keymap, "a", "clark-add"); -define_key(clark_keymap, "A", "clark-add-link"); -define_key(clark_keymap, "e", "clark-edit"); -define_key(clark_keymap, "f", "clark-find-url"); -define_key(clark_keymap, "F", "clark-find-url-new-buffer"); -define_key(clark_keymap, "r", "clark-remove"); -define_key(clark_keymap, "t", "clark-set-tags"); - -provide("clark"); -- cgit v1.2.3-54-g00ecf