aboutsummaryrefslogtreecommitdiff
path: root/bard-elisp/bard-writing.el
diff options
context:
space:
mode:
Diffstat (limited to 'bard-elisp/bard-writing.el')
-rw-r--r--bard-elisp/bard-writing.el111
1 files changed, 35 insertions, 76 deletions
diff --git a/bard-elisp/bard-writing.el b/bard-elisp/bard-writing.el
index 8138b1a..2ab9c0a 100644
--- a/bard-elisp/bard-writing.el
+++ b/bard-elisp/bard-writing.el
@@ -6,29 +6,20 @@
(defvar bard/consult--source-notes
`(:name "Note Buffers"
- :narrow ?n
- :category buffer
- :face consult-buffer
- :history buffer-name-history
- :items ,(lambda ()
- (mapcar #'buffer-name
- (seq-filter
- (lambda (buf)
- (string-prefix-p "[Note]" (buffer-name buf)))
- (beframe-buffer-list))))
- :action ,#'switch-to-buffer
- :state ,#'consult--buffer-state)
+ :narrow ?n
+ :category buffer
+ :face consult-buffer
+ :history buffer-name-history
+ :items ,(lambda ()
+ (mapcar #'buffer-name
+ (seq-filter
+ (lambda (buf)
+ (string-prefix-p "[Note]" (buffer-name buf)))
+ (beframe-buffer-list))))
+ :action ,#'switch-to-buffer
+ :state ,#'consult--buffer-state)
"Consult source for note buffers (limited to beframe buffers).")
-
-(defun bard/find-notes-file ()
- (interactive)
- (consult-find "~/Notes/denote"))
-
-(defun bard/search-notes-directory ()
- (interactive)
- (consult-grep "~/Notes/denote"))
-
(defun bard/consult-buffer-notes ()
"Show `consult-buffer` limited to buffers starting with [Note]."
(interactive)
@@ -40,37 +31,21 @@
(ibuffer nil "*Ibuffer-Notes*"
'((name . "^\\[Note\\]"))))
-(defun denote-sequence-region ()
- "Call `denote-sequence' and insert therein the text of the active region.
+(defun bard/find-notes-file ()
+ (interactive)
+ (consult-find "~/Notes/denote"))
-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))
+(defun bard/search-notes-directory ()
(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)))
+ (consult-grep "~/Notes/denote"))
(defvar bard/class-dirs
- '(("ANTH 204" . "~/Documents/dox/Uni/FALL2025-ANTH 204/")
- ("CHEM 201" . "~/Documents/dox/Uni/FALL2025-CHEM 201/")
- ("CHEM 207" . "~/Documents/dox/Uni/FALL2025-CHEM 207/")
- ("ENGL 105" . "~/Documents/dox/Uni/FALL2025-ENGL 105/")
- ("ENGR 101" . "~/Documents/dox/Uni/FALL2025-ENGR 101/")
- ("ENGR 110" . "~/Documents/dox/Uni/FALL2025-ENGR 110/"))
+ '(("ANTH 204" . "~/Documents/Uni/FALL2025-ANTH 204/")
+ ("CHEM 201" . "~/Documents/Uni/FALL2025-CHEM 201/")
+ ("CHEM 207" . "~/Documents/Uni/FALL2025-CHEM 207/")
+ ("ENGL 105" . "~/Documents/Uni/FALL2025-ENGL 105/")
+ ("ENGR 101" . "~/Documents/Uni/FALL2025-ENGR 101/")
+ ("ENGR 110" . "~/Documents/Uni/FALL2025-ENGR 110/"))
"Mapping of class names to their document directories.")
(defvar bard/uni-notes-file "~/Notes/denote/uni.org"
@@ -96,27 +71,6 @@ saved or killed at the end of `denote-sequence-region'."
(with-selected-window dired-window
(dired dir)))))
-;; (defun bard/jump-to-class-new-frame (class)
-;; "Open CLASS notes and dir in a new frame titled after CLASS."
-;; (interactive
-;; (list (completing-read "Class: " (mapcar #'car bard/class-dirs))))
-;; (let* ((dir (cdr (assoc class bard/class-dirs)))
-;; ;; make a new frame with title
-;; (frame (make-frame `((name . ,class)))))
-;; (select-frame-set-input-focus frame)
-;; (delete-other-windows)
-;; (let ((notes-window (selected-window))
-;; (dired-window (split-window-right)))
-;; ;; open notes file and jump to heading
-;; (with-selected-window notes-window
-;; (find-file bard/uni-notes-file)
-;; (widen)
-;; (goto-char (point-min))
-;; (search-forward class nil nil))
-;; ;; open dired in right window
-;; (with-selected-window dired-window
-;; (dired dir)))))
-
(defun bard/jump-to-class-new-frame (class)
"Open CLASS notes and dir in a new frame titled after CLASS, even with beframe."
(interactive
@@ -141,15 +95,21 @@ saved or killed at the end of `denote-sequence-region'."
(global-set-key (kbd "C-c U") #'bard/jump-to-class-new-frame)
(defun bard/denote-todo-template ()
- "Return string for daily tasks heading in `denote-journal' entries"
- (format "* Tasks for %s\n\n* Notes for today"
- (format-time-string "%Y-%m-%d (%a)")))
+ "Return string for daily tasks heading in `denote-journal' entries."
+ (with-temp-buffer
+ (org-mode)
+ (insert (format "* Tasks for %s\n** Время я потратил бездельничая\n\n* Notes for today\n\n"
+ (format-time-string "%Y-%m-%d (%a)")))
+ (let ((org-clock-clocktable-default-properties
+ '(:scope file :maxlevel 3 :link nil :compact t)))
+ (org-clock-report))
+ (buffer-string)))
;; Taken from: https://stackoverflow.com/a/75314192
(defun add-multiple-into-list (lst items)
- "Add each item from ITEMS into LST."
- (dolist (item items)
- (add-to-list lst item)))
+ "Add each item from ITEMS into LST."
+ (dolist (item items)
+ (add-to-list lst item)))
(defun bard/cdlatex-add-math-symbols ()
"Add functions into list."
@@ -167,5 +127,4 @@ saved or killed at the end of `denote-sequence-region'."
(electric-pair-local-mode t)
(bard/cdlatex-add-math-symbols))
-
(provide 'bard-writing)