Compare commits
17 commits
ad65e6eff0
...
c2cf29c8f2
Author | SHA1 | Date | |
---|---|---|---|
c2cf29c8f2 | |||
2f90776712 | |||
e26750e302 | |||
2183877638 | |||
f404ee6032 | |||
eeca5767e9 | |||
89f4dc6234 | |||
e9214ea7e4 | |||
c74133b68b | |||
f9ff0da907 | |||
15181c50d1 | |||
75128ffcdf | |||
f4b587f550 | |||
e917daef5a | |||
756be72f06 | |||
da288e8256 | |||
6747a3693c |
6 changed files with 123 additions and 286 deletions
27
oni-core.el
27
oni-core.el
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
;; Author: Tom Willemse <tom@ryuslash.org>
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
;; Keywords: local
|
;; Keywords: local
|
||||||
;; Version: 2024.0205.222004
|
;; Version: 2024.1014.135848
|
||||||
;; 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,24 +426,7 @@ _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 "M-0") #'delete-window)
|
(global-set-key (kbd "C-x 8 l") "λ")
|
||||||
(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."
|
||||||
|
@ -545,5 +528,11 @@ 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
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
;; Author: Tom Willemse <tom@ryuslash.org>
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
;; Keywords: local
|
;; Keywords: local
|
||||||
;; Version: 2024.0408.115427
|
;; Version: 2024.0822.003002
|
||||||
;; 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,7 +91,14 @@
|
||||||
("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"
|
||||||
|
@ -144,7 +151,12 @@
|
||||||
(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.")
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
;; Author: Tom Willemse <tom@ryuslash.org>
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
;; Keywords: local
|
;; Keywords: local
|
||||||
;; Version: 2024.0315.155036
|
;; Version: 2024.0701.144646
|
||||||
;; 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)
|
;; Package-Requires: (oni-yasnippet oni-hydra org org-edna diminish olivetti org-pretty-table)
|
||||||
|
|
||||||
;; 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,7 +39,6 @@
|
||||||
(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)
|
||||||
|
@ -47,9 +46,7 @@
|
||||||
(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)
|
||||||
|
@ -90,90 +87,6 @@
|
||||||
(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 didn’t work. I’ve 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
|
|
||||||
;; didn’t 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 I’m too tired to think of anything else,
|
|
||||||
;; it’s 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 didn’t want to recreate that
|
|
||||||
;; today. For the moment I don’t 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 doesn’t
|
|
||||||
;; exist yet, it’s 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. Don’t 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 ()
|
||||||
|
@ -235,15 +148,6 @@ 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)
|
||||||
|
@ -352,44 +256,6 @@ _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")
|
||||||
|
@ -403,13 +269,11 @@ _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-catch-invisible-edits 'error)
|
(setq org-fold-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)
|
||||||
|
@ -423,7 +287,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 -67)
|
(setq org-tags-column -80)
|
||||||
(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)
|
||||||
|
@ -457,58 +321,6 @@ 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 couldn’t 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)
|
||||||
|
@ -521,10 +333,7 @@ also move point to the start of the heading."
|
||||||
(org-update-all-dblocks)))
|
(org-update-all-dblocks)))
|
||||||
|
|
||||||
(setq org-todo-keywords
|
(setq org-todo-keywords
|
||||||
'((sequence "TODO(t)" "WIP" "BLOCKED(b@)" "|" "DONE(d!)")
|
'((sequence "TODO(t)" "WIP" "WAITING(W@)" "|" "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)
|
||||||
|
@ -557,12 +366,6 @@ also move point to the start of the heading."
|
||||||
(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))
|
||||||
|
@ -641,7 +444,24 @@ also move point to the start of the heading."
|
||||||
(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")))
|
||||||
|
|
||||||
(setq org-agenda-files (list oni-org-todo-main-file))
|
(defun oni-org-para-todo-files ()
|
||||||
|
"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)
|
||||||
|
@ -703,30 +523,6 @@ 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
|
||||||
|
@ -1229,19 +1025,17 @@ same code all the time."
|
||||||
(map-insert ,collection ,key-name ,value-name))
|
(map-insert ,collection ,key-name ,value-name))
|
||||||
,value-name)))))
|
,value-name)))))
|
||||||
|
|
||||||
(oni-org--map-put org-agenda-custom-commands "P"
|
(defvar oni-org--capture-D-date nil)
|
||||||
'("Stuck projects" ((org-ql-block '(and (todo) (children) (not (children (todo))))))))
|
(oni-org--map-put org-capture-templates "D"
|
||||||
|
'("A DONE item for my to-done list." entry (file oni-org-todo-main-file) "* DONE %?
|
||||||
(oni-org--map-put org-agenda-custom-commands "o"
|
CLOSED: %(setq oni-org--capture-D-date (format-time-string (org-time-stamp-format t t) (org-read-date t t nil \"Date: \")))
|
||||||
'("Overview" ((org-ql-block '(and (todo)
|
:PROPERTIES:
|
||||||
(children)
|
:CREATED: %(progn oni-org--capture-D-date)
|
||||||
(not (children (todo))))
|
:END:
|
||||||
((org-ql-block-header "Stuck projects")))
|
:LOGBOOK:
|
||||||
(org-ql-block '(and (todo) (not (children)))
|
- State \"DONE\" from \"TODO\" %(progn oni-org--capture-D-date)
|
||||||
((org-super-agenda-groups '((:auto-parent)))
|
:END:"
|
||||||
(org-ql-block-header "Todo")))
|
:after-finalize (lambda () (setq oni-org--capture-D-date nil))))
|
||||||
(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 %?
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
;; Author: Tom Willemse <tom@ryuslash.org>
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
;; Keywords: local
|
;; Keywords: local
|
||||||
;; Version: 2023.0722.222800
|
;; Version: 2024.0701.150636
|
||||||
|
|
||||||
;; 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,6 +28,7 @@
|
||||||
(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."
|
||||||
|
@ -38,5 +39,29 @@
|
||||||
(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
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
;; Author: Tom Willemse <tom@ryuslash.org>
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
;; Keywords: local
|
;; Keywords: local
|
||||||
;; Version: 2024.0313.112713
|
;; Version: 2024.0621.092608
|
||||||
;; 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,6 +41,9 @@
|
||||||
(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
|
||||||
|
@ -73,6 +76,19 @@ 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) "-")
|
||||||
|
@ -81,16 +97,15 @@ 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)
|
||||||
|
|
||||||
(add-hook 'python-mode-hook 'company-mode)
|
(oni-python--enable-hooks 'python-mode-hook)
|
||||||
(add-hook 'python-mode-hook 'display-fill-column-indicator-mode)
|
|
||||||
(add-hook 'python-mode-hook 'electric-indent-local-mode)
|
;;;###autoload
|
||||||
(add-hook 'python-mode-hook 'electric-pair-local-mode)
|
(when (and (functionp 'treesit-available-p)
|
||||||
(add-hook 'python-mode-hook 'flycheck-mode)
|
(treesit-available-p)
|
||||||
(add-hook 'python-mode-hook 'lsp)
|
(require 'treesit)
|
||||||
(add-hook 'python-mode-hook 'oni-python-set-fill-column)
|
(treesit-ready-p 'python))
|
||||||
(add-hook 'python-mode-hook 'oni-python-whitespace-mode)
|
(add-to-list 'major-mode-remap-alist '(python-mode . python-ts-mode))
|
||||||
(add-hook 'python-mode-hook 'python-black-on-save-mode)
|
(oni-python--enable-hooks 'python-ts-mode-hook))
|
||||||
(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
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
;; Author: Tom Willemse <tom@ryuslash.org>
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
;; Keywords: local
|
;; Keywords: local
|
||||||
;; Version: 2024.0205.164705
|
;; Version: 2024.0621.092620
|
||||||
;; 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,8 +51,10 @@
|
||||||
|
|
||||||
(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))
|
||||||
|
|
Loading…
Reference in a new issue