1
0
Fork 0

Compare commits

..

No commits in common. "c2cf29c8f2f5b27db9eee723d623b5f5edb7d043" and "ad65e6eff0e94e6ed7971e2d663e697fbd237d65" have entirely different histories.

6 changed files with 286 additions and 123 deletions

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org> ;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local ;; Keywords: local
;; Version: 2024.1014.135848 ;; Version: 2024.0205.222004
;; Package-Requires: (oni-data-dir oni-embrace oni-hydra expand-region multiple-cursors gcmh diminish ws-butler which-key insert-char-preview mixed-pitch ace-window vertico marginalia orderless consult embark docstr mini-frame) ;; Package-Requires: (oni-data-dir oni-embrace oni-hydra expand-region multiple-cursors gcmh diminish ws-butler which-key insert-char-preview mixed-pitch ace-window vertico marginalia orderless consult embark docstr mini-frame)
;; This program is free software; you can redistribute it and/or modify ;; This program is free software; you can redistribute it and/or modify
@ -426,7 +426,24 @@ _s_: String list"
(global-set-key [remap switch-to-buffer] 'consult-buffer) (global-set-key [remap switch-to-buffer] 'consult-buffer)
(global-set-key [remap yank-pop] 'consult-yank-pop) (global-set-key [remap yank-pop] 'consult-yank-pop)
(global-set-key (kbd "C-x 8 l") "λ") (global-set-key (kbd "M-0") #'delete-window)
(global-set-key (kbd "C-x 0") (lambda () (interactive) (error "Use M-0 instead")))
(global-set-key (kbd "M-1") #'delete-other-windows)
(global-set-key (kbd "C-x 1") (lambda () (interactive) (error "Use M-1 instead")))
(global-set-key (kbd "M-2") #'split-window-below)
(global-set-key (kbd "C-x 2") (lambda () (interactive) (error "Use M-2 instead")))
(global-set-key (kbd "M-3") #'split-window-right)
(global-set-key (kbd "C-x 3") (lambda () (interactive) (error "Use M-3 instead")))
(global-set-key (kbd "M-4") #'ctl-x-4-prefix)
(global-set-key (kbd "C-x 4") (lambda () (interactive) (error "Use M-4 instead")))
(global-set-key (kbd "M-5") #'ctl-x-5-prefix)
(global-set-key (kbd "C-x 5") (lambda () (interactive) (error "Use M-5 instead")))
(global-set-key (kbd "M-6") #'2C-command)
(global-set-key (kbd "C-x 6") (lambda () (interactive) (error "Use M-6 instead")))
(global-set-key (kbd "M-8") (keymap-lookup global-map "C-x 8"))
(global-set-key (kbd "C-x 8") (lambda () (interactive) (error "Use M-8 instead")))
(global-set-key (kbd "M-8 l") "λ")
(defun oni-core-related-files () (defun oni-core-related-files ()
"Return a list of files related to the current buffer." "Return a list of files related to the current buffer."
@ -528,11 +545,5 @@ which normally have their errors suppressed."
(lambda (d) (string-match-p (rx "/" (or "." ".." "foreign") eos) d)) (lambda (d) (string-match-p (rx "/" (or "." ".." "foreign") eos) d))
(directory-files "~/projects/" t)))) (directory-files "~/projects/" t))))
;;; Space cycling
;; The - argument to each function makes sure that any newlines are also
;; removed along with the other whitespace.
(setq cycle-spacing-actions '((just-one-space -) (delete-all-space -) restore))
(provide 'oni-core) (provide 'oni-core)
;;; oni-core.el ends here ;;; oni-core.el ends here

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org> ;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local ;; Keywords: local
;; Version: 2024.0822.003002 ;; Version: 2024.0408.115427
;; Package-Requires: (elfeed olivetti) ;; Package-Requires: (elfeed olivetti)
;; This program is free software; you can redistribute it and/or modify ;; This program is free software; you can redistribute it and/or modify
@ -91,14 +91,7 @@
("https://github.com/bharadswami/syncthing-status.el/commits/main.atom" emacs commits) ("https://github.com/bharadswami/syncthing-status.el/commits/main.atom" emacs commits)
"https://liliputing.com/feed/" "https://liliputing.com/feed/"
("https://www.futurile.net/feeds/all.atom.xml" guix) ("https://www.futurile.net/feeds/all.atom.xml" guix)
"https://convolv.es/atom.xml" "https://convolv.es/atom.xml"))
"https://ianthehenry.com/feed.xml"
"https://funcall.blogspot.com/feeds/posts/default"
"https://tibleiz.net/blog/news.rss"
("https://csscade.com/" css)
"https://ntietz.com/atom.xmlsig"
"https://libreture.com/blog/rss"
"https://jvns.ca/atom.xml"))
(add-hook 'elfeed-new-entry-hook (add-hook 'elfeed-new-entry-hook
(elfeed-make-tagger :before "2 weeks ago" (elfeed-make-tagger :before "2 weeks ago"
@ -151,12 +144,7 @@
(seq "BLACK" whitespace "SABBATH") (seq "BLACK" whitespace "SABBATH")
"MEGADETH" "MEGADETH"
(seq "ZAKK" whitespace "WYLDE") (seq "ZAKK" whitespace "WYLDE")
(seq "BLACK" whitespace "LABEL" whitespace "SOCIETY") (seq "BLACK" whitespace "LABEL" whitespace "SOCIETY")))
(seq "ORANGE" whitespace "GOBLIN")
(seq "DEEP" whitespace "PURPLE")
(seq "ROB" whitespace "ZOMBIE")
"CLUTCH"
(seq "THE" whitespace "OFFSPRING")))
:add 'favourite) :add 'favourite)
"Tagger that highlights specific bands from Blabbermouth.") "Tagger that highlights specific bands from Blabbermouth.")

