Add fields to the frontmater and a question #551
Closed
quijote-asim
started this conversation in
Ideas
Replies: 2 comments 1 reply
-
(setq denote-org-front-matter
"#+title: %s
#+date: %s
#+filetags: %s
#+identifier: %s
#+signature: %s
#+category:
#+lastmod:
#+startup: content
\n") With that, every new note will have these fields and you will be able to fill them yourself.
I'll give you a solution, for now: (defun my/update-lastmod-keyword ()
"Update #+lastmod keyword for Denote files."
(when (denote-file-is-note-p buffer-file-name)
;; In the above line, we check if we are saving a note. If (and
;; only if) that is true, then we instruct Emacs to do the
;; following:
(save-excursion
(goto-char (point-min))
;; We just moved to the start of the file. Now, we search the
;; keyword we want:
(when (re-search-forward "^#\\+lastmod: +" nil t)
;; If (and only if) we found it, then we clean it by deleting
;; the previous modification time
(delete-region (point) (line-end-position))
;; Now we insert the new modification time using Org (I assume
;; you use Org by the keywords you used)
(org-insert-timestamp (current-time) t t)))))
;; The next line instructs Emacs to call the previous function before
;; saving a file
(add-hook 'before-save-hook #'my/update-lastmod-keyword) That's it! Just add that to your configuration. Be sure to add it after loading Denote (if you use use-package, add it under the :config block). |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks you for your suggestions |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to be able to include in the frontmatter of the notes these fields:
#+category:
#+lastmod:
#+startup: content (or shownlevels)
This raises two questions for me:
Thanks
Beta Was this translation helpful? Give feedback.
All reactions