Load an init file at startup
With this init file one can change certain defaults, and define their own commands.
This commit is contained in:
parent
2e2c401a86
commit
30acc48afd
1 changed files with 14 additions and 0 deletions
|
@ -111,6 +111,14 @@ The result contains the url, name and the description of the bookmark."
|
||||||
(list (sb-ext:posix-getenv "HOME") "/.local/share"))
|
(list (sb-ext:posix-getenv "HOME") "/.local/share"))
|
||||||
'("/clark/bookmarks.db"))))
|
'("/clark/bookmarks.db"))))
|
||||||
|
|
||||||
|
(defun get-rc-location ()
|
||||||
|
"Get the location of the RC file."
|
||||||
|
(pathname
|
||||||
|
(apply 'concatenate 'string
|
||||||
|
(or (sb-ext:posix-getenv "XDG_CONFIG_HOME")
|
||||||
|
(list (sb-ext:posix-getenv "HOME") "/.config"))
|
||||||
|
'("/clark/rc.lisp"))))
|
||||||
|
|
||||||
(defun get-tag-id (name)
|
(defun get-tag-id (name)
|
||||||
"Get the rowid of tag NAME."
|
"Get the rowid of tag NAME."
|
||||||
(execute-single *db* "SELECT rowid FROM tag WHERE name = ?" name))
|
(execute-single *db* "SELECT rowid FROM tag WHERE name = ?" name))
|
||||||
|
@ -156,6 +164,11 @@ The result contains the url, name and the description of the bookmark."
|
||||||
(ensure-directories-exist db-location)
|
(ensure-directories-exist db-location)
|
||||||
(ensure-db-exists db-location)))
|
(ensure-db-exists db-location)))
|
||||||
|
|
||||||
|
(defun load-rc ()
|
||||||
|
"Load the RC file."
|
||||||
|
(let ((*package* (in-package :org.ryuslash.clark)))
|
||||||
|
(load (get-rc-location) :if-does-not-exist nil)))
|
||||||
|
|
||||||
(eval-when (:compile-toplevel :load-toplevel)
|
(eval-when (:compile-toplevel :load-toplevel)
|
||||||
(defun make-command-name (base)
|
(defun make-command-name (base)
|
||||||
"Turn BASE into the name of a possible command."
|
"Turn BASE into the name of a possible command."
|
||||||
|
@ -294,6 +307,7 @@ Print the version number and exit."
|
||||||
|
|
||||||
Connect to the database, parse command-line arguments, execute and
|
Connect to the database, parse command-line arguments, execute and
|
||||||
then disconnect."
|
then disconnect."
|
||||||
|
(load-rc)
|
||||||
(load-db)
|
(load-db)
|
||||||
(parse-args (cdr args))
|
(parse-args (cdr args))
|
||||||
(disconnect *db*))
|
(disconnect *db*))
|
||||||
|
|
Loading…
Reference in a new issue