aboutsummaryrefslogtreecommitdiff
path: root/bard-elisp/bard-writing.el
diff options
context:
space:
mode:
authorBardofSprites <[email protected]>2025-07-19 14:08:54 -0400
committerBardofSprites <[email protected]>2025-07-19 14:08:54 -0400
commita1a83fa8348c7b10ddef0ca06afcdf0f8c387af9 (patch)
treecb0c50ae76aec4526988e46fea5aef01091cfb5c /bard-elisp/bard-writing.el
parent66b30ddfbc666d67e5cb8516798cdd915ffe56c7 (diff)
update denote settings
Diffstat (limited to 'bard-elisp/bard-writing.el')
-rw-r--r--bard-elisp/bard-writing.el25
1 files changed, 25 insertions, 0 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)