summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--org-gnosis-ui.el77
1 files changed, 38 insertions, 39 deletions
diff --git a/org-gnosis-ui.el b/org-gnosis-ui.el
index 8766ce2..65cc736 100644
--- a/org-gnosis-ui.el
+++ b/org-gnosis-ui.el
@@ -5,10 +5,10 @@
;; author: Kirill Rogovoy, Thomas Jorna, Thanos Apollo
;; Maintainer: Thanos Apollo <[email protected]>
-;; URL: https://git.thanosapollo.org/org-roam-ui/
+;; URL: https://git.thanosapollo.org/org-gnosis-ui/
;; Keywords: files outlines
;; Version: 0.1
-;; Package-Requires: ((emacs "27.1") (simple-httpd "20191103.1446") (websocket "1.13"))
+;; Package-Requires: ((emacs "27.1") (simple-httpd "1.5.1") (websocket "1.13") (org-gnosis))
;; This file is NOT part of GNU Emacs.
@@ -45,10 +45,9 @@
(require 'websocket)
(defgroup org-gnosis-ui nil
- "UI in Org-roam."
+ "UI for Org Gnosis."
:group 'org-gnosis-ui
- :prefix "org-gnosis-ui-"
- :link '(url-link :tag "Github" "https://github.com/org-roam/org-gnosis-ui"))
+ :prefix "org-gnosis-ui-")
(defcustom org-gnosis-ui-directory org-gnosis-dir
"Directory of org-gnosis-ui notes."
@@ -87,9 +86,6 @@ Ignored if a custom theme is provied for variable `org-gnosis-ui-custom-theme'."
;; (magenta . "#bd93f9")).
(defcustom org-gnosis-ui-custom-theme nil
"Custom theme for `org-gnosis-ui'.
-Blocks `org-gnosis-ui-sync-theme' from syncing your current theme,
-instead sync this theme.
-Provide a list of cons with the following keys:
bg, bg-alt, fg, fg-alt, red, orange, yellow, green, cyan, blue, violet, magenta."
:group 'org-gnosis-ui
:type '(alist :key-type (choice (const bg)
@@ -107,12 +103,13 @@ bg, bg-alt, fg, fg-alt, red, orange, yellow, green, cyan, blue, violet, magenta.
:value-type (color)))
(defcustom org-gnosis-ui-follow t
- "If true, `org-gnosis-ui' will follow you around in the graph."
+ "When t, will follow you around in the graph."
:group 'org-gnosis-ui
:type 'boolean)
(defcustom org-gnosis-ui-update-on-save t
- "If true, `org-gnosis-ui' will send new data when you save an `org-roam' buffer.
+ "When t, will send new data when you save an `org-gnosis' buffer.
+
This can lead to some jank."
:group 'org-gnosis-ui
:type 'boolean)
@@ -183,7 +180,7 @@ Take ID as string as sole argument."
(defcustom org-gnosis-ui-latex-macros nil
"Alist of LaTeX macros to be passed to org-gnosis-ui.
Format as, i.e. with double backslashes for a single backslash:
-'((\"\\macro\".\"\\something{#1}\"))"
+='((\"\\macro\".\"\\something{#1}\"))"
:group 'org-gnosis-ui
:type 'alist)
@@ -329,7 +326,7 @@ Takes _WS and FRAME as arguments."
(httpd-send-header t "text/plain" 200 :Access-Control-Allow-Origin "*")))
(defun org-gnosis-ui--on-save ()
- "Send graphdata on saving an org-roam buffer.
+ "Send graphdata on saving an org-gnosis buffer.
TODO: Make this only send the changes to the graph data, not the complete graph."
(when (bound-and-true-p org-gnosis-mode)
@@ -348,7 +345,7 @@ TODO: Make this only send the changes to the graph data, not the complete graph.
"Find the title of the bibtex entry keyed by `REF'.
Requires `org-roam-bibtex' and `bibtex-completion' (a dependency of `orb') to be
-loaded. Returns `ref' if an entry could not be found."
+loaded. Returns `ref' if an entry could not be found."
(if (and org-gnosis-ui-find-ref-title
(fboundp 'bibtex-completion-get-entry)
(fboundp 'orb--pre-expand-template)
@@ -371,28 +368,29 @@ loaded. Returns `ref' if an entry could not be found."
(tail (nthcdr (+ n 1) lst)))
(append head (list el) tail)))
-(defun org-gnosis-ui--citekey-to-ref (citekey)
- "Convert a CITEKEY property (most likely with a `cite:' prefix) to just a key.
-
-This method is mostly taken from `org-roam-bibtex'
-see https://github.com/org-roam/org-roam-bibtex/blob/919ec8d837a7a3bd25232bdba17a0208efaefb2a/orb-utils.el#L289
-but is has been adapted to operate on a sting instead of a node. Requires
-`org-ref' to be loaded. Returns the `key' or nil if the format does not match
-the `org-ref-cite-re'"
- (if-let ((boundp 'org-ref-cite-re)
- (citekey-list (split-string-and-unquote citekey)))
- (catch 'found
- (dolist (c citekey-list)
- (when (string-match org-ref-cite-re c)
- (throw 'found (match-string 2 c)))))))
+;; (defun org-gnosis-ui--citekey-to-ref (citekey)
+;; "Convert a CITEKEY property (most likely with a `cite:' prefix) to just a key.
+
+;; This method is mostly taken from `org-roam-bibtex' see but is has been
+;; adapted to operate on a sting instead of a node. Requires `org-ref' to
+;; be loaded.
+
+;; Returns the `key' or nil if the format does not match
+;; the `org-ref-cite-re'"
+;; (if-let ((boundp 'org-ref-cite-re)
+;; (citekey-list (split-string-and-unquote citekey)))
+;; (catch 'found
+;; (dolist (c citekey-list)
+;; (when (string-match org-ref-cite-re c)
+;; (throw 'found (match-string 2 c)))))))
(defun org-gnosis-ui--retitle-node (node)
"Replace the title of citation NODE with associated notes.
-A new title is created using information from the bibliography and formatted
-according to `org-gnosis-ui-ref-title-template', just like the citation nodes with
-a note are. It requires `org-roam-bibtex' and it's dependencies
-\(`bibtex-completion' and `org-ref'\) to be loaded.
+A new title is created using information from the bibliography and
+formatted according to `org-gnosis-ui-ref-title-template', just like
+the citation nodes with a note are. It requires `org-roam-bibtex' and
+it's dependencies \(`bibtex-completion' and `org-ref'\) to be loaded.
Returns the node with an updated title if the current node is a reference node
and the key was found in the bibliography, otherwise the node is returned
@@ -420,7 +418,7 @@ unchanged."
'nil))
(defun org-gnosis-ui-get-tags ()
- "Fetch tags from the org-roam database."
+ "Fetch tags from the org-gnosis database."
(org-gnosis-select '* 'tags '1=1 t))
(defun org-gnosis-ui-get-nodes (&optional nodes links-db)
@@ -504,7 +502,7 @@ Nodes defaults to `org-gnosis-ui-node-query' formatted by
1 ;; Assume priority or similar static position value
nil ;; This corresponds to the `position` from your desired output
- ;; Properties, to fit with the previous implemention of org-roam-ui.
+ ;; Properties, to fit with the previous implemention of org-gnosis-ui.
;; TODO: To make it easier to use 3rd party note
;; taking systems, this part should be removed.
(list (cons "CATEGORY" (file-name-base file))
@@ -551,7 +549,7 @@ Nodes defaults to `org-gnosis-ui-node-query' formatted by
(defun org-gnosis-ui--send-variables (ws)
- "Send miscellaneous org-roam variables through the websocket WS."
+ "Send miscellaneous org-gnosis variables through the websocket WS."
(let ((daily-dir (or org-gnosis-ui-dailies-directory ""))
(attach-dir (or (and (boundp 'org-attach-id-dir) org-attach-id-dir)
(expand-file-name ".attach/" org-directory)))
@@ -615,8 +613,8 @@ COLUMN-NAMES: columns to use."
`(magenta . ,(face-foreground font-lock-preprocessor-face))))
(defun org-gnosis-ui-find-subdirectories ()
- "Find all the subdirectories in the org-roam directory.
-TODO: Exclude org-attach dirs."
+ "Find all the subdirectories in the org-gnosis directory.
+TODO: Exclude `org-attach' dirs."
(seq-filter
(lambda (file) (and (file-directory-p file) (org-gnosis-ui-allowed-directory-p file)))
(directory-files-recursively org-gnosis-ui-directory
@@ -671,9 +669,10 @@ Optionally with ID (string), SPEED (number, ms) and PADDING (number, px)."
(defun org-gnosis-ui-change-local-graph (&optional id manipulation)
- "Add or remove current node to the local graph.
+ "Add or remove current node ID to the local graph.
-If not in local mode, open local-graph for this node."
+If not in local mode, open local-graph for this node.
+MANIPULATION:"
(interactive)
(if-let ((node (or id (org-gnosis-get-id))))
(websocket-send-text org-gnosis-ui-ws-socket
@@ -685,7 +684,7 @@ If not in local mode, open local-graph for this node."
;;;###autoload
(defun org-gnosis-ui-add-to-local-graph (&optional id)
- "Add current node to the local graph.
+ "Add current node ID to the local graph.
If not in local mode, open local-graph for this node."
(interactive)