Rename linkwave to markam
This commit is contained in:
parent
f379783d28
commit
b467939385
11 changed files with 78 additions and 84 deletions
9
Makefile
9
Makefile
|
@ -1,4 +1,7 @@
|
||||||
.PHONY: all
|
dirs = src doc
|
||||||
|
|
||||||
all:
|
.PHONY: all $(dirs)
|
||||||
$(MAKE) -C src/
|
|
||||||
|
all: $(dirs)
|
||||||
|
$(dirs):
|
||||||
|
$(MAKE) -C $@
|
||||||
|
|
10
README.org
10
README.org
|
@ -1,9 +1,3 @@
|
||||||
* nlinkwave
|
* Markam
|
||||||
|
|
||||||
I'm working on replacing [[http://code.ryuslash.org/cgit.cgi/linkwave/][linkwave]] with this project soon, with the
|
Collects bookmarks.
|
||||||
hope of making development on/for Windows easier and becaus scheme
|
|
||||||
is fun!
|
|
||||||
|
|
||||||
*Note:* Once I determine that ~nlinkwave~ is capable of everything
|
|
||||||
linkwave is I will change the name of this repository, keep this in
|
|
||||||
mind when you are having trouble pulling changes in the future.
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* linkwave -- Store/retrieve/manage bookmarks
|
/* markam -- Store/retrieve/manage bookmarks
|
||||||
Copyright (C) 2012 Tom Willemsen <tom at ryuslash dot org>
|
Copyright (C) 2012 Tom Willemsen <tom at ryuslash dot org>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -17,16 +17,16 @@
|
||||||
/// Commentary:
|
/// Commentary:
|
||||||
|
|
||||||
// A wrapper script that should allow conkeror to interface with
|
// A wrapper script that should allow conkeror to interface with
|
||||||
// linkwave. Does not yet allow searching through collected
|
// markam. Does not yet allow searching through collected bookmarks,
|
||||||
// bookmarks, only adding new ones.
|
// only adding new ones.
|
||||||
|
|
||||||
/// Code:
|
/// Code:
|
||||||
|
|
||||||
define_variable("linkwave_program", "linkwave",
|
define_variable("markam_program", "markam",
|
||||||
"The location of the linkwave executable.");
|
"The location of the markam executable.");
|
||||||
|
|
||||||
function linkwave_add_url(I, url, title)
|
function markam_add_url(I, url, title)
|
||||||
{ // Add URL to linkwave, ask for a title (provide TITLE as a
|
{ // Add URL to markam, ask for a title (provide TITLE as a
|
||||||
// default), description and any number of tags.
|
// default), description and any number of tags.
|
||||||
let url_string = load_spec_uri_string(load_spec(url));
|
let url_string = load_spec_uri_string(load_spec(url));
|
||||||
let title = yield I.minibuffer.read($prompt="name (required): ",
|
let title = yield I.minibuffer.read($prompt="name (required): ",
|
||||||
|
@ -37,7 +37,7 @@ function linkwave_add_url(I, url, title)
|
||||||
let tags = yield I.minibuffer.read(
|
let tags = yield I.minibuffer.read(
|
||||||
$prompt="tags (comma delimited): "
|
$prompt="tags (comma delimited): "
|
||||||
);
|
);
|
||||||
let command = linkwave_program + ' "' + url_string + '" "' + title
|
let command = markam_program + ' "' + url_string + '" "' + title
|
||||||
+ '" "' + description + '" \''
|
+ '" "' + description + '" \''
|
||||||
+ tags.split(',').map(function (str)
|
+ tags.split(',').map(function (str)
|
||||||
{ return str.trim(); }).join("' '")
|
{ return str.trim(); }).join("' '")
|
||||||
|
@ -45,33 +45,33 @@ function linkwave_add_url(I, url, title)
|
||||||
yield shell_command(command);
|
yield shell_command(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
function linkwave_add(I) {
|
function markam_add(I) {
|
||||||
check_buffer(I.buffer, content_buffer);
|
check_buffer(I.buffer, content_buffer);
|
||||||
let result = yield linkwave_add_url(I, I.buffer.top_frame,
|
let result = yield markam_add_url(I, I.buffer.top_frame,
|
||||||
I.buffer.title);
|
I.buffer.title);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
I.window.minibuffer.message('Added to linkwave');
|
I.window.minibuffer.message('Added to markam');
|
||||||
else
|
else
|
||||||
I.window.minibuffer.message('Couldn\'t add to linkwave');
|
I.window.minibuffer.message('Couldn\'t add to markam');
|
||||||
}
|
}
|
||||||
interactive("linkwave-add",
|
interactive("markam-add",
|
||||||
"Bookmark the current page in linkwave",
|
"Bookmark the current page in markam",
|
||||||
linkwave_add);
|
markam_add);
|
||||||
|
|
||||||
function linkwave_add_link(I) {
|
function markam_add_link(I) {
|
||||||
check_buffer(I.buffer, content_buffer);
|
check_buffer(I.buffer, content_buffer);
|
||||||
bo = yield read_browser_object(I);
|
bo = yield read_browser_object(I);
|
||||||
let result = yield linkwave_add_url(I, encodeURIComponent(bo),
|
let result = yield markam_add_url(I, encodeURIComponent(bo),
|
||||||
bo.textContent);
|
bo.textContent);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
I.window.minibuffer.message('Added to linkwave');
|
I.window.minibuffer.message('Added to markam');
|
||||||
else
|
else
|
||||||
I.window.minibuffer.message('Couldn\'t add to linkwave');
|
I.window.minibuffer.message('Couldn\'t add to markam');
|
||||||
}
|
}
|
||||||
interactive("linkwave-add-link",
|
interactive("markam-add-link",
|
||||||
"Select and bookmark a link in linkwave",
|
"Select and bookmark a link in markam",
|
||||||
linkwave_add_link);
|
markam_add_link);
|
||||||
|
|
||||||
provide("linkwave");
|
provide("markam");
|
|
@ -1,4 +1,4 @@
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
|
|
||||||
all: linkwave.info
|
all: markam.info
|
||||||
linkwave.info: linkwave.texi
|
markam.info: markam.texi
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
\input texinfo @c -*-texinfo-*-
|
\input texinfo @c -*-texinfo-*-
|
||||||
@c %**start of header
|
@c %**start of header
|
||||||
@setfilename linkwave.info
|
@setfilename markam.info
|
||||||
@settitle linkwave User Manual
|
@settitle markam User Manual
|
||||||
@c %**end of header
|
@c %**end of header
|
||||||
@copying
|
@copying
|
||||||
The user manual for linkwave.
|
The user manual for markam.
|
||||||
|
|
||||||
Copyright @copyright{} 2012 Tom Willemsen
|
Copyright @copyright{} 2012 Tom Willemsen
|
||||||
|
|
||||||
|
@ -27,8 +27,8 @@ The document was typeset with
|
||||||
@end copying
|
@end copying
|
||||||
|
|
||||||
@titlepage
|
@titlepage
|
||||||
@title linkwave User Manual
|
@title markam User Manual
|
||||||
@subtitle The user manual for linkwave
|
@subtitle The user manual for markam
|
||||||
@author Tom Willemsen <tom@ryuslash.org>
|
@author Tom Willemsen <tom@ryuslash.org>
|
||||||
@page
|
@page
|
||||||
@vskip 0pt plus 1filll
|
@vskip 0pt plus 1filll
|
||||||
|
@ -40,14 +40,14 @@ The document was typeset with
|
||||||
|
|
||||||
@ifnottex
|
@ifnottex
|
||||||
@node Top, Usage, (dir), (dir)
|
@node Top, Usage, (dir), (dir)
|
||||||
@top linkwave User Manual
|
@top markam User Manual
|
||||||
|
|
||||||
@insertcopying
|
@insertcopying
|
||||||
@end ifnottex
|
@end ifnottex
|
||||||
|
|
||||||
@c Generate the nodes for this menu with `C-c C-u C-m'.
|
@c Generate the nodes for this menu with `C-c C-u C-m'.
|
||||||
@menu
|
@menu
|
||||||
* Usage:: How to use linkwave
|
* Usage:: How to use markam
|
||||||
* Copying This Manual::
|
* Copying This Manual::
|
||||||
* Index::
|
* Index::
|
||||||
@end menu
|
@end menu
|
||||||
|
@ -57,11 +57,11 @@ The document was typeset with
|
||||||
@node Usage, Copying This Manual, Top, Top
|
@node Usage, Copying This Manual, Top, Top
|
||||||
@chapter How to use
|
@chapter How to use
|
||||||
|
|
||||||
For the moment linkwave is a simple program, it has 2 functions. In
|
For the moment markam is a simple program, it has 2 functions. In
|
||||||
order to view a list of all your bookmarks you can use:
|
order to view a list of all your bookmarks you can use:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
linkwave
|
markam
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
This will show the list of all stored bookmarks, showing the URL, name
|
This will show the list of all stored bookmarks, showing the URL, name
|
||||||
|
@ -70,9 +70,9 @@ and description. This list is unsorted and unpaged.
|
||||||
The other function is to add a new bookmark, which can be done with:
|
The other function is to add a new bookmark, which can be done with:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
linkwave http://example.org Example \
|
markam http://example.org Example \
|
||||||
"Some description about Example" \
|
"Some description about Example" \
|
||||||
example some more tags
|
example some more tags
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
This will store the bookmark with the URL of ``http://example.org'',
|
This will store the bookmark with the URL of ``http://example.org'',
|
||||||
|
@ -80,7 +80,7 @@ name ``Example'', description ``Some description about Example'' and
|
||||||
the tags ``example'', ``some'', ``more'' and ``tags''. Any arguments
|
the tags ``example'', ``some'', ``more'' and ``tags''. Any arguments
|
||||||
following the description will be considered tags.
|
following the description will be considered tags.
|
||||||
|
|
||||||
For the moment linkwave is rather stupid, assuming that all URLs start
|
For the moment markam is rather stupid, assuming that all URLs start
|
||||||
with @code{http://} or @code{https://}, so other bookmarks can't be
|
with @code{http://} or @code{https://}, so other bookmarks can't be
|
||||||
added (yet).
|
added (yet).
|
||||||
|
|
||||||
|
@ -103,4 +103,4 @@ added (yet).
|
||||||
|
|
||||||
@bye
|
@bye
|
||||||
|
|
||||||
@c linkwave.texi ends here
|
@c markam.texi ends here
|
2
src/.gitignore
vendored
2
src/.gitignore
vendored
|
@ -1,3 +1,3 @@
|
||||||
convert
|
convert
|
||||||
linkwave
|
markam
|
||||||
*.o
|
*.o
|
||||||
|
|
|
@ -2,8 +2,8 @@ objects = paths.o common.o
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
|
|
||||||
all: linkwave convert
|
all: markam convert
|
||||||
linkwave: linkwave.scm $(objects)
|
markam: markam.scm $(objects)
|
||||||
csc $^ -o $@
|
csc $^ -o $@
|
||||||
|
|
||||||
convert: convert.scm $(objects)
|
convert: convert.scm $(objects)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
;;; linkwave -- Store/retrieve/manage bookmarks
|
;;; markam -- Store/retrieve/manage bookmarks
|
||||||
;; Copyright (C) 2012 Tom Willemsen <tom at ryuslash dot org>
|
;; Copyright (C) 2012 Tom Willemsen <tom at ryuslash dot org>
|
||||||
|
|
||||||
;; This program is free software: you can redistribute it and/or modify
|
;; This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -26,5 +26,5 @@
|
||||||
(define version "0.1.0")
|
(define version "0.1.0")
|
||||||
|
|
||||||
(define (display-version)
|
(define (display-version)
|
||||||
;; Display linkwave's version number.
|
;; Display markam's version number.
|
||||||
(format #t "linkwave v~a~%" version))
|
(format #t "markam version ~a~%" version))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
;;; linkwave -- Store/retrieve/manage bookmarks
|
;;; markam -- Store/retrieve/manage bookmarks
|
||||||
;; Copyright (C) 2012 Tom Willemsen <tom at ryuslash dot org>
|
;; Copyright (C) 2012 Tom Willemsen <tom at ryuslash dot org>
|
||||||
|
|
||||||
;; This program is free software: you can redistribute it and/or modify
|
;; This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
|
|
||||||
;; Convert any old database file to one usable with this version of
|
;; Convert any old database file to one usable with this version of
|
||||||
;; linkwave. If you're just starting to use linkwave there should be
|
;; markam. If you're just starting to use markam there should be
|
||||||
;; no need to use this.
|
;; no need to use this.
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
(define (blob->seconds blob)
|
(define (blob->seconds blob)
|
||||||
;; Convert BLOB to an integer representing the seconds since
|
;; Convert BLOB to an integer representing the seconds since
|
||||||
;; 01-01-1970 (standard unix timstamp). This has to be done because
|
;; 01-01-1970 (standard unix timstamp). This has to be done because
|
||||||
;; in the previous version of linkwave I stored the timestamp as a
|
;; in the previous version of markam I stored the timestamp as a
|
||||||
;; blob and CHICKEN doesn't seem to like blobs much.
|
;; blob and CHICKEN doesn't seem to like blobs much.
|
||||||
(if (u32vector? blob)
|
(if (u32vector? blob)
|
||||||
(u32vector-ref (blob->u32vector blob) 0)
|
(u32vector-ref (blob->u32vector blob) 0)
|
||||||
|
@ -53,8 +53,8 @@
|
||||||
(define (convert)
|
(define (convert)
|
||||||
;; Convert an old database into a new one and then replace the old
|
;; Convert an old database into a new one and then replace the old
|
||||||
;; with the new.
|
;; with the new.
|
||||||
(let ((old-db (open-database (data-file "linkwave.db")))
|
(let ((old-db (open-database (data-file "linkwave.db" "linkwave")))
|
||||||
(new-db (open-database (data-file "nlinkwave.db"))))
|
(new-db (open-database (data-file "markam.db"))))
|
||||||
(execute new-db "CREATE TABLE bookmark (url VARCHAR(255) UNIQUE, date INTEGER, name VARCHAR(255), description TEXT)")
|
(execute new-db "CREATE TABLE bookmark (url VARCHAR(255) UNIQUE, date INTEGER, name VARCHAR(255), description TEXT)")
|
||||||
(execute new-db "CREATE TABLE tag (name VARCHAR(255) UNIQUE)")
|
(execute new-db "CREATE TABLE tag (name VARCHAR(255) UNIQUE)")
|
||||||
(execute new-db "CREATE TABLE bookmark_tag (bookmark_id INTEGER REFERENCES bookmark(rowid), tag_id INTEGER REFERENCES tag(rowid), PRIMARY KEY (bookmark_id, tag_id))")
|
(execute new-db "CREATE TABLE bookmark_tag (bookmark_id INTEGER REFERENCES bookmark(rowid), tag_id INTEGER REFERENCES tag(rowid), PRIMARY KEY (bookmark_id, tag_id))")
|
||||||
|
@ -75,12 +75,10 @@
|
||||||
(first-result new-db "SELECT rowid FROM tag WHERE name = ?" tag)))
|
(first-result new-db "SELECT rowid FROM tag WHERE name = ?" tag)))
|
||||||
"SELECT url, name FROM bookmark_tag JOIN tag ON (tag_id = tag.rowid)")
|
"SELECT url, name FROM bookmark_tag JOIN tag ON (tag_id = tag.rowid)")
|
||||||
|
|
||||||
(rename-file (data-file "linkwave.db") (data-file "old-linkwave.db"))
|
|
||||||
(rename-file (data-file "nlinkwave.db") (data-file "linkwave.db"))
|
|
||||||
(format #t "Database converted.~%")))
|
(format #t "Database converted.~%")))
|
||||||
|
|
||||||
(define (display-help)
|
(define (display-help)
|
||||||
;; Display linkwave's help message.
|
;; Display markam's help message.
|
||||||
(format #t (string-append
|
(format #t (string-append
|
||||||
"Usage: convert [options]...~%"
|
"Usage: convert [options]...~%"
|
||||||
"~%"
|
"~%"
|
||||||
|
@ -93,9 +91,9 @@
|
||||||
;; Convert an old database file unless a conversion database already
|
;; Convert an old database file unless a conversion database already
|
||||||
;; exists.
|
;; exists.
|
||||||
(if (null? args)
|
(if (null? args)
|
||||||
(if (file-exists? (data-file "nlinkwave.db"))
|
(if (file-exists? (data-file "markam.db"))
|
||||||
(format #t (string-append "Conversion database already exists. "
|
(format #t (string-append "Converted database already exists, or something may have gone "
|
||||||
"Something may have gone wrong during the last run~%"))
|
"wrong during the last run~%"))
|
||||||
(convert))
|
(convert))
|
||||||
(do ((arg (car args) (and (not (null? args))
|
(do ((arg (car args) (and (not (null? args))
|
||||||
(car args))))
|
(car args))))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
;;; linkwave -- Store/retrieve/manage bookmarks
|
;;; markam -- Store/retrieve/manage bookmarks
|
||||||
;; Copyright (C) 2012 Tom Willemsen <tom at ryuslash dot org>
|
;; Copyright (C) 2012 Tom Willemsen <tom at ryuslash dot org>
|
||||||
|
|
||||||
;; This program is free software: you can redistribute it and/or modify
|
;; This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -78,10 +78,10 @@
|
||||||
(string= (substring str 0 8) "https://"))))
|
(string= (substring str 0 8) "https://"))))
|
||||||
|
|
||||||
(define (display-help)
|
(define (display-help)
|
||||||
;; Display linkwave's help message.
|
;; Display markam's help message.
|
||||||
(format #t (string-append
|
(format #t (string-append
|
||||||
"Usage: linkwave [options]...~%"
|
"Usage: markam [options]...~%"
|
||||||
" linkwave <url> <name> <description> [<tag>...]~%"
|
" markam <url> <name> <description> [<tag>...]~%"
|
||||||
"~%"
|
"~%"
|
||||||
"Possible options:~%"
|
"Possible options:~%"
|
||||||
"~%"
|
"~%"
|
||||||
|
@ -91,7 +91,7 @@
|
||||||
(define (main args)
|
(define (main args)
|
||||||
;; Open a database connection, do what the user asked and close it
|
;; Open a database connection, do what the user asked and close it
|
||||||
;; again.
|
;; again.
|
||||||
(let ((db (open-database (data-file "linkwave.db"))))
|
(let ((db (open-database (data-file "markam.db"))))
|
||||||
(if (null? args)
|
(if (null? args)
|
||||||
(for-each-row print-row db "select * from bookmark")
|
(for-each-row print-row db "select * from bookmark")
|
||||||
(if (url-string? (car args))
|
(if (url-string? (car args))
|
|
@ -1,4 +1,4 @@
|
||||||
;;; linkwave -- Store/retrieve/manage bookmarks
|
;;; markam -- Store/retrieve/manage bookmarks
|
||||||
;; Copyright (C) 2012 Tom Willemsen <tom at ryuslash dot org>
|
;; Copyright (C) 2012 Tom Willemsen <tom at ryuslash dot org>
|
||||||
|
|
||||||
;; This program is free software: you can redistribute it and/or modify
|
;; This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -22,25 +22,24 @@
|
||||||
|
|
||||||
(declare (unit paths))
|
(declare (unit paths))
|
||||||
|
|
||||||
(define (stored-file xdg-env file)
|
(define (stored-file xdg-env file #!optional dir)
|
||||||
;; Get FILE either from `XDG-ENV/linkwave/' or from
|
;; Get FILE either from `XDG-ENV/markam/' or from `$HOME/.markam/'.
|
||||||
;; `$HOME/.linkwave/'. Prefer any existing file over any other, but
|
;; Prefer any existing file over any other, but prefer files using
|
||||||
;; prefer files using XDG-ENV over `$HOME'.
|
;; XDG-ENV over `$HOME'.
|
||||||
(let ((xdg (get-environment-variable xdg-env))
|
(let* ((xdg (get-environment-variable xdg-env))
|
||||||
(stored-file (string-append (get-environment-variable "HOME") "/.linkwave/" file)))
|
(dir (or dir "markam"))
|
||||||
|
(stored-file (string-append (get-environment-variable "HOME") "/." dir "/" file)))
|
||||||
(unless (or (file-exists? stored-file) (not xdg))
|
(unless (or (file-exists? stored-file) (not xdg))
|
||||||
(set! stored-file (string-append xdg "/linkwave/" file)))
|
(set! stored-file (string-append xdg "/" dir "/" file)))
|
||||||
stored-file))
|
stored-file))
|
||||||
|
|
||||||
(: config-file (string -> string))
|
|
||||||
(define (config-file file)
|
(define (config-file file)
|
||||||
;; Use `stored-file' to get configuration file FILE. Configuration
|
;; Use `stored-file' to get configuration file FILE. Configuration
|
||||||
;; files are stored under `$XDG_CONFIG_HOME' if the XDG standard is
|
;; files are stored under `$XDG_CONFIG_HOME' if the XDG standard is
|
||||||
;; used.
|
;; used.
|
||||||
(stored-file "XDG_CONFIG_HOME" file))
|
(stored-file "XDG_CONFIG_HOME" file))
|
||||||
|
|
||||||
(: data-file (string -> string))
|
(define (data-file file #!optional dir)
|
||||||
(define (data-file file)
|
|
||||||
;; Use `stored-file' to get data file FILE. Data files are stored
|
;; Use `stored-file' to get data file FILE. Data files are stored
|
||||||
;; under `$XDG_DATA_HOME' if the XDG standard is used.
|
;; under `$XDG_DATA_HOME' if the XDG standard is used.
|
||||||
(stored-file "XDG_DATA_HOME" file))
|
(stored-file "XDG_DATA_HOME" file dir))
|
||||||
|
|
Loading…
Reference in a new issue