Browse Source

moved roam function to proper place, minor change in org loading

master
Marc 1 year ago
parent
commit
92b9bb6ab3
1 changed files with 112 additions and 79 deletions
  1. 191
      config.org

191
config.org

@ -778,26 +778,35 @@ When moving BAR to archive, it will go to FILENAME.org_archive below the heading
[[http://doc.endlessparentheses.com/Var/org-archive-location.html][Other examples]] [[http://doc.endlessparentheses.com/Var/org-archive-location.html][Other examples]]
** org ** org
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun me/org-roam-filter-by-tag (tag-name)
(lambda (node)
(member tag-name (org-roam-node-tags node))))
(defun me/org-roam-list-notes-by-tag (tag-name)
(mapcar #'org-roam-node-file
(seq-filter
(me/org-roam-filter-by-tag tag-name)
(org-roam-node-list))))
(defun me/org-roam-refresh-agenda-list ()
"Add all org roam files with #+filetags: Project"
(interactive)
;; (setq org-agenda-files (me/org-roam-list-notes-by-tag "Project")))
(nconc org-agenda-files
(me/org-roam-list-notes-by-tag "Project")))
(defun me--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 me--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 (use-package org
:ensure org-contrib
:pin gnu
:ensure t
:mode (("\.org$" . org-mode)) :mode (("\.org$" . org-mode))
:diminish org-indent-mode :diminish org-indent-mode
:defer t :defer t
@ -832,9 +841,6 @@ When moving BAR to archive, it will go to FILENAME.org_archive below the heading
(setq org-id-locations-file (concat MY--PATH_USER_LOCAL ".org-id-locations") (setq org-id-locations-file (concat MY--PATH_USER_LOCAL ".org-id-locations")
org-log-into-drawer "LOGBOOK") org-log-into-drawer "LOGBOOK")
;; build the agenda list the first ime for the session
(me/org-roam-refresh-agenda-list)
;; some display customizations ;; some display customizations
(setq org-pretty-entities t (setq org-pretty-entities t
org-startup-truncated t org-startup-truncated t
@ -1055,66 +1061,93 @@ Bei Problemen wie unique constraint
org-roam-db-clear-all org-roam-db-clear-all
org-roam-db-sync org-roam-db-sync
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package org-roam
:ensure t
:defer t
:init
(setq org-roam-v2-ack t)
:config
(require 'org-roam-dailies) ;; ensure the keymap is available
(org-roam-db-autosync-mode)
:custom
(org-roam-directory MY--PATH_ORG_ROAM)
(org-roam-completion-everywhere t)
(org-roam-capture-templates
'(("d" "default" plain
"%?"
:if-new (file+head "notes/%<%Y%m%d%H%M%S>-${plug}.org" "#+title: ${title}\n")
:unnarrowed t)
("n" "ndefault" plain
"%?"
:if-new (file+head "ideas/%<%Y%m%d%H%M%S>-${plug}.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))
(use-package org-roam
:if (eq *sys/windows* t)
:init
(setq exec-path (append exec-path '("P:/Tools/sqlite")))
(use-package emacsql-sqlite3
(use-package org-roam
:ensure t :ensure t
:defer t
:after org
:init :init
(setq emacsql-sqlite3-binary "P:/Tools/sqlite/sqlite3.exe"))
:config
(add-to-list 'org-roam-capture-templates
'("t" "telephone call" plain
"%?"
:if-new (file+head "telephone/%<%Y%m%d%H%M%S>-${plug}.org" "#+title: CALL %<%Y-%m-%d %H:%M> ${title}\n")
:unnarrowed t) t)
(add-to-list 'org-roam-capture-templates
'("p" "new Project" plain
"** ${title}\n :PROPERTIES:\n :ID: %(org-id-uuid)\n:END:\n%u\n"
:target (file+olp "projects.org" ("Active"))) t)
(add-to-list 'org-roam-capture-templates
'("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"))) t)
(add-to-list 'org-roam-capture-templates
'("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"))) t)
:custom
(org-roam-database-connector 'sqlite3))
(setq org-roam-v2-ack t)
(defun me--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 me/org-roam-filter-by-tag (tag-name)
(lambda (node)
(member tag-name (org-roam-node-tags node))))
(defun me/org-roam-list-notes-by-tag (tag-name)
(mapcar #'org-roam-node-file
(seq-filter
(me/org-roam-filter-by-tag tag-name)
(org-roam-node-list))))
(defun me/org-roam-refresh-agenda-list ()
"Add all org roam files with #+filetags: Project"
(interactive)
(nconc org-agenda-files
(me/org-roam-list-notes-by-tag "Project")))
: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
(me/org-roam-refresh-agenda-list)
:custom
(org-roam-directory MY--PATH_ORG_ROAM)
(org-roam-completion-everywhere t)
(org-roam-capture-templates
'(("d" "default" plain
"%?"
:if-new (file+head "notes/%<%Y%m%d%H%M%S>-${plug}.org" "#+title: ${title}\n")
:unnarrowed t)
("n" "ndefault" plain
"%?"
:if-new (file+head "ideas/%<%Y%m%d%H%M%S>-${plug}.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))
(use-package org-roam
:if (eq *sys/windows* t)
:init
(setq exec-path (append exec-path '("P:/Tools/sqlite")))
(use-package emacsql-sqlite3
:ensure t
:init
(setq emacsql-sqlite3-binary "P:/Tools/sqlite/sqlite3.exe"))
:config
(add-to-list 'org-roam-capture-templates
'("t" "telephone call" plain
"%?"
:if-new (file+head "telephone/%<%Y%m%d%H%M%S>-${plug}.org" "#+title: CALL %<%Y-%m-%d %H:%M> ${title}\n")
:unnarrowed t) t)
(add-to-list 'org-roam-capture-templates
'("p" "new Project" plain
"** ${title}\n :PROPERTIES:\n :ID: %(org-id-uuid)\n:END:\n%u\n"
:target (file+olp "projects.org" ("Active"))) t)
(add-to-list 'org-roam-capture-templates
'("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"))) t)
(add-to-list 'org-roam-capture-templates
'("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"))) t)
:custom
(org-roam-database-connector 'sqlite3))
#+END_SRC #+END_SRC

Loading…
Cancel
Save