[oni-org] Rename ‘oni-org-knowledge-*’ to ‘oni-org-exocortex-*’
This commit is contained in:
parent
f846a15a07
commit
b7df647005
1 changed files with 16 additions and 16 deletions
|
@ -4,7 +4,7 @@
|
|||
|
||||
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||
;; Keywords: local
|
||||
;; Version: 2021.0730.213310
|
||||
;; Version: 2021.0730.231625
|
||||
;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org org-contrib org-bullets org-edna diminish all-the-icons olivetti)
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
|
@ -65,7 +65,7 @@
|
|||
(expand-file-name "icons" oni-org-root)
|
||||
"The directory where ‘oni-org’ stores its icons.")
|
||||
|
||||
;;; Fake org-roam
|
||||
;;; Fake org-roam -- oni-org-exocortex
|
||||
;; I tried using org-roam v2 with Orgro, but it didn’t work. I’ve only been
|
||||
;; using org-roam to more easily find and insert strings. The file renaming in
|
||||
;; v1 always seemed to have some issue, so I never really used that. And I
|
||||
|
@ -77,7 +77,7 @@
|
|||
|
||||
(eval-when-compile (require 'cl-macs))
|
||||
|
||||
(defvar oni-org-knowledge-directory (expand-file-name "~/documents/org"))
|
||||
(defvar oni-org-exocortex-directory (expand-file-name "~/documents/org"))
|
||||
|
||||
;; Expected (I need to turn these into tests):
|
||||
|
||||
|
@ -100,11 +100,11 @@
|
|||
(format-time-string "%Y%m%d%H%M%S")
|
||||
(oni-org--slugify title)))
|
||||
|
||||
;; Collect all of the files under the ‘oni-org-knowledge-directory’. org-roam indexes
|
||||
;; Collect all of the files under the ‘oni-org-exocortex-directory’. org-roam indexes
|
||||
;; all of the files in a database, but I really didn’t want to recreate that
|
||||
;; today. For the moment I don’t have so many files that parsing all of them
|
||||
;; like this is a huge problem.
|
||||
(defun oni-org--get-knowledge-files ()
|
||||
(defun oni-org--get-exocortex-files ()
|
||||
(cl-labels ((add-titles (file)
|
||||
(list (with-temp-buffer
|
||||
(insert-file-contents (expand-file-name file))
|
||||
|
@ -120,14 +120,14 @@
|
|||
(not (string-match-p (rx "/.") directory))))
|
||||
(mapcar #'add-titles
|
||||
(cl-delete-if #'unimportant-file-p
|
||||
(directory-files-recursively oni-org-knowledge-directory (rx bos (repeat 14 digit) "-" (one-or-more (any alphanumeric "_")) ".org") nil #'unimportant-directory-p)))))
|
||||
(directory-files-recursively oni-org-exocortex-directory (rx bos (repeat 14 digit) "-" (one-or-more (any alphanumeric "_")) ".org") nil #'unimportant-directory-p)))))
|
||||
|
||||
;; Find and visit a file in the ‘oni-org-knowledge-directory’. If the file doesn’t
|
||||
;; Find and visit a file in the ‘oni-org-exocortex-directory’. If the file doesn’t
|
||||
;; exist yet, it’s created and the title is inserted into it.
|
||||
(defun oni-org-find-knowledge-file ()
|
||||
(defun oni-org-find-exocortex-file ()
|
||||
(interactive)
|
||||
(let* ((default-directory oni-org-knowledge-directory)
|
||||
(completions (oni-org--get-knowledge-files))
|
||||
(let* ((default-directory oni-org-exocortex-directory)
|
||||
(completions (oni-org--get-exocortex-files))
|
||||
(pick (completing-read "File: " completions))
|
||||
(file (car (alist-get pick completions nil nil #'string=))))
|
||||
(if file
|
||||
|
@ -135,11 +135,11 @@
|
|||
(find-file (oni-org--create-name pick))
|
||||
(insert "#+TITLE: " pick "\n\n"))))
|
||||
|
||||
;; Insert a link to a file in the ‘oni-org-knowledge-directory’ into the current
|
||||
;; Insert a link to a file in the ‘oni-org-exocortex-directory’ into the current
|
||||
;; buffer. Don’t visit the file, just insert a link to it.
|
||||
(defun oni-org-insert-knowledge-link ()
|
||||
(defun oni-org-insert-exocortex-link ()
|
||||
(interactive)
|
||||
(let* ((completions (oni-org--get-knowledge-files))
|
||||
(let* ((completions (oni-org--get-exocortex-files))
|
||||
(pick (completing-read "File: " completions))
|
||||
(file (car (alist-get pick completions nil nil #'string=))))
|
||||
(unless file
|
||||
|
@ -147,7 +147,7 @@
|
|||
(with-current-buffer (find-file-noselect file)
|
||||
(insert "#+TITLE: " pick "\n\n")
|
||||
(save-buffer)))
|
||||
(insert "[[file:" (file-relative-name file oni-org-knowledge-directory) "][" pick "]]")))
|
||||
(insert "[[file:" (file-relative-name file oni-org-exocortex-directory) "][" pick "]]")))
|
||||
|
||||
;;; Functions
|
||||
|
||||
|
@ -293,8 +293,8 @@ _di_: Add inlineimages STARTUP
|
|||
("t" (org-capture nil "t"))
|
||||
("A" (org-capture nil "a"))
|
||||
("j" (org-capture nil "j"))
|
||||
("f" oni-org-find-knowledge-file)
|
||||
("i" oni-org-insert-knowledge-link)
|
||||
("f" oni-org-find-exocortex-file)
|
||||
("i" oni-org-insert-exocortex-link)
|
||||
("di" oni-org-document-add-inline-images-startup))
|
||||
|
||||
(defun oni-org-in-dblock-p ()
|
||||
|
|
Loading…
Reference in a new issue