View file

@ -4,8 +4,8 @@
;; Author: Tom Willemse <tom@ryuslash.org> ;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local ;; Keywords: local
;; Version: 2024.0701.144646 ;; Version: 2024.0315.155036
;; Package-Requires: (oni-yasnippet oni-hydra org org-edna diminish olivetti org-pretty-table) ;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org org-bullets org-edna diminish all-the-icons olivetti form-feed org-pretty-table ob-async org-ql org-super-agenda)
;; This program is free software; you can redistribute it and/or modify ;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by ;; it under the terms of the GNU General Public License as published by
@ -39,6 +39,7 @@
(require 'diminish) (require 'diminish)
(require 'hydra) (require 'hydra)
(require 'ob) (require 'ob)
(require 'ob-async)
(require 'org) (require 'org)
(require 'org-clock) (require 'org-clock)
(require 'org-edna) (require 'org-edna)
@ -46,7 +47,9 @@
(require 'org-faces) (require 'org-faces)
(require 'org-habit) (require 'org-habit)
(require 'org-protocol) (require 'org-protocol)
(require 'org-ql)
(require 'org-roam) (require 'org-roam)
(require 'org-super-agenda)
(require 'range) (require 'range)
(require 'subr-x) (require 'subr-x)
(require 'yasnippet) (require 'yasnippet)
@ -87,6 +90,90 @@
(expand-file-name "tickler.org" oni-org-todo-dir) (expand-file-name "tickler.org" oni-org-todo-dir)
"The tickler file for TODO notes of the future.") "The tickler file for TODO notes of the future.")
;;; Fake org-roam -- oni-org-exocortex
;; I tried using org-roam v2 with Orgro, but it didnt work. Ive only been
;; using org-roam to more easily find and insert strings. The file renaming in
;; v1 always seemed to have some issue, so I never really used that. And I
;; didnt even look any further into any of the functionality. So these
;; functions are my re-implementation of the convenience of org-roam. This way
;; Orgro still works and I can easily build up my knowledge base as well. I call
;; it fake org-roam for now because Im too tired to think of anything else,
;; its not actually enough to be a fake anything.
(eval-when-compile (require 'cl-macs))
(defvar oni-org-exocortex-directory (expand-file-name "~/documents/org"))
;; Expected (I need to turn these into tests):
;; - C++ :: c
;; - Crafting Interpreters - 10 - Fucntions - Native Functions :: crafting_interpreters_10_functions_native_functions
;; This is a helper function to turn the strings into the same kind of slugs
;; that org-roam uses so I stay consistent in my naming.
(defun oni-org--slugify (str)
"Turn STR into a filesystem-safe slug."
(let ((regexp (rx (one-or-more (not alphanumeric)))))
(downcase
(replace-regexp-in-string regexp "_" (string-trim-right str regexp)))))
;; This mimicks the file name pattern of org-roam with a date and time, followed
;; by a filesystem-safe slug of the actual title.
(defun oni-org--create-name (title)
(interactive "MTitle: ")
(format "%s-%s.org"
(format-time-string "%Y%m%d%H%M%S")
(oni-org--slugify title)))
;; Collect all of the files under the oni-org-exocortex-directory. org-roam indexes
;; all of the files in a database, but I really didnt want to recreate that
;; today. For the moment I dont have so many files that parsing all of them
;; like this is a huge problem.
(defun oni-org--get-exocortex-files ()
(cl-labels ((add-titles (file)
(list (with-temp-buffer
(insert-file-contents (expand-file-name file))
(goto-char (point-min))
(let ((line-end-position (line-end-position)))
(when (search-forward ":" line-end-position t)
(buffer-substring-no-properties (1+ (point)) line-end-position))))
file))
(unimportant-file-p (file)
(or (string-prefix-p "." (file-name-nondirectory file))
(string-match-p (rx bos "#" (one-or-more any) "#" eos) (file-name-nondirectory file))))
(unimportant-directory-p (directory)
(not (string-match-p (rx "/.") directory))))
(mapcar #'add-titles
(cl-delete-if #'unimportant-file-p
(directory-files-recursively oni-org-exocortex-directory (rx bos (repeat 14 digit) "-" (one-or-more (any alphanumeric "_")) ".org") nil #'unimportant-directory-p)))))
;; Find and visit a file in the oni-org-exocortex-directory. If the file doesnt
;; exist yet, its created and the title is inserted into it.
(defun oni-org-find-exocortex-file ()
(interactive)
(let* ((default-directory oni-org-exocortex-directory)
(completions (oni-org--get-exocortex-files))
(pick (completing-read "File: " completions))
(file (car (alist-get pick completions nil nil #'string=))))
(if file
(find-file file)
(find-file (oni-org--create-name pick))
(insert "#+TITLE: " pick "\n\n"))))
;; Insert a link to a file in the oni-org-exocortex-directory into the current
;; buffer. Dont visit the file, just insert a link to it.
(defun oni-org-insert-exocortex-link ()
(interactive)
(let* ((completions (oni-org--get-exocortex-files))
(pick (completing-read "File: " completions))
(file (car (alist-get pick completions nil nil #'string=))))
(unless file
(setq file (oni-org--create-name pick))
(with-current-buffer (find-file-noselect file)
(insert "#+TITLE: " pick "\n\n")
(save-buffer)))
(insert "[[file:" (file-relative-name file oni-org-exocortex-directory) "][" pick "]]")))
;;; Functions ;;; Functions
(defun oni-org-document-add-inline-images-startup () (defun oni-org-document-add-inline-images-startup ()
@ -104,7 +191,7 @@
(goto-char (1- header-end)) (goto-char (1- header-end))
(insert "#+STARTUP: inlineimages\n"))))) (insert "#+STARTUP: inlineimages\n")))))
(defun oni-org-document-remove-inline-images-startup () (defun oni-org-document-remove-inline-images-startup ()
"Remove a line to the current org buffer that will make it load images inline." "Remove a line to the current org buffer that will make it load images inline."
(interactive) (interactive)
(unless (derived-mode-p 'org-mode) (unless (derived-mode-p 'org-mode)
@ -148,6 +235,15 @@ located at the start of the line."
(setq-local yas-buffer-local-condition (setq-local yas-buffer-local-condition
'(looking-back (rx line-start (one-or-more (not space)))))) '(looking-back (rx line-start (one-or-more (not space))))))
(defun oni-org-setup-prettify-symbols-mode ()
"Set up prettify symbols mode for org mode."
(setq-local prettify-symbols-alist
'(("[ ]" . ?)
("[X]" . ?)
("#+TITLE: " . "")
("#+title: " . "")))
(prettify-symbols-mode))
(defun oni-org-snippets-initialize () (defun oni-org-snippets-initialize ()
"Initialize the snippets for oni-org." "Initialize the snippets for oni-org."
(when (boundp 'yas-snippet-dirs) (when (boundp 'yas-snippet-dirs)
@ -256,6 +352,44 @@ _di_: Add inlineimages STARTUP
"^[ \t]*#\\+end" "^[ \t]*#\\+end"
lim-up lim-down)))) lim-up lim-down))))
(defun oni-org-at-origin-property-p ()
"Non-nil when point is in an origin property."
(save-match-data
(save-excursion
(goto-char (line-beginning-position))
(and (looking-at org-property-re)
(string= (match-string 2) "ORIGIN")))))
(defun oni-org-dblock-write-backlinks (_params)
"Generate backlinks to org headings."
(let ((current-heading (nth 4 (org-heading-components)))
(current-heading-id
(or (alist-get "CUSTOM_ID" (org-entry-properties) nil nil #'string=)
(org-id-get)))
backlinks)
(save-excursion
(goto-char (point-min))
(while (re-search-forward (rx-to-string `(and "*" ,current-heading "]")) nil t)
(unless (or (oni-org-in-dblock-p)
(oni-org-at-origin-property-p))
(let ((components (org-heading-components)))
(push (cons (nth 2 components) (nth 4 components)) backlinks)))))
(when (not (null current-heading-id))
(save-excursion
(goto-char (point-min))
(while (re-search-forward (rx-to-string `(or (seq "[[id:" ,current-heading-id "]")
(seq "#" ,current-heading-id "]"))) nil t)
(unless (or (oni-org-in-dblock-p)
(oni-org-at-origin-property-p))
(let ((components (org-heading-components)))
(push (cons (nth 2 components) (nth 4 components)) backlinks))))))
(insert (string-join
(mapcar (lambda (link)
(concat "- [[*" (cdr link) "][" (if (car link) (format "%s - " (car link)) "") (cdr link) "]]"))
(sort (seq-uniq backlinks (lambda (a b) (string= (cdr a) (cdr b))))
(lambda (a b) (string< (cdr a) (cdr b)))))
"\n"))))
(defun oni-org-wrap-region-in-block (block-name beginning end) (defun oni-org-wrap-region-in-block (block-name beginning end)
"Create a block BLOCK-NAME and wrap the text between BEGINNING and END in there." "Create a block BLOCK-NAME and wrap the text between BEGINNING and END in there."
(interactive "sName: \nr") (interactive "sName: \nr")
@ -269,11 +403,13 @@ _di_: Add inlineimages STARTUP
(insert "#+begin_" block-name) (insert "#+begin_" block-name)
(unless (looking-at (rx "\n")) (insert "\n")))) (unless (looking-at (rx "\n")) (insert "\n"))))
(defalias 'org-dblock-write:oni-backlinks 'oni-org-dblock-write-backlinks)
;; Create a new archive for each year. This way archives don't keep growing ;; Create a new archive for each year. This way archives don't keep growing
;; indefinitely and opening the archive doesn't load every single language I've ;; indefinitely and opening the archive doesn't load every single language I've
;; ever used because there are code blocks in there. ;; ever used because there are code blocks in there.
(setq org-archive-location (format-time-string "%%s_archive_%Y::")) (setq org-archive-location (format-time-string "%%s_archive_%Y::"))
(setq org-fold-catch-invisible-edits 'error) (setq org-catch-invisible-edits 'error)
(setq org-clock-in-switch-to-state #'oni-org-maybe-change-todo-state) (setq org-clock-in-switch-to-state #'oni-org-maybe-change-todo-state)
(setq org-extend-today-until 2) (setq org-extend-today-until 2)
(setq org-fontify-whole-heading-line t) (setq org-fontify-whole-heading-line t)
@ -287,7 +423,7 @@ _di_: Add inlineimages STARTUP
(setq org-return-follows-link t) (setq org-return-follows-link t)
(setq org-special-ctrl-a/e t) (setq org-special-ctrl-a/e t)
(setq org-src-fontify-natively t) (setq org-src-fontify-natively t)
(setq org-tags-column -80) (setq org-tags-column -67)
(setq org-tags-exclude-from-inheritance '("project")) (setq org-tags-exclude-from-inheritance '("project"))
(setq org-tags-sort-function #'string<) (setq org-tags-sort-function #'string<)
(setq org-use-fast-todo-selection t) (setq org-use-fast-todo-selection t)
@ -321,6 +457,58 @@ and not a state update."
(setq org-default-notes-file (expand-file-name "inbox.org" oni-org-todo-dir)) (setq org-default-notes-file (expand-file-name "inbox.org" oni-org-todo-dir))
(setq org-bibtex-autogen-keys t) (setq org-bibtex-autogen-keys t)
(defun oni-org-find-heading-in-file (heading file &optional move)
"Try to find HEADING somewhere in FILE.
This function returns nil if HEADING couldnt be found, and the
position where the chapter starts otherwise. If MOVE is non-nil
also move point to the start of the heading."
(let ((buffer (find-file-noselect file)))
(with-current-buffer buffer
(save-excursion
(goto-char (point-min))
(org-find-exact-headline-in-buffer heading buffer (not move))))))
(defun oni-org-create-book-heading (book-title file)
"Create a new heading for BOOK-TITLE in FILE."
(let ((buffer (find-file file)))
(with-current-buffer buffer
(goto-char (point-max))
(insert "\n* " book-title "\n\n "))))
(defun oni-org-create-chapter-heading (book-title chapter-title file)
"Create a new heading under BOOK-TITLE for CHAPTER-TITLE in FILE."
(let ((buffer (find-file file)))
(with-current-buffer buffer
(goto-char (point-min))
(goto-char (oni-org-find-heading-in-file book-title file t))
(goto-char (org-element-property :end (org-element-at-point)))
(unless (= (point) (point-max))
(open-line 2))
(insert "\n** " chapter-title "\n\n "))))
(defun oni-org-create-chapter-section (chapter-title file)
"Create a new notes section under CHAPTER-TITLE in FILE."
(let ((buffer (find-file file)))
(with-current-buffer buffer
(goto-char (point-min))
(goto-char (oni-org-find-heading-in-file chapter-title file t))
(goto-char (org-element-property :contents-end (org-element-at-point)))
(insert "\n"))))
(defun oni-org-reading-note ()
"Find the org-header associated with the current chapter or page."
(let* ((headers (split-string (format-mode-line header-line-format) ":" t " "))
(book-name (car headers))
(chapter-name (cadr headers))
(notes-file (oni-org-expand-to-home "documents/gtd/reading-notes.org"))
(chapter-start (oni-org-find-heading-in-file chapter-name notes-file)))
(if (not chapter-start)
(let ((book-start (oni-org-find-heading-in-file book-name notes-file)))
(unless book-start
(oni-org-create-book-heading book-name notes-file))
(oni-org-create-chapter-heading book-name chapter-name notes-file))
(oni-org-create-chapter-section chapter-name notes-file))))
(defun oni-org-todo-maybe-hide-body () (defun oni-org-todo-maybe-hide-body ()
"Hide the current outline body if org-state is a DONE state." "Hide the current outline body if org-state is a DONE state."
(when (member org-state org-done-keywords) (when (member org-state org-done-keywords)
@ -333,7 +521,10 @@ and not a state update."
(org-update-all-dblocks))) (org-update-all-dblocks)))
(setq org-todo-keywords (setq org-todo-keywords
'((sequence "TODO(t)" "WIP" "WAITING(W@)" "|" "DONE(d!)") '((sequence "TODO(t)" "WIP" "BLOCKED(b@)" "|" "DONE(d!)")
(sequence "READ(r)" "READING(!)" "|" "FINISHED(!)" "STOPPED(@)")
(sequence "WATCH(w)" "WATCHING" "|" "WATCHED(!)")
(sequence "LISTEN(l)" "LISTENING" "|" "DONE(d!)")
(sequence "|" "CANCELLED(c@)"))) (sequence "|" "CANCELLED(c@)")))
(add-hook 'org-after-todo-state-change-hook 'oni-org-todo-maybe-hide-body) (add-hook 'org-after-todo-state-change-hook 'oni-org-todo-maybe-hide-body)
@ -366,6 +557,12 @@ and not a state update."
(add-hook 'org-mode-hook 'yas-minor-mode) (add-hook 'org-mode-hook 'yas-minor-mode)
(org-edna-mode) (org-edna-mode)
(org-super-agenda-mode)
(unless (eq system-type 'windows-nt)
(require 'org-bullets)
(add-hook 'org-mode-hook 'org-bullets-mode)
(add-hook 'org-mode-hook #'oni-org-setup-prettify-symbols-mode))
;;;###autoload ;;;###autoload
(global-set-key (kbd "C-c o") '("Org commands" . oni-hydra-org/body)) (global-set-key (kbd "C-c o") '("Org commands" . oni-hydra-org/body))
@ -444,24 +641,7 @@ and not a state update."
(org-roam-db-query (org-roam-db-query
[:select :distinct file :from nodes :where (= todo $s1)] "TODO"))) [:select :distinct file :from nodes :where (= todo $s1)] "TODO")))
(defun oni-org-para-todo-files () (setq org-agenda-files (list oni-org-todo-main-file))
"Collect all task files from my PARA repository."
(delete nil
(mapcar (lambda (dir)
(cond
((string-prefix-p "." (file-name-nondirectory dir)) nil)
(t (let ((file-name (expand-file-name "tasks.org" dir)))
(and (file-exists-p file-name) file-name)))))
(append (directory-files
(expand-file-name "documents/exocortex-para/projects" (getenv "HOME"))
:full)
(directory-files
(expand-file-name "documents/exocortex-para/areas" (getenv "HOME"))
:full)))))
(setq org-agenda-files (append (list oni-org-todo-main-file)
(oni-org-roam-todo-files)
(oni-org-para-todo-files)))
(setq org-agenda-tags-todo-honor-ignore-options t) (setq org-agenda-tags-todo-honor-ignore-options t)
(setq org-agenda-todo-ignore-scheduled 'future) (setq org-agenda-todo-ignore-scheduled 'future)
(setq org-agenda-restore-windows-after-quit t) (setq org-agenda-restore-windows-after-quit t)
@ -523,6 +703,30 @@ After running it once remove it from `org-capture-after-finalize-hook'."
(let ((title (oni-org-get-url-title url))) (let ((title (oni-org-get-url-title url)))
(format "[[%s][%s]]" url title))) (format "[[%s][%s]]" url title)))
(defun oni-org-format-months ()
(let* ((time (org-timestamp-to-time
(org-timestamp-from-string (concat "<" (org-read-date) ">"))))
(decoded (decode-time time))
(next-month
(time-add time (days-to-time (date-days-in-month
(decoded-time-year decoded)
(decoded-time-month decoded))))))
(concat (format-time-string "%b " time)
(format-time-string "%b " next-month)
(format-time-string "%Y" time))))
(defun oni-org-ask-names ()
(let ((n 1)
article-name
names)
(while (not (string-empty-p (setq article-name (read-string (format "Article Name %d: " n)))))
(push article-name names)
(cl-incf n))
(reverse names)))
(defun oni-org-format-names (names)
(mapconcat (lambda (n) (format "** READ %s" n)) names "\n"))
(defun org-edna-finder/next-sibling-first-child () (defun org-edna-finder/next-sibling-first-child ()
"A finder for org-edna to find the first child of the next sibling." "A finder for org-edna to find the first child of the next sibling."
(save-excursion (save-excursion
@ -1025,17 +1229,19 @@ same code all the time."
(map-insert ,collection ,key-name ,value-name)) (map-insert ,collection ,key-name ,value-name))
,value-name))))) ,value-name)))))
(defvar oni-org--capture-D-date nil) (oni-org--map-put org-agenda-custom-commands "P"
(oni-org--map-put org-capture-templates "D" '("Stuck projects" ((org-ql-block '(and (todo) (children) (not (children (todo))))))))
'("A DONE item for my to-done list." entry (file oni-org-todo-main-file) "* DONE %?
CLOSED: %(setq oni-org--capture-D-date (format-time-string (org-time-stamp-format t t) (org-read-date t t nil \"Date: \"))) (oni-org--map-put org-agenda-custom-commands "o"
:PROPERTIES: '("Overview" ((org-ql-block '(and (todo)
:CREATED: %(progn oni-org--capture-D-date) (children)
:END: (not (children (todo))))
:LOGBOOK: ((org-ql-block-header "Stuck projects")))
- State \"DONE\" from \"TODO\" %(progn oni-org--capture-D-date) (org-ql-block '(and (todo) (not (children)))
:END:" ((org-super-agenda-groups '((:auto-parent)))
:after-finalize (lambda () (setq oni-org--capture-D-date nil)))) (org-ql-block-header "Todo")))
(agenda ""
((org-agenda-span 3))))))
(oni-org--map-put org-capture-templates "t" (oni-org--map-put org-capture-templates "t"
'("A simple TODO item." entry (file "") "* TODO %? '("A simple TODO item." entry (file "") "* TODO %?

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org> ;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local ;; Keywords: local
;; Version: 2024.0701.150636 ;; Version: 2023.0722.222800
;; This program is free software; you can redistribute it and/or modify ;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by ;; it under the terms of the GNU General Public License as published by
@ -28,7 +28,6 @@
(require 'project) (require 'project)
(declare-function magit-status-setup-buffer "magit-status.el") (declare-function magit-status-setup-buffer "magit-status.el")
(declare-function vterm "vterm.el")
(defun oni-project-magit () (defun oni-project-magit ()
"Start Magit in the current project's root directory." "Start Magit in the current project's root directory."
@ -39,29 +38,5 @@
(define-key project-prefix-map (kbd "m") #'oni-project-magit) (define-key project-prefix-map (kbd "m") #'oni-project-magit)
(add-to-list 'project-switch-commands '(oni-project-magit "Magit status"))) (add-to-list 'project-switch-commands '(oni-project-magit "Magit status")))
(defun oni-project-vterm ()
"Start Vterm in the current project's root directory.
If a buffer already exists for running Vterm in the project's root,
switch to it. Otherwise, create a new Vterm buffer. With
\\[universal-argument] prefix arg, create a new Vterm buffer even if one
already exists."
(interactive)
(defvar vterm-buffer-name-string)
(let* ((project-root (project-root (project-current t)))
(vterm-buffer (seq-find (lambda (b)
(with-current-buffer b
(and (eq 'vterm-mode major-mode)
(string-prefix-p project-root default-directory))))
(buffer-list)))
(default-directory project-root)
(vterm-buffer-name-string (project-prefixed-buffer-name "vterm")))
(if (and vterm-buffer (not current-prefix-arg))
(pop-to-buffer vterm-buffer (bound-and-true-p display-comint-buffer-action))
(vterm))))
(when (locate-library "vterm")
(define-key project-prefix-map (kbd "t") #'oni-project-vterm)
(add-to-list 'project-switch-commands '(oni-project-vterm "Terminal")))
(provide 'oni-project) (provide 'oni-project)
;;; oni-project.el ends here ;;; oni-project.el ends here

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org> ;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local ;; Keywords: local
;; Version: 2024.0621.092608 ;; Version: 2024.0313.112713
;; Package-Requires: (oni-yasnippet oni-company oni-flycheck oni-hydra oni-lsp rainbow-delimiters reformatter) ;; Package-Requires: (oni-yasnippet oni-company oni-flycheck oni-hydra oni-lsp rainbow-delimiters reformatter)
;; This program is free software; you can redistribute it and/or modify ;; This program is free software; you can redistribute it and/or modify
@ -41,9 +41,6 @@
(require 'whitespace) (require 'whitespace)
(require 'yasnippet) (require 'yasnippet)
;; Don't mind if treesit can't be loaded, maybe this Emacs doesn't have it.
(require 'treesit nil t)
(autoload 'hl-indent-mode "hl-indent-mode") (autoload 'hl-indent-mode "hl-indent-mode")
(defconst oni-python-root (defconst oni-python-root
@ -76,19 +73,6 @@ for indentation."
(setq-local whitespace-style '(face tabs)) (setq-local whitespace-style '(face tabs))
(whitespace-mode)) (whitespace-mode))
;;;###autoload
(defun oni-python--enable-hooks (hook)
(add-hook hook 'company-mode)
(add-hook hook 'display-fill-column-indicator-mode)
(add-hook hook 'electric-indent-local-mode)
(add-hook hook 'electric-pair-local-mode)
(add-hook hook 'flycheck-mode)
(add-hook hook 'lsp)
(add-hook hook 'oni-python-set-fill-column)
(add-hook hook 'oni-python-whitespace-mode)
(add-hook hook 'python-black-on-save-mode)
(add-hook hook 'rainbow-delimiters-mode))
(reformatter-define python-black (reformatter-define python-black
:program "black" :program "black"
:args `("--line-length" ,(number-to-string fill-column) "-") :args `("--line-length" ,(number-to-string fill-column) "-")
@ -97,15 +81,16 @@ for indentation."
(define-key python-mode-map (kbd "C-c r") 'python-refactor-hydra/body) (define-key python-mode-map (kbd "C-c r") 'python-refactor-hydra/body)
(oni-python--enable-hooks 'python-mode-hook) (add-hook 'python-mode-hook 'company-mode)
(add-hook 'python-mode-hook 'display-fill-column-indicator-mode)
;;;###autoload (add-hook 'python-mode-hook 'electric-indent-local-mode)
(when (and (functionp 'treesit-available-p) (add-hook 'python-mode-hook 'electric-pair-local-mode)
(treesit-available-p) (add-hook 'python-mode-hook 'flycheck-mode)
(require 'treesit) (add-hook 'python-mode-hook 'lsp)
(treesit-ready-p 'python)) (add-hook 'python-mode-hook 'oni-python-set-fill-column)
(add-to-list 'major-mode-remap-alist '(python-mode . python-ts-mode)) (add-hook 'python-mode-hook 'oni-python-whitespace-mode)
(oni-python--enable-hooks 'python-ts-mode-hook)) (add-hook 'python-mode-hook 'python-black-on-save-mode)
(add-hook 'python-mode-hook 'rainbow-delimiters-mode)
(with-eval-after-load 'python (with-eval-after-load 'python
(with-eval-after-load 'yasnippet (with-eval-after-load 'yasnippet

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org> ;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local ;; Keywords: local
;; Version: 2024.0621.092620 ;; Version: 2024.0205.164705
;; Package-Requires: (yaml-mode oni-flycheck oni-highlight-indent-guides indent-tools yaml-imenu yaml-pro) ;; Package-Requires: (yaml-mode oni-flycheck oni-highlight-indent-guides indent-tools yaml-imenu yaml-pro)
;; This program is free software; you can redistribute it and/or modify ;; This program is free software; you can redistribute it and/or modify
@ -51,10 +51,8 @@
(oni-yaml--enable-hooks 'yaml-mode-hook) (oni-yaml--enable-hooks 'yaml-mode-hook)
;;;###autoload
(when (and (functionp 'treesit-available-p) (when (and (functionp 'treesit-available-p)
(treesit-available-p) (treesit-available-p)
(require 'treesit)
(treesit-ready-p 'yaml)) (treesit-ready-p 'yaml))
(add-to-list 'major-mode-remap-alist '(yaml-mode . yaml-ts-mode)) (add-to-list 'major-mode-remap-alist '(yaml-mode . yaml-ts-mode))
(oni-yaml--enable-hooks 'yaml-ts-mode-hook)) (oni-yaml--enable-hooks 'yaml-ts-mode-hook))