summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjetil Orbekk <kj@orbekk.com>2024-11-09 11:26:38 -0500
committerKjetil Orbekk <kj@orbekk.com>2024-11-09 11:26:38 -0500
commit52c8c0e2ad407710752c2a6239ae041473833282 (patch)
tree747d283acae38b6ac15c0b7da36b4e29762cc706
parentb3afe608d438fe0dc01fad68490e6f58159a17ce (diff)
Anki config
-rw-r--r--emacs/.config/emacs/emacs-custom.el2
-rw-r--r--emacs/.config/emacs/init.el261
-rw-r--r--emacs/.config/emacs/lisp/kj-org.el256
3 files changed, 262 insertions, 257 deletions
diff --git a/emacs/.config/emacs/emacs-custom.el b/emacs/.config/emacs/emacs-custom.el
index 7c74eba..5aebc18 100644
--- a/emacs/.config/emacs/emacs-custom.el
+++ b/emacs/.config/emacs/emacs-custom.el
@@ -6,7 +6,7 @@
'(custom-safe-themes
'("0340489fa0ccbfa05661bc5c8c19ee0ff95ab1d727e4cc28089b282d30df8fc8" "e3999eba4f25d912d7d61cbaaed1b551957e61da047279da89499d3bd1f1d007" "8d412c0ed46b865312d6df5c1dfd1821d349dd3cba00049cf88c4ad34403597e" "88267200889975d801f6c667128301af0bc183f3450c4b86138bfb23e8a78fb1" default))
'(package-selected-packages
- '(yasnippet org-pomodoro eshell-syntax-highlighting esh-help pcmpl-args exercism tidal haskell-mode diff-hl dts-mode clojure-mode unobtrusive-magit-theme ledger-mode nix-mode rustic tempel puni magit gcmh smudge helpful pdf-tools pcre2el repeat-help selected ace-mc expand-region idle-highlight-mode diredfl anzu direnv ob-async mixed-pitch deadgrep wgrep coterm doom-themes with-editor zenburn-theme yasnippet-snippets yaml-mode which-key undo-tree tabbar session rust-mode puppet-mode pod-mode notmuch muttrc-mode mutt-alias lsp-mode initsplit ido-completing-read+ htmlize graphviz-dot-mode goto-chg gitignore-mode gitconfig-mode gitattributes-mode git-modes folding flycheck ess eproject editorconfig diminish csv-mode color-theme-modern browse-kill-ring boxquote bm bar-cursor apache-mode projectile embark-consult))
+ '(anki-editor yasnippet org-pomodoro eshell-syntax-highlighting esh-help pcmpl-args exercism tidal haskell-mode diff-hl dts-mode clojure-mode unobtrusive-magit-theme ledger-mode nix-mode rustic tempel puni magit gcmh smudge helpful pdf-tools pcre2el repeat-help selected ace-mc expand-region idle-highlight-mode diredfl anzu direnv ob-async mixed-pitch deadgrep wgrep coterm doom-themes with-editor zenburn-theme yasnippet-snippets yaml-mode which-key undo-tree tabbar session rust-mode puppet-mode pod-mode notmuch muttrc-mode mutt-alias lsp-mode initsplit ido-completing-read+ htmlize graphviz-dot-mode goto-chg gitignore-mode gitconfig-mode gitattributes-mode git-modes folding flycheck ess eproject editorconfig diminish csv-mode color-theme-modern browse-kill-ring boxquote bm bar-cursor apache-mode projectile embark-consult))
'(safe-local-variable-values
'((eval outline-hide-sublevels 2)
(Package . CL-WHO)
diff --git a/emacs/.config/emacs/init.el b/emacs/.config/emacs/init.el
index 88eea62..740481b 100644
--- a/emacs/.config/emacs/init.el
+++ b/emacs/.config/emacs/init.el
@@ -515,6 +515,267 @@
(let ((magit-clone-set-remote.pushDefault t))
(magit-clone-regular (kj/read-repository) kj/git-directory nil))))
+;;;;; Anki
+;; (package-vc-install
+;; '(anki-editor . (:url "https://github.com/anki-editor/anki-editor")))
+(use-package anki-editor :ensure nil)
+;;;; Org mode
+(use-package org
+ :config
+ (org-babel-do-load-languages 'org-babel-load-languages
+ '((emacs-lisp . t)
+ (sql . t)
+ (shell . t)))
+ (setq org-confirm-babel-evaluate nil
+ org-return-follows-link t
+ )
+
+ (setopt org-capture-templates
+ '(("s" "Sailing entry" plain (file+datetree "~/org/roam/sailing.org")
+ "%^{LOCATION|Brooklyn}p\n%^{VESSEL|J80}p%^{SKIPPER}p%?")
+ ("a" "Anki templates")
+ ("ai" "Inbox basic" entry
+ (file+headline "~/org/anki/inbox.org" "Inbox")
+ "* %T %^g\n:PROPERTIES:\n:ANKI_NOTE_TYPE: Basic\n:END:\n** Front\n%c%?\n** Back\n%x\n")
+ ("as" "Sailing basic" entry
+ (file+headline "~/org/anki/sailing.org" "Sailing")
+ "* %T\n:PROPERTIES:\n:ANKI_NOTE_TYPE: Basic\n:END:\n** Front\n%c%?\n** Back\n%x\n")))
+
+ ;; Install the link type
+ (org-add-link-type "notmuch" 'org-notmuch-open)
+ (add-hook 'org-store-link-functions 'org-notmuch-store-link)
+
+ (defun org-notmuch-store-link ()
+ "Store a link to a notmuch search or message."
+ (when (eq major-mode 'notmuch-show-mode)
+ (let* ((message-id (notmuch-show-get-prop :id))
+ (subject (notmuch-show-get-subject))
+ (to (notmuch-show-get-to))
+ (from (notmuch-show-get-from))
+ desc link)
+ (org-store-link-props :type "notmuch" :from from :to to
+ :subject subject :message-id message-id)
+ (setq desc (org-email-link-description))
+ (setq link (concat "notmuch:" "id:" message-id))
+ (org-add-link-props :link link :description desc)
+ link)))
+
+ (defun org-notmuch-open (path)
+ "Follow a notmuch message link specified by PATH."
+ (org-notmuch-follow-link path))
+
+ (defun org-notmuch-follow-link (search)
+ "Follow a notmuch link to SEARCH.
+
+Can link to more than one message, if so all matching messages are shown."
+ (require 'notmuch)
+ (notmuch-show (org-link-unescape search)))
+
+ (org-add-link-type "notmuch-search" 'org-notmuch-search-open)
+ (add-hook 'org-store-link-functions 'org-notmuch-search-store-link)
+
+ (defun org-notmuch-search-store-link ()
+ "Store a link to a notmuch search or message."
+ (when (eq major-mode 'notmuch-search-mode)
+ (let ((link (concat "notmuch-search:"
+ (org-link-escape notmuch-search-query-string)))
+ (desc (concat "Notmuch search: " notmuch-search-query-string)))
+ (org-store-link-props :type "notmuch-search"
+ :link link
+ :description desc)
+ link)))
+
+ (defun org-notmuch-search-open (path)
+ "Follow a notmuch message link specified by PATH."
+ (message path)
+ (org-notmuch-search-follow-link path))
+
+ (defun org-notmuch-search-follow-link (search)
+ "Follow a notmuch link by displaying SEARCH in notmuch-search mode."
+ (require 'notmuch)
+ (notmuch-search (org-link-unescape search)))
+
+ ;; If you use `org' and don't want your org files in the default location below,
+ ;; change `org-directory'. It must be set before org loads!
+ (setq org-directory "~/org/")
+ (setq org-todo-keywords
+ '((sequence
+ "TODO(t)" "ACTIVE(a!)" "WAIT(w@/!)" "|" "DONE(d!)" "CANCELED(c@)")))
+ (setq org-refile-use-outline-path nil)
+ (setq org-refile-targets '((nil . (:maxlevel . 2))))
+ (setq org-log-into-drawer t)
+ (setq org-agenda-log-mode-items '(closed clock state))
+ (setq org-agenda-start-day nil)
+ (setq org-agenda-block-separator nil)
+ (setq org-agenda-compact-blocks t)
+ (setq org-agenda-start-with-log-mode nil)
+ (setq org-habit-show-all-today t)
+ (setq org-agenda-time-grid '((daily today require-timed) (800 1600) "......" "----------------------"))
+ (setq org-roam-directory (concat org-directory "roam/"))
+ (setq-default org-agenda-files '())
+ (dolist (file '("tasks.org"
+ "running-2022.org"
+ "sailing.org"))
+ (add-to-list 'org-agenda-files (concat org-roam-directory file)))
+ (setq org-roam-db-location (concat org-roam-directory "/org-roam.db"))
+ (setq org-export-with-toc nil)
+ (setq deft-directory org-directory)
+ (setq deft-recursive t)
+ ;; Org html export
+ (setq org-html-htmlize-output-type 'css)
+ ;; Website publish settings.
+ (defvar kj/publish-tag "publish")
+ (defvar kj/publish-directory "/ssh:orbekk@dragon.orbekk.com:/storage/srv/kj.orbekk.com")
+ (add-to-list 'org-modules 'org-habit)
+
+ (defvar org-publish-project-alist)
+ (defun kj/find-agenda-files-containing-tag (tag)
+ (setq org-agenda-archives-mode nil)
+ (let* ((org-agenda-archives-mode nil)
+ (candidates (org-agenda-files nil 'ifmode))
+ (matcher (cdr (org-make-tags-matcher tag)))
+ (files))
+ ;; (message "Results:")
+ (dolist (file candidates files)
+ (org-check-agenda-file file)
+ (with-current-buffer (org-get-agenda-file-buffer file)
+ ;; (message "%S" (org-scan-tags 'agenda matcher nil))
+ (when (org-scan-tags 'agenda matcher nil)
+ (push file files))))))
+
+ (defun kj/org-publish (&optional project force)
+ (interactive)
+ (setq project (or project "all"))
+ (setq force (or force current-prefix-arg))
+ (setq org-agenda-files (list org-roam-directory))
+ (let* ((static-files-re (string-join '("css" "txt" "jpg" "png" "gif" "svg") "\\|"))
+ (files-to-include (kj/find-agenda-files-containing-tag kj/publish-tag))
+ ;; Disable org babel exports during publish entirely to speed up publish.
+ ;; This messes up babel output handling.
+ ;; (org-export-use-babel nil)
+ (org-babel-default-header-args
+ (kj/assq-replace '((:exports . "both")
+ (:eval . "never-export"))
+ org-babel-default-header-args))
+ (org-publish-project-alist
+ `(
+ ("static"
+ :base-directory ,(concat org-roam-directory "/static")
+ :base-extension ,static-files-re
+ :recursive t
+ :publishing-directory ,(concat kj/publish-directory "/static")
+ :publishing-function org-publish-attachment)
+ ("source"
+ :base-directory ,org-roam-directory
+ :base-extension "org"
+ :exclude ".*"
+ :include ,files-to-include
+ :recursive t
+ :publishing-directory ,kj/publish-directory
+ :publishing-function org-publish-attachment)
+ ("html"
+ :base-directory ,org-roam-directory
+ :base-extension "org"
+ :recursive t
+ :exclude ".*"
+ :include ,files-to-include
+ :publishing-directory ,kj/publish-directory
+ :publishing-function org-html-publish-to-html
+
+ :with-broken-links t
+ :with-toc nil
+ :with-latex t
+ :with-drawers t
+ :with-title t
+ :section-numbers nil
+
+ ;; HTML options
+ :html-toplevel-hlevel 2
+ :html-preamble ""
+ :html-postamble ""
+ :html-html5-fancy t
+ :html-doctype "html5"
+ :html-head "<link rel=\"stylesheet\" type=\"text/css\" href=\"https://gongzhitaao.org/orgcss/org.css\"/>"
+ :html-head-include-scripts nil
+ :html-head-include-default-style nil
+ :html-container article)
+
+ ("all" :components ("static" "source" "html")))))
+
+ (org-publish project force)))
+ ; (setq org-appear-autolinks t)
+ ; (use-package! org-appear
+ ; :hook (org-mode . org-appear-mode))
+
+ (setq org-log-done 'time)
+ (setq org-todo-keywords
+ '((sequence
+ "TODO(t)" ; A task that needs doing & is ready to do
+ "PROJ(p)" ; A project, which usually contains other tasks
+ "LOOP(r)" ; A recurring task
+ "STRT(s)" ; A task that is in progress
+ "WAIT(w)" ; Something external is holding up this task
+ "HOLD(h)" ; This task is paused/on hold because of me
+ "IDEA(i)" ; An unconfirmed and unapproved task or notion
+ "|"
+ "DONE(d!)" ; Task successfully completed
+ "KILL(k)") ; Task was cancelled, aborted or is no longer applicable
+ (sequence
+ "[ ](T)" ; A task that needs doing
+ "[-](S)" ; Task is in progress
+ "[?](W)" ; Task is being held up or paused
+ "|"
+ "[X](D)") ; Task was completed
+ (sequence
+ "|"
+ "OKAY(o)"
+ "YES(y)"
+ "NO(n)")))
+
+ (setq org-journal-file-type 'weekly)
+ (setq org-journal-dir org-roam-directory)
+ (setq org-journal-file-format "journal-%Y-%m-%d.org")
+ (setq org-journal-enable-agenda-integration t)
+ (defun kj/org-journal-init ()
+ (interactive)
+ (save-excursion
+ (goto-char (point-min))
+ (org-id-get-create)
+ (org-set-property "category" "journal")))
+
+ (defun kj/org-journal-file-header (time)
+ (format-time-string "#+title: Week of %F (%W)\n"
+ (org-journal--convert-time-to-file-type-time time)))
+ (setq org-journal-file-header #'kj/org-journal-file-header)
+ (add-hook 'org-journal-after-header-create-hook 'kj/org-journal-init)
+
+ ;; Org
+ (add-to-list 'org-export-backends 'md)
+
+ (require 'org-tempo))
+
+(defun org-archive-done-tasks ()
+ (interactive)
+ (org-map-entries
+ (lambda ()
+ (org-archive-subtree)
+ (setq org-map-continue-from (org-element-property :begin (org-element-at-point))))
+ "/DONE" 'file))
+
+(use-package org-pomodoro
+ :ensure t
+ :after org
+ :commands (org-pomodoro)
+ :config
+ (setq
+ org-pomodoro-manual-break t
+ org-pomodoro-time-format "%m"
+ org-pomodoro-format "🍅%s"
+ org-pomodoro-play-sounds nil
+ alert-user-configuration (quote ((((:category . "org-pomodoro")) notifications nil))))
+ :bind
+ (("C-c o p" . org-pomodoro)))
+
;;;; Include modules in lisp/
(defvar kj/module-directory (expand-file-name "lisp" user-emacs-directory))
(push kj/module-directory load-path)
diff --git a/emacs/.config/emacs/lisp/kj-org.el b/emacs/.config/emacs/lisp/kj-org.el
deleted file mode 100644
index bbaf0de..0000000
--- a/emacs/.config/emacs/lisp/kj-org.el
+++ /dev/null
@@ -1,256 +0,0 @@
-;;; -*- lexical-binding: t; -*-
-
-(use-package org
- :config
- (org-babel-do-load-languages 'org-babel-load-languages
- '((emacs-lisp . t)
- (sql . t)
- (shell . t)))
- (setq org-confirm-babel-evaluate nil
- org-return-follows-link t
- )
-
- (setopt org-capture-templates
- '(("s" "Sailing entry" plain (file+datetree "~/org/roam/sailing.org")
- "%^{LOCATION|Brooklyn}p\n%^{VESSEL|J80}p%^{SKIPPER}p%?")))
-
- ;; Install the link type
- (org-add-link-type "notmuch" 'org-notmuch-open)
- (add-hook 'org-store-link-functions 'org-notmuch-store-link)
-
- (defun org-notmuch-store-link ()
- "Store a link to a notmuch search or message."
- (when (eq major-mode 'notmuch-show-mode)
- (let* ((message-id (notmuch-show-get-prop :id))
- (subject (notmuch-show-get-subject))
- (to (notmuch-show-get-to))
- (from (notmuch-show-get-from))
- desc link)
- (org-store-link-props :type "notmuch" :from from :to to
- :subject subject :message-id message-id)
- (setq desc (org-email-link-description))
- (setq link (concat "notmuch:" "id:" message-id))
- (org-add-link-props :link link :description desc)
- link)))
-
- (defun org-notmuch-open (path)
- "Follow a notmuch message link specified by PATH."
- (org-notmuch-follow-link path))
-
- (defun org-notmuch-follow-link (search)
- "Follow a notmuch link to SEARCH.
-
-Can link to more than one message, if so all matching messages are shown."
- (require 'notmuch)
- (notmuch-show (org-link-unescape search)))
-
- (org-add-link-type "notmuch-search" 'org-notmuch-search-open)
- (add-hook 'org-store-link-functions 'org-notmuch-search-store-link)
-
- (defun org-notmuch-search-store-link ()
- "Store a link to a notmuch search or message."
- (when (eq major-mode 'notmuch-search-mode)
- (let ((link (concat "notmuch-search:"
- (org-link-escape notmuch-search-query-string)))
- (desc (concat "Notmuch search: " notmuch-search-query-string)))
- (org-store-link-props :type "notmuch-search"
- :link link
- :description desc)
- link)))
-
- (defun org-notmuch-search-open (path)
- "Follow a notmuch message link specified by PATH."
- (message path)
- (org-notmuch-search-follow-link path))
-
- (defun org-notmuch-search-follow-link (search)
- "Follow a notmuch link by displaying SEARCH in notmuch-search mode."
- (require 'notmuch)
- (notmuch-search (org-link-unescape search)))
-
- ;; If you use `org' and don't want your org files in the default location below,
- ;; change `org-directory'. It must be set before org loads!
- (setq org-directory "~/org/")
- (setq org-todo-keywords
- '((sequence
- "TODO(t)" "ACTIVE(a!)" "WAIT(w@/!)" "|" "DONE(d!)" "CANCELED(c@)")))
- (setq org-refile-use-outline-path nil)
- (setq org-refile-targets '((nil . (:maxlevel . 2))))
- (setq org-log-into-drawer t)
- (setq org-agenda-log-mode-items '(closed clock state))
- (setq org-agenda-start-day nil)
- (setq org-agenda-block-separator nil)
- (setq org-agenda-compact-blocks t)
- (setq org-agenda-start-with-log-mode nil)
- (setq org-habit-show-all-today t)
- (setq org-agenda-time-grid '((daily today require-timed) (800 1600) "......" "----------------------"))
- (setq org-roam-directory (concat org-directory "roam/"))
- (setq-default org-agenda-files '())
- (dolist (file '("tasks.org"
- "running-2022.org"
- "sailing.org"))
- (add-to-list 'org-agenda-files (concat org-roam-directory file)))
- (setq org-roam-db-location (concat org-roam-directory "/org-roam.db"))
- (setq org-export-with-toc nil)
- (setq deft-directory org-directory)
- (setq deft-recursive t)
- ;; Org html export
- (setq org-html-htmlize-output-type 'css)
- ;; Website publish settings.
- (defvar kj/publish-tag "publish")
- (defvar kj/publish-directory "/ssh:orbekk@dragon.orbekk.com:/storage/srv/kj.orbekk.com")
- (add-to-list 'org-modules 'org-habit)
-
- (defvar org-publish-project-alist)
- (defun kj/find-agenda-files-containing-tag (tag)
- (setq org-agenda-archives-mode nil)
- (let* ((org-agenda-archives-mode nil)
- (candidates (org-agenda-files nil 'ifmode))
- (matcher (cdr (org-make-tags-matcher tag)))
- (files))
- ;; (message "Results:")
- (dolist (file candidates files)
- (org-check-agenda-file file)
- (with-current-buffer (org-get-agenda-file-buffer file)
- ;; (message "%S" (org-scan-tags 'agenda matcher nil))
- (when (org-scan-tags 'agenda matcher nil)
- (push file files))))))
-
- (defun kj/org-publish (&optional project force)
- (interactive)
- (setq project (or project "all"))
- (setq force (or force current-prefix-arg))
- (setq org-agenda-files (list org-roam-directory))
- (let* ((static-files-re (string-join '("css" "txt" "jpg" "png" "gif" "svg") "\\|"))
- (files-to-include (kj/find-agenda-files-containing-tag kj/publish-tag))
- ;; Disable org babel exports during publish entirely to speed up publish.
- ;; This messes up babel output handling.
- ;; (org-export-use-babel nil)
- (org-babel-default-header-args
- (kj/assq-replace '((:exports . "both")
- (:eval . "never-export"))
- org-babel-default-header-args))
- (org-publish-project-alist
- `(
- ("static"
- :base-directory ,(concat org-roam-directory "/static")
- :base-extension ,static-files-re
- :recursive t
- :publishing-directory ,(concat kj/publish-directory "/static")
- :publishing-function org-publish-attachment)
- ("source"
- :base-directory ,org-roam-directory
- :base-extension "org"
- :exclude ".*"
- :include ,files-to-include
- :recursive t
- :publishing-directory ,kj/publish-directory
- :publishing-function org-publish-attachment)
- ("html"
- :base-directory ,org-roam-directory
- :base-extension "org"
- :recursive t
- :exclude ".*"
- :include ,files-to-include
- :publishing-directory ,kj/publish-directory
- :publishing-function org-html-publish-to-html
-
- :with-broken-links t
- :with-toc nil
- :with-latex t
- :with-drawers t
- :with-title t
- :section-numbers nil
-
- ;; HTML options
- :html-toplevel-hlevel 2
- :html-preamble ""
- :html-postamble ""
- :html-html5-fancy t
- :html-doctype "html5"
- :html-head "<link rel=\"stylesheet\" type=\"text/css\" href=\"static/org.css\"/>"
- :html-head-include-scripts nil
- :html-head-include-default-style nil
- :html-container article)
-
- ("all" :components ("static" "source" "html")))))
-
- (org-publish project force)))
- ; (setq org-appear-autolinks t)
- ; (use-package! org-appear
- ; :hook (org-mode . org-appear-mode))
-
- (setq org-log-done 'time)
- (setq org-todo-keywords
- '((sequence
- "TODO(t)" ; A task that needs doing & is ready to do
- "PROJ(p)" ; A project, which usually contains other tasks
- "LOOP(r)" ; A recurring task
- "STRT(s)" ; A task that is in progress
- "WAIT(w)" ; Something external is holding up this task
- "HOLD(h)" ; This task is paused/on hold because of me
- "IDEA(i)" ; An unconfirmed and unapproved task or notion
- "|"
- "DONE(d!)" ; Task successfully completed
- "KILL(k)") ; Task was cancelled, aborted or is no longer applicable
- (sequence
- "[ ](T)" ; A task that needs doing
- "[-](S)" ; Task is in progress
- "[?](W)" ; Task is being held up or paused
- "|"
- "[X](D)") ; Task was completed
- (sequence
- "|"
- "OKAY(o)"
- "YES(y)"
- "NO(n)")))
-
- (setq org-journal-file-type 'weekly)
- (setq org-journal-dir org-roam-directory)
- (setq org-journal-file-format "journal-%Y-%m-%d.org")
- (setq org-journal-enable-agenda-integration t)
- (defun kj/org-journal-init ()
- (interactive)
- (save-excursion
- (goto-char (point-min))
- (org-id-get-create)
- (org-set-property "category" "journal")))
-
- (defun kj/org-journal-file-header (time)
- (format-time-string "#+title: Week of %F (%W)\n"
- (org-journal--convert-time-to-file-type-time time)))
- (setq org-journal-file-header #'kj/org-journal-file-header)
- (add-hook 'org-journal-after-header-create-hook 'kj/org-journal-init)
-
- ;; Org
- (add-to-list 'org-export-backends 'md)
-
- (require 'org-tempo))
-
-(defun org-archive-done-tasks ()
- (interactive)
- (org-map-entries
- (lambda ()
- (org-archive-subtree)
- (setq org-map-continue-from (org-element-property :begin (org-element-at-point))))
- "/DONE" 'file))
-
-(use-package org-pomodoro
- :ensure t
- :after org
- :commands (org-pomodoro)
- :config
- (setq
- org-pomodoro-manual-break t
- org-pomodoro-time-format "%m"
- org-pomodoro-format "🍅%s"
- org-pomodoro-play-sounds nil
- alert-user-configuration (quote ((((:category . "org-pomodoro")) notifications nil))))
- :bind
- (("C-c o p" . org-pomodoro)))
-
-;; (use-package org-tidy
-;; :after org
-;; :hook (org-mode . org-tidy-mode))
-
-(provide 'kj-org)