(feat)dailies: add keys argument to org-roam-dailies-capture-today and org-roam-dailies--capture (#2028)

This commit is contained in:
Andrey Akulov
2022-01-12 01:13:40 +03:00
committed by GitHub
parent 8b43093d1a
commit b67bccd6c2
2 changed files with 13 additions and 5 deletions

View File

@ -3,6 +3,7 @@
## TBD ## TBD
### Added ### Added
- [#1806](https://github.com/org-roam/org-roam/pull/1806) db: support caching and usage of Org 9.5's in-built citations - [#1806](https://github.com/org-roam/org-roam/pull/1806) db: support caching and usage of Org 9.5's in-built citations
- [#2028](https://github.com/org-roam/org-roam/pull/2028) dailies: add `keys` argument to `org-roam-dailies-capture-today` and `org-roam-dailies--capture` functions to give the abilty to get into a capture buffer bypassing the selection screen
### Removed ### Removed
### Changed ### Changed

View File

@ -130,11 +130,14 @@ See `org-roam-capture-templates' for the template documentation."
;;; Commands ;;; Commands
;;;; Today ;;;; Today
;;;###autoload ;;;###autoload
(defun org-roam-dailies-capture-today (&optional goto) (defun org-roam-dailies-capture-today (&optional goto keys)
"Create an entry in the daily-note for today. "Create an entry in the daily-note for today.
When GOTO is non-nil, go the note without creating an entry." When GOTO is non-nil, go the note without creating an entry.
ELisp programs can set KEYS to a string associated with a template.
In this case, interactive selection will be bypassed."
(interactive "P") (interactive "P")
(org-roam-dailies--capture (current-time) goto)) (org-roam-dailies--capture (current-time) goto keys))
;;;###autoload ;;;###autoload
(defun org-roam-dailies-goto-today () (defun org-roam-dailies-goto-today ()
@ -300,11 +303,15 @@ Return (MONTH DAY YEAR) or nil if not an Org time-string."
;;; Capture implementation ;;; Capture implementation
(add-to-list 'org-roam-capture--template-keywords :override-default-time) (add-to-list 'org-roam-capture--template-keywords :override-default-time)
(defun org-roam-dailies--capture (time &optional goto) (defun org-roam-dailies--capture (time &optional goto keys)
"Capture an entry in a daily-note for TIME, creating it if necessary. "Capture an entry in a daily-note for TIME, creating it if necessary.
When GOTO is non-nil, go the note without creating an entry." When GOTO is non-nil, go the note without creating an entry.
ELisp programs can set KEYS to a string associated with a template.
In this case, interactive selection will be bypassed."
(let ((org-roam-directory (expand-file-name org-roam-dailies-directory org-roam-directory))) (let ((org-roam-directory (expand-file-name org-roam-dailies-directory org-roam-directory)))
(org-roam-capture- :goto (when goto '(4)) (org-roam-capture- :goto (when goto '(4))
:keys keys
:node (org-roam-node-create) :node (org-roam-node-create)
:templates org-roam-dailies-capture-templates :templates org-roam-dailies-capture-templates
:props (list :override-default-time time))) :props (list :override-default-time time)))