From 703101c4bdb114ad21ddccd77a7eb7d5ffa049c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?tr=C3=A9meur?= Date: Wed, 7 Dec 2022 19:56:45 +0000 Subject: [PATCH] Improve org-agenda --- agenda-common.el | 5 +++++ config.org | 31 +++++++++++++++++++------------ custom/periodise.el | 30 ++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 12 deletions(-) create mode 100644 custom/periodise.el diff --git a/agenda-common.el b/agenda-common.el index 1febe62..b166ba0 100644 --- a/agenda-common.el +++ b/agenda-common.el @@ -13,3 +13,8 @@ "mis Hedra" "mis Du" "mis Kevardhu"]) (setq org-todo-keywords '((sequence "TODO" "|" "DONE" "CANCELLED"))) +(setq org-agenda-time-grid + '((daily today require-timed remove-match) + (800 1000 1200 1400 1600 1800 2000) + "......" "----------------")) +(setq org-agenda-time-leading-zero t) diff --git a/config.org b/config.org index 4d69fd6..19c6a09 100644 --- a/config.org +++ b/config.org @@ -267,7 +267,6 @@ Standard =elfeed= settings: #+BEGIN_SRC emacs-lisp (defun elfeed-load-db-and-open () - "Wrapper to load the elfeed db from disk before opening" (interactive) (elfeed-db-load) (elfeed) @@ -283,7 +282,6 @@ Standard =elfeed= settings: '(define-key elfeed-search-mode-map (kbd "m") 'elfeed-toggle-star)) (defun elfeed-save-db-and-bury () - "Wrapper to save the elfeed db to disk before burying buffer" (interactive) (elfeed-db-save) (quit-window)) @@ -348,7 +346,6 @@ I kind of hate markdown but I still have to use it sometimes. ("\\.markdown\\'" . markdown-mode)) :init (add-hook 'markdown-mode-hook 'auto-fill-mode) - (add-hook 'markdown-mode-hook 'typo-mode) :config (setq markdown-asymmetric-header t) :custom @@ -551,11 +548,9 @@ Set the files to be included. #+BEGIN_SRC emacs-lisp (unless (atwork) (setq org-agenda-files (list "~/Documents/drive/org/calendar" - "~/Documents/drive/org/period.org" "~/Documents/drive/org/habit.org"))) (when (atwork) (setq org-agenda-files (list "~/Documents/drive/org/calendar" - "~/Documents/drive/org/period.org" "~/Documents/drive/org/acwri.org"))) #+END_SRC @@ -569,6 +564,15 @@ Set how the agenda looks. (setq org-use-property-inheritance (quote ("LOCATION"))) (setq org-agenda-todo-ignore-scheduled t) (setq org-agenda-todo-ignore-deadlines t) +#+END_SRC + +Add period information to the agenda header (this has a very weird output, completely different when you insert a function from just using text, utterly bizarre). + +#+BEGIN_SRC emacs-lisp + (setq org-agenda-custom-commands + '(("a" "Slightly modified agenda view" + ((agenda "" + ((org-agenda-overriding-header (periodise)))))))) #+END_SRC Use a horizontal line to divide each day from the next. @@ -666,15 +670,18 @@ As previously described, “the big boy”. I know little about most of these se ** =typo= -Automatically use smart quotes. (Can’t be set to =text-mode-hook=, unfortunately, as this messes things up in LaTeX; but the only other text-modes I use are =org= and Markdown, I think.) +Automatically use smart quotes. (Can’t be set to =text-mode-hook=, unfortunately, as this messes things up in LaTeX; but the only other text-modes I use are =org= and Markdown, I think.) Also, best to /unset/ this mode in source blocks in =org=, [[https://emacs.stackexchange.com/questions/55944/disable-minor-mode-inside-source-blocks][hook taken from here]]. #+BEGIN_SRC emacs-lisp - (use-package typo - :custom - (typo-global-mode 1) - :init - (add-hook 'org-mode-hook 'typo-mode) - (add-hook 'markdown-mode-hook 'typo-mode)) + (use-package typo + :custom + (typo-global-mode 1) + :init + (add-hook 'org-mode-hook 'typo-mode) + (add-hook 'markdown-mode-hook 'typo-mode)) + (defun unsmart-hook () + (add-hook 'typo-disable-electricity-functions 'org-in-src-block-p nil :local)) + (add-hook 'org-mode-hook 'unsmart-hook) #+END_SRC ** =yasnippet= diff --git a/custom/periodise.el b/custom/periodise.el new file mode 100644 index 0000000..6a8eaff --- /dev/null +++ b/custom/periodise.el @@ -0,0 +1,30 @@ +(defun periodise () + (setq periodfile "~/Documents/drive/org/period.org") + (find-file-noselect periodfile) + (setq thebuffer (file-name-nondirectory periodfile)) + (with-current-buffer thebuffer + (setq theyear (string-to-number (buffer-substring-no-properties 2 6))) + (setq themonth (string-to-number (buffer-substring-no-properties 7 9))) + (setq thedate (string-to-number (buffer-substring-no-properties 10 12))) + (kill-buffer thebuffer)) + (setq dayof nil) + (push theyear dayof) + (push thedate dayof) + (push themonth dayof) + (setq thatday (calendar-absolute-from-gregorian dayof)) + (setq today (calendar-absolute-from-gregorian (calendar-current-date))) + (setq days (+ 1 (- today thatday))) + (insert (concat "Day " (format "%S" days)))) + +(defun menstruate () + (interactive) + (setq periodfile "~/Documents/drive/org/period.org") + (find-file-noselect periodfile) + (setq thebuffer (file-name-nondirectory periodfile)) + (with-current-buffer thebuffer + (goto-char (point-min)) + (insert "\n") + (goto-char (point-min)) + (org-time-stamp '(16) nil) + (write-file periodfile) + (kill-buffer thebuffer)))