diff options
| -rw-r--r-- | bard-elisp/bard-writing.el | 25 | ||||
| -rw-r--r-- | bard-emacs-modules/bard-emacs-writing.el | 24 |
2 files changed, 42 insertions, 7 deletions
diff --git a/bard-elisp/bard-writing.el b/bard-elisp/bard-writing.el new file mode 100644 index 0000000..f5b9079 --- /dev/null +++ b/bard-elisp/bard-writing.el @@ -0,0 +1,25 @@ +(defun denote-sequence-region () + "Call `denote-sequence' and insert therein the text of the active region. + +Note that, currently, `denote-save-buffers' and +`denote-kill-buffers' are NOT respected. The buffer is not +saved or killed at the end of `denote-sequence-region'." + (declare (interactive-only t)) + (interactive) + (if-let* (((region-active-p)) + ;; We capture the text early, otherwise it will be empty + ;; the moment `insert' is called. + (text (buffer-substring-no-properties (region-beginning) (region-end)))) + (progn + (let ((denote-ignore-region-in-denote-command t) + ;; FIXME: Find a way to insert the region before the buffer is + ;; saved/killed by the creation command. + (denote-save-buffers nil) + (denote-kill-buffers nil)) + (call-interactively 'denote-sequence)) + (push-mark (point)) + (insert text) + (run-hook-with-args 'denote-region-after-new-note-functions (mark) (point))) + (call-interactively 'denote-sequence))) + +(provide 'bard-writing) diff --git a/bard-emacs-modules/bard-emacs-writing.el b/bard-emacs-modules/bard-emacs-writing.el index 9d7cf73..b428a6a 100644 --- a/bard-emacs-modules/bard-emacs-writing.el +++ b/bard-emacs-modules/bard-emacs-writing.el @@ -89,16 +89,24 @@ "biology" )) (setq denote-templates - '((default . "* ") + '((default . "Related to — ") (physics . "* Introduction\n** Hypothesis\n** Materials\n* Procedure\n* Data\n* Conclusion") (writing . "* Prompt\n* Outline\n* Response"))) (setq denote-save-buffers t) - (setq denote-prompts '(title keywords template)) + (setq denote-prompts '(title keywords signature)) (setq denote-sort-dired-extra-prompts nil) (setq denote-sort-dired-default-sort-component 'identifier) (setq denote-sort-dired-default-reverse-sort nil) + ;; backlinks sidebar + (setq denote-backlinks-display-buffer-action + '((display-buffer-in-direction) + (direction . right) + (window-width . 0.33) + (window-height . fit-window-to-buffer) + (dedicated . t))) + (denote-rename-buffer-mode 1) (defun bard/find-notes-file () (interactive) @@ -117,7 +125,7 @@ (bard/scroll-center-cursor-mode t))) :bind (("C-c n n" . denote) - ("C-c n <SPC>" . denote-region) + ("C-c n <TAB>" . denote-region) ("C-c n o" . denote-sort-dired) ("C-c n j" . denote-journal-extras-new-entry) ("C-c n r" . denote-rename-file-using-front-matter) @@ -125,8 +133,8 @@ ("C-c n i" . denote-link) ("C-c n I" . denote-add-links) ("C-c n b" . denote-backlinks) - ("C-c n f" . bard/find-notes-file) - ("C-c n s" . bard/search-notes-directory) + ("C-c n f" . bard/find-notes-file) ; notes-find + ("C-c n g" . bard/search-notes-directory) ; notes-grep ("C-c n l" . denote-find-link) ("C-c n L" . denote-find-backlink))) @@ -143,10 +151,12 @@ (use-package denote-sequence :ensure t + :config + (require 'bard-writing) :bind ("C-c n N" . denote-sequence) - ("C-c n z" . denote-rename-file-signature) - ("C-c n O" . denote-sequence-dired)) + ("C-c n O" . denote-sequence-dired) + ("C-c n <SPC>" . denote-sequence-region)) ;;; Focus mode for writing |
