Browse Source

removed org-roam for good

master
Marc 2 weeks ago
parent
commit
60f4a515e1
1 changed files with 0 additions and 244 deletions
  1. 244
      config.org

244
config.org

@ -1469,250 +1469,6 @@ Ggf. durch org-roam-journal ersetzen
org-journal-enable-agenda-integration t)))
#+END_SRC
** COMMENT org-roam
[[https://github.com/org-roam/org-roam][Github]]
Um Headings innerhalb einer Datei zu verlinken:
- org-id-get-create im Heading,
- org-roam-node-insert in der verweisenden Datei
Bei Problemen wie unique constraint
org-roam-db-clear-all
org-roam-db-sync
#+BEGIN_SRC emacs-lisp
;(use-package emacsql-sqlite-builtin
; :ensure t)
(defun my--buffer-prop-set (name value)
"Set a file property called NAME to VALUE in buffer file.
If the property is already set, replace its value."
(setq name (downcase name))
(org-with-point-at 1
(let ((case-fold-search t))
(if (re-search-forward (concat "^#\\+" name ":\\(.*\\)")
(point-max) t)
(replace-match (concat "#+" name ": " value) 'fixedcase)
(while (and (not (eobp))
(looking-at "^[#:]"))
(if (save-excursion (end-of-line) (eobp))
(progn
(end-of-line)
(insert "\n"))
(forward-line)
(beginning-of-line)))
(insert "#+" name ": " value "\n")))))
(defun my--buffer-prop-remove (name)
"Remove a buffer property called NAME."
(org-with-point-at 1
(when (re-search-forward (concat "\\(^#\\+" name ":.*\n?\\)")
(point-max) t)
(replace-match ""))))
(use-package org-roam
; :requires emacsql-sqlite-builtin
:ensure t
:defer 2
:after org
:init
(setq org-roam-v2-ack t)
(defun my--roamtodo-p ()
"Return non-nil if current buffer has any todo entry.
TODO entries marked as done are ignored, meaning this function
returns nil if current buffer contains only completed tasks."
(seq-find
(lambda (type)
(eq type 'todo))
(org-element-map
(org-element-parse-buffer 'headline)
'headline
(lambda (h)
(org-element-property :todo-type h)))))
(defun my--roamtodo-update-tag ()
"Update ROAMTODO tag in the current buffer."
(when (and (not (active-minibuffer-window))
(my--buffer-roam-note-p))
(save-excursion
(goto-char (point-min))
(let* ((tags (my--buffer-tags-get))
(original-tags tags))
(if (my--roamtodo-p)
(setq tags (cons "roamtodo" tags))
(setq tags (remove "roamtodo" tags)))
;;cleanup duplicates
(when (or (seq-difference tags original-tags)
(seq-difference original-tags tags))
(apply #'my--buffer-tags-set tags))))))
(defun my--buffer-tags-get ()
"Return filetags value in current buffer."
(my--buffer-prop-get-list "filetags" "[ :]"))
(defun my--buffer-tags-set (&rest tags)
"Set TAGS in current buffer.
If filetags value is already set, replace it."
(if tags
(my--buffer-prop-set
"filetags" (concat ":" (string-join tags ":") ":"))
(my--buffer-prop-remove "filetags")))
(defun my--buffer-tags-add (tag)
"Add a TAG to filetags in current buffer."
(let* ((tags (my--buffer-tags-get))
(tags (append tags (list tag))))
(apply #'my--buffer-tags-set tags)))
(defun my--buffer-tags-remove (tag)
"Remove a TAG from filetags in current buffer."
(let* ((tags (my--buffer-tags-get))
(tags (delete tag tags)))
(apply #'my--buffer-tags-set tags)))
(defun my--buffer-prop-set (name value)
"Set a file property called NAME to VALUE in buffer file.
If the property is already set, replace its value."
(setq name (downcase name))
(org-with-point-at 1
(let ((case-fold-search t))
(if (re-search-forward (concat "^#\\+" name ":\\(.*\\)")
(point-max) t)
(replace-match (concat "#+" name ": " value) 'fixedcase)
(while (and (not (eobp))
(looking-at "^[#:]"))
(if (save-excursion (end-of-line) (eobp))
(progn
(end-of-line)
(insert "\n"))
(forward-line)
(beginning-of-line)))
(insert "#+" name ": " value "\n")))))
(defun my--buffer-prop-set-list (name values &optional separators)
"Set a file property called NAME to VALUES in current buffer.
VALUES are quoted and combined into single string using
`combine-and-quote-strings'.
If SEPARATORS is non-nil, it should be a regular expression
matching text that separates, but is not part of, the substrings.
If nil it defaults to `split-string-and-unquote', normally
\"[ \f\t\n\r\v]+\", and OMIT-NULLS is forced to t.
If the property is already set, replace its value."
(my--buffer-prop-set
name (combine-and-quote-strings values separators)))
(defun my--buffer-prop-get (name)
"Get a buffer property called NAME as a string."
(org-with-point-at 1
(when (re-search-forward (concat "^#\\+" name ": \\(.*\\)")
(point-max) t)
(buffer-substring-no-properties
(match-beginning 1)
(match-end 1)))))
(defun my--buffer-prop-get-list (name &optional separators)
"Get a buffer property NAME as a list using SEPARATORS.
If SEPARATORS is non-nil, it should be a regular expression
matching text that separates, but is not part of, the substrings.
If nil it defaults to `split-string-default-separators', normally
\"[ \f\t\n\r\v]+\", and OMIT-NULLS is forced to t."
(let ((value (my--buffer-prop-get name)))
(when (and value (not (string-empty-p value)))
(split-string-and-unquote value separators))))
(defun my--buffer-prop-remove (name)
"Remove a buffer property called NAME."
(org-with-point-at 1
(when (re-search-forward (concat "\\(^#\\+" name ":.*\n?\\)")
(point-max) t)
(replace-match ""))))
(defun my--buffer-roam-note-p ()
"Return non-nil if the currently visited buffer is a note."
(and buffer-file-name
(string-prefix-p
(expand-file-name (file-name-as-directory MY--PATH_ORG_ROAM))
(file-name-directory buffer-file-name))))
(defun my--org-roam-filter-by-tag (tag-name)
(lambda (node)
(member tag-name (org-roam-node-tags node))))
(defun my--org-roam-list-notes-by-tag (tag-name)
(mapcar #'org-roam-node-file
(seq-filter
(my--org-roam-filter-by-tag tag-name)
(org-roam-node-list))))
;; (defun my/org-roam-refresh-agenda-list ()
;; "Add all org roam files with #+filetags: roamtodo"
;; (interactive)
;; (my--org-agenda-files-set)
;; (nconc org-agenda-files
;; (my--org-roam-list-notes-by-tag "roamtodo"))
;; (setq org-agenda-files (delete-dups org-agenda-files)))
(add-hook 'find-file-hook #'my--roamtodo-update-tag)
(add-hook 'before-save-hook #'my--roamtodo-update-tag)
;; (advice-add 'org-agenda :before #'my/org-roam-refresh-agenda-list)
;; (advice-add 'org-todo-list :before #'my/org-roam-refresh-agenda-list)
(add-to-list 'org-tags-exclude-from-inheritance "roamtodo")
:config
(require 'org-roam-dailies) ;; ensure the keymap is available
(org-roam-db-autosync-mode)
;; build the agenda list the first ime for the session
;; (my/org-roam-refresh-agenda-list)
(when *work_remote*
(setq org-roam-capture-templates
'(("n" "note" plain
"%?"
:if-new (file+head "notes/%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
:unnarrowed t)
("i" "idea" plain
"%?"
:if-new (file+head "ideas/%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
:unnarrowed t)
("p" "project" plain
"%?"
:target (file+head "projects/${slug}.org" "#+title: ${title}\n#+filetags: :project:\n")
:unnarrowed t)
("s" "Sicherheitenmeldung" plain
"*** TODO [#A] Sicherheitenmeldung ${title}\n :PROPERTIES:\n :ID: %(org-id-uuid)\n:END:\n%u\n"
:target (file+olp "tasks.org" ("Todos" "Sicherheitenmeldungen")))
("m" "Monatsbericht" plain
"*** TODO [#A] Monatsbericht ${title}\n :PROPERTIES:\n :ID: %(org-id-uuid)\n:END:\n%u\n"
:target (file+olp "tasks.org" ("Todos" "Monatsberichte"))))))
:custom
(org-roam-database-connector 'sqlite-builtin)
(org-roam-directory MY--PATH_ORG_ROAM)
(org-roam-completion-everywhere t)
(org-roam-capture-templates
'(("n" "note" plain
"%?"
:if-new (file+head "notes/%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
:unnarrowed t)
("i" "idea" plain
"%?"
:if-new (file+head "ideas/%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
:unnarrowed t)
))
:bind (("C-c n l" . org-roam-buffer-toggle)
("C-c n f" . org-roam-node-find)
("C-c n i" . org-roam-node-insert)
:map org-mode-map
("C-M-i" . completion-at-point)
:map org-roam-dailies-map
("Y" . org-roam-dailies-capture-yesterday)
("T" . org-roam-dailies-capture-tomorrow))
:bind-keymap
("C-c n d" . org-roam-dailies-map))
#+END_SRC
** org-node (alternative to org-roam)
https://github.com/meedstrom/org-node
no sqlite, just plain text and linking with ids

Loading…
Cancel
Save