mirror of
https://github.com/pestctrl/emacs-config.git
synced 2026-02-16 08:14:15 +00:00
I wanna use the logger in normal life too
This commit is contained in:
parent
baff8abb73
commit
833ef252f6
4 changed files with 105 additions and 38 deletions
|
|
@ -655,7 +655,7 @@
|
|||
:custom
|
||||
(org-roam-directory (expand-file-name "org-roam" my/org-folder))
|
||||
(org-roam-use-completion-everywhere t)
|
||||
:bind (("C-c n l" . org-roam-buffer-toggle)
|
||||
:bind (("C-c n h" . org-roam-buffer-toggle)
|
||||
("C-c n f" . org-roam-node-find)
|
||||
("C-c n T" . org-roam-dailies-goto-today)
|
||||
("C-c n t" . org-roam-dailies-capture-today)
|
||||
|
|
@ -684,7 +684,9 @@
|
|||
;; :target (file+head+olp "%<%Y-%m-%d>.org"
|
||||
;; "#+title: %<%Y-%m-%d>\n#+filetags: %<:%Y:%B:>\n"
|
||||
;; ("Most Important Thing(s)")))
|
||||
)))
|
||||
))
|
||||
(require 'my-org-roam-logger)
|
||||
(global-set-key (kbd "C-c n l") #'my/org-roam-logger-capture-current))
|
||||
|
||||
;; (require 'org-roam-protocol)
|
||||
#+end_src
|
||||
|
|
|
|||
48
lisp/org-config/my-org-roam-logger.el
Normal file
48
lisp/org-config/my-org-roam-logger.el
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
;;; my-org-roam-journal.el --- -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2022 Benson Chu
|
||||
|
||||
;; Author: Benson Chu <bensonchu457@gmail.com>
|
||||
;; Created: [2022-01-19 22:02]
|
||||
|
||||
;; This file is not part of GNU Emacs
|
||||
|
||||
;; This program is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
(require 'org-roam)
|
||||
(require 'org-roam-util)
|
||||
|
||||
(defvar my/current-logger-cache nil)
|
||||
(defvar my/org-roam-logger-filter-fun nil)
|
||||
|
||||
(defun my/org-roam-logger-capture-current (arg)
|
||||
(interactive "P")
|
||||
(when (or (null my/current-logger-cache) arg)
|
||||
(setq my/current-logger-cache
|
||||
(org-roam-node-read nil my/org-roam-logger-filter-fun)))
|
||||
(org-roam-capture-
|
||||
:node my/current-logger-cache
|
||||
:templates '(("d" "default" entry "* %<%H:%M> %?"
|
||||
:unnarrowed t
|
||||
:target
|
||||
(file+head+olp "%<%Y%m%d%H%M%S>-${slug}.org"
|
||||
"#+title: ${title}\n"
|
||||
("Journal" "%<%b %d, %Y>"))))
|
||||
:props '(:finalize find-file)))
|
||||
|
||||
(provide 'my-org-roam-logger)
|
||||
;;; my-org-roam-logger.el ends here
|
||||
39
lisp/org-config/org-roam-util.el
Normal file
39
lisp/org-config/org-roam-util.el
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
;;; org-roam-util.el --- -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2022 Benson Chu
|
||||
|
||||
;; Author: Benson Chu <bensonchu457@gmail.com>
|
||||
;; Created: [2022-01-19 22:02]
|
||||
|
||||
;; This file is not part of GNU Emacs
|
||||
|
||||
;; This program is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
(require 'org-roam)
|
||||
|
||||
(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))))
|
||||
|
||||
(provide 'org-roam-util)
|
||||
;;; org-roam-util.el ends here
|
||||
|
|
@ -392,15 +392,18 @@
|
|||
"#+title: %<%Y-%m-%d>\n#+filetags: %<:%Y:%B:>\n"
|
||||
("Standup Notes for %u")))))
|
||||
|
||||
(defun my/org-roam-filter-by-tag (tag-name)
|
||||
(lambda (node)
|
||||
(member tag-name (org-roam-node-tags node))))
|
||||
(setq org-roam-capture-templates
|
||||
'(("d" "default" plain "%?" :target
|
||||
(file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
|
||||
:unnarrowed t)
|
||||
("j" "Journal" entry "* %<%H:%M> %?"
|
||||
:unnarrowed t
|
||||
:target
|
||||
(file+head+olp "%<%Y%m%d%H%M%S>-${slug}.org"
|
||||
"#+title: ${title}\n"
|
||||
("Journal" "%<%b %d, %Y>")))))
|
||||
|
||||
(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))))
|
||||
(require 'org-roam-util)
|
||||
|
||||
(defun my/org-roam-find-project ()
|
||||
(interactive)
|
||||
|
|
@ -416,35 +419,10 @@
|
|||
|
||||
(global-set-key (kbd "C-c n p") #'my/org-roam-find-project)
|
||||
|
||||
(setq org-roam-capture-templates
|
||||
'(("d" "default" plain "%?" :target
|
||||
(file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
|
||||
:unnarrowed t)
|
||||
("j" "Journal" entry "* %<%H:%M> %?"
|
||||
:unnarrowed t
|
||||
:target
|
||||
(file+head+olp "%<%Y%m%d%H%M%S>-${slug}.org"
|
||||
"#+title: ${title}\n"
|
||||
("Journal" "%<%b %d, %Y>")))))
|
||||
(require 'my-org-roam-logger)
|
||||
|
||||
(defvar my/current-journal-cache nil)
|
||||
|
||||
(defun my/org-roam-journal-capture-current (arg)
|
||||
(interactive "P")
|
||||
(when (or (null my/current-journal-cache) arg)
|
||||
(setq my/current-journal-cache
|
||||
(org-roam-node-read nil (my/org-roam-filter-by-tag "Project"))))
|
||||
(org-roam-capture-
|
||||
:node my/current-journal-cache
|
||||
:templates '(("d" "default" entry "* %<%H:%M> %?"
|
||||
:unnarrowed t
|
||||
:target
|
||||
(file+head+olp "%<%Y%m%d%H%M%S>-${slug}.org"
|
||||
"#+title: ${title}\n"
|
||||
("Journal" "%<%b %d, %Y>"))))
|
||||
:props '(:finalize find-file)))
|
||||
|
||||
(global-set-key (kbd "C-c n j") #'my/org-roam-journal-capture-current))
|
||||
(setq my/org-roam-logger-filter-fun (my/org-roam-filter-by-tag "Project"))
|
||||
(global-set-key (kbd "C-c n j") #'my/org-roam-logger-capture-current))
|
||||
|
||||
(provide 'work-org-stuff)
|
||||
;;; work-org-stuff.el ends here
|
||||
|
|
|
|||
Loading…
Reference in a new issue