summaryrefslogtreecommitdiff
path: root/emacs/.config/emacs-kj/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'emacs/.config/emacs-kj/lisp')
-rw-r--r--emacs/.config/emacs-kj/lisp/kj-bindings.el34
-rw-r--r--emacs/.config/emacs-kj/lisp/kj-defaults.el49
-rw-r--r--emacs/.config/emacs-kj/lisp/kj-development.el93
-rw-r--r--emacs/.config/emacs-kj/lisp/kj-email.el97
-rw-r--r--emacs/.config/emacs-kj/lisp/kj-eshell.el83
-rw-r--r--emacs/.config/emacs-kj/lisp/kj-history.el65
-rw-r--r--emacs/.config/emacs-kj/lisp/kj-lib.el11
-rw-r--r--emacs/.config/emacs-kj/lisp/kj-multiple-cursors.el20
-rw-r--r--emacs/.config/emacs-kj/lisp/kj-org.el251
-rw-r--r--emacs/.config/emacs-kj/lisp/kj-popup.el95
10 files changed, 0 insertions, 798 deletions
diff --git a/emacs/.config/emacs-kj/lisp/kj-bindings.el b/emacs/.config/emacs-kj/lisp/kj-bindings.el
deleted file mode 100644
index d82706f..0000000
--- a/emacs/.config/emacs-kj/lisp/kj-bindings.el
+++ /dev/null
@@ -1,34 +0,0 @@
-;;; -*- lexical-binding: t; -*-
-
-(use-package emacs
- :bind
- (("C-w" . kj/kill-word-or-region)
- ("C-c s" . kj/shell-here)
- ("C-c t" . eshell)
- ("C-c ." . kj/eshell-here)
- ("C-c c" . org-capture)
- ("M-o" . other-window)
- ("C-c a m" . notmuch)
- ("C-c M" . smerge-ediff)
- ("C-c b r" . revert-buffer)
- ("C-c r l" . consult-flymake)
- ("C-c r f" . eglot-format)
- ("C-c r g" . recompile)
- ("C-c r a" . eglot-code-actions)
- ("C-c r r" . eglot-rename)
- ("C-c r n" . flymake-goto-next-error)
- ("C-c r p" . flymake-goto-prev-error)
- ("C-c w u" . winner-undo)
- ("C-c w U" . winner-redo)
- ("C-<tab>" . completion-at-point)
- ;; Replace downcase-word binding.
- ("M-l" . iso-transl-ctl-x-8-map))
-
- :config
- (defvar kj/flymake-repeat-map (make-sparse-keymap "flymake"))
- (define-repeating-key kj/flymake-repeat-map "n" flymake-goto-next-error "next error")
- (define-repeating-key kj/flymake-repeat-map "p" flymake-goto-prev-error "prev error")
- (define-key kj/flymake-repeat-map (kbd "C-g") '("quit" . ignore))
- )
-
-(provide 'kj-bindings)
diff --git a/emacs/.config/emacs-kj/lisp/kj-defaults.el b/emacs/.config/emacs-kj/lisp/kj-defaults.el
deleted file mode 100644
index a5ced96..0000000
--- a/emacs/.config/emacs-kj/lisp/kj-defaults.el
+++ /dev/null
@@ -1,49 +0,0 @@
-;;; -*- lexical-binding: t; -*-
-
-;; Backups
-(make-directory "~/.cache/emacs_backups/" t)
-(make-directory "~/.cache/emacs_autosave/" t)
-(setq backup-directory-alist '(("." . "~/.cache/emacs_backups/")))
-(setq auto-save-file-name-transforms '((".*" "~/.cache/emacs_autosave/" t)))
-
-;; Keep backups, but avoid same directory since it can be slow on tramp.
-(setq version-control t
- delete-old-versions -1
- vc-make-backup-files t
- create-lockfiles nil
- backup-by-copying t)
-
-(setq-default indent-tabs-mode nil)
-(setq sentence-end-double-space nil)
-(setq save-interprogram-paste-before-kill t)
-(setq mouse-yank-at-point t)
-(setq enable-recursive-minibuffers t)
-(set-language-environment "utf-8")
-(setq require-final-newline t)
-;; Save bookmark list every time a bookmark is added.
-(setq bookmark-save-flag 1)
-(delete-selection-mode 1)
-
-(savehist-mode 1)
-
-;; Resize settings
-(setq frame-inhibit-implied-resize t)
-(setq pixel-scroll-precision-mode t)
-
-(setq kill-whole-line t)
-
-(defun kj/kill-word-or-region (arg)
- (interactive "p")
- (if (region-active-p)
- (kill-region (region-beginning) (region-end))
- (backward-kill-word (or arg 1))))
-(global-set-key (kbd "C-w") 'kj/kill-word-or-region)
-
-(defun kj/open-line (n)
- (interactive "*p")
- (beginning-of-line)
- (open-line n)
- (indent-according-to-mode))
-(global-set-key (kbd "C-o") 'kj/open-line)
-
-(provide 'kj-defaults)
diff --git a/emacs/.config/emacs-kj/lisp/kj-development.el b/emacs/.config/emacs-kj/lisp/kj-development.el
deleted file mode 100644
index 397f0cc..0000000
--- a/emacs/.config/emacs-kj/lisp/kj-development.el
+++ /dev/null
@@ -1,93 +0,0 @@
-;;; -*- lexical-binding: t; -*-
-(setq tab-stop-list (number-sequence 4 200 4))
-
-(use-package eglot
- :config
- (setq eglot-events-buffer-size 0))
-
-(add-hook 'prog-mode-hook 'subword-mode)
-
-;; Only used to get better eglot snippets.
-(use-package yasnippet
- :config
- (add-to-list 'yas-snippet-dirs (expand-file-name "yasnippets" user-emacs-directory))
- (yas-global-mode))
-
-(use-package rustic
- :after eglot
- :bind (("C-c C-r C-s" . rustic-popup)
- ("C-c C-r C-n" . kj/rustic-nextest-all))
- :config
- (defun kj/rustic-nextest-all ()
- (interactive)
- (setq rustic-cargo-nextest-exec-command "nextest run --run-ignored all")
- (rustic-cargo-run-nextest))
- (setq
- ;; eglot seems to be the best option right now.
- rustic-lsp-client 'eglot
- rustic-format-on-save nil
- ;; Prevent automatic syntax checking, which was causing lags and stutters.
- ;; eglot-send-changes-idle-time (* 60 60)
- )
- :hook
- (rustic-mode . eglot-ensure)
- ;; Disable the annoying doc popups in the minibuffer.
- ;; (add-hook 'eglot-managed-mode-hook (lambda () (eldoc-mode -1)))
- )
-
-(use-package markdown-mode
- :ensure t
- :mode ("README\\.md\\'" . gfm-mode)
- :init (setq markdown-command "multimarkdown"))
-
-(straight-use-package
- '(nix-mode :type git :host github :repo "NixOS/nix-mode"))
-(use-package nix-mode
- :mode "\\.nix\\'")
-
-(use-package ledger-mode
- :mode "\\.journal")
-(use-package unobtrusive-magit-theme)
-
-(use-package editorconfig
- :ensure t
- :config
- (editorconfig-mode 1))
-
-(use-package tree-sitter
- :config
- (global-tree-sitter-mode)
- (add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode))
-
-(use-package tree-sitter-langs
- :after tree-sitter)
-
-(use-package clojure-mode)
-
-;; Devicetree mode for keyboard configs.
-(use-package dts-mode
- :mode "\\.keymap\\'")
-
-(use-package yaml-mode
- :mode "\\.\(yml|yaml\)\\'")
-
-(use-package ansi-color
- :hook (compilation-filter . ansi-color-compilation-filter))
-
-(use-package diff-hl
- :config
- (add-hook 'magit-pre-refresh-hook 'diff-hl-magit-pre-refresh)
- (add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh)
- (global-diff-hl-mode))
-
-(use-package graphviz-dot-mode
- :ensure t)
-
-(use-package haskell-mode)
-(use-package tidal
- :config
- (setq tidal-boot-script-path "~/projects/audio/BootTidal.hs"))
-
-(use-package ess)
-
-(provide 'kj-development)
diff --git a/emacs/.config/emacs-kj/lisp/kj-email.el b/emacs/.config/emacs-kj/lisp/kj-email.el
deleted file mode 100644
index 6cfba74..0000000
--- a/emacs/.config/emacs-kj/lisp/kj-email.el
+++ /dev/null
@@ -1,97 +0,0 @@
-;;; -*- lexical-binding: t; -*-
-
-(setq kj/fastmail-maildir (expand-file-name "~/Maildir/fastmail"))
-
-(when (file-exists-p (expand-file-name "~/Maildir"))
- (with-eval-after-load 'message
- (setq message-mail-user-agent 'notmuch-user-agent
- message-cite-style 'message-cite-style-gmail
- message-citation-line-function 'message-insert-formatted-citation-line
- message-kill-buffer-on-exit t)
- (add-hook 'message-mode-hook 'turn-off-auto-fill)
- (add-hook 'message-mode-hook 'visual-line-mode))
- (use-package notmuch
- :config
-
- (setq notmuch-show-all-tags-list t
- notmuch-show-relative-dates t
- notmuch-hello-tag-list-make-query "tag:unread"
- notmuch-archive-tags '("-inbox" "-unread")
- notmuch-fcc-dirs nil
- notmuch-show-logo nil
- notmuch-mua-cite-function 'message-cite-original-without-signature
- notmuch-wash-citation-lines-prefix most-positive-fixnum
- notmuch-wash-citation-lines-suffix most-positive-fixnum
- notmuch-show-indent-messages-width 0)
- (add-hook 'notmuch-show-hook 'kj/disable-trailing-whitespace)
-
- (defun kj/confirm-empty-subject ()
- "Allow user to quit when current message subject is empty."
- (or (message-field-value "Subject")
- (yes-or-no-p "Really send without Subject? ")
- (keyboard-quit)))
- (add-hook 'message-send-hook #'kj/confirm-empty-subject)
- (advice-add
- 'message-send :before (defun kj/notmuch-switch-to-local (&args)
- (when (file-remote-p default-directory)
- (cd (expand-file-name "~")))))
- (setq notmuch-saved-searches
- '((:name "inbox" :query "tag:inbox -tag:_gz" :key "i" :search-type tree)
- (:name "unread" :query "tag:unread" :key "u" :search-type tree)
- (:name "flagged" :query "tag:flagged" :key "f" :search-type tree)
- (:name "sent" :query "tag:sent" :key "t" :search-type tree)
- (:name "drafts" :query "tag:draft" :key "d" :search-type tree)
- (:name "all mail" :query "*" :key "a" :search-type tree)
- )))
-
- (setq kj/notmuch-wash-citation-regexp "^\\(\\(>\\|[[:space:]]\\)+\\).*\n")
-
- ;;; XXX consider upstreaming this.
- (defun kj/notmuch-wash-citations-by-depth (_msg _depth)
- (goto-char (point-min))
- (beginning-of-line)
- (let ((maxlevel 1))
- (while (intern-soft (format "message-cited-text-%d" maxlevel))
- (setq maxlevel (1+ maxlevel)))
- (setq maxlevel (1- maxlevel))
-
- (while (and (< (point) (point-max))
- (re-search-forward kj/notmuch-wash-citation-regexp nil t))
- (let* ((cite-start (match-beginning 0))
- (cite-end (match-end 0))
- (cite-level (seq-count (lambda (c) (eql c ?>)) (match-string 1)))
- (face-level (1+ (% (1- cite-level) maxlevel)))
- (cited-text-face (intern (format "message-cited-text-%d" face-level))))
- (overlay-put (make-overlay cite-start cite-end)
- 'face cited-text-face)))))
- ;; This doesn't seem to work that well... :(
- ;;(add-hook 'notmuch-show-insert-text/plain-hook #'kj/notmuch-wash-citations-by-depth 90)
-
- (defun kj/notmuch-tree-by-tag (tag)
- (interactive
- (list (notmuch-select-tag-with-completion "Notmuch search tag: ")))
- (notmuch-tree (concat "tag:" tag)))
-
- (define-key notmuch-hello-mode-map "T"
- 'kj/notmuch-tree-by-tag)
-
- (define-key notmuch-show-mode-map "!"
- (lambda ()
- "mark message as spam"
- (interactive)
- (notmuch-show-tag (list "+_gz" "-inbox"))))
-
- (define-key notmuch-search-mode-map "!"
- (lambda (&optional beg end)
- "mark thread as spam"
- (interactive (notmuch-interactive-region))
- (notmuch-search-tag (list "+_gz" "-inbox") beg end)))
- )
-
-(when (file-exists-p kj/fastmail-maildir)
- (setq sendmail-program "mujmap"
- message-send-mail-function 'message-send-mail-with-sendmail
- message-signature "Kjetil"
- message-sendmail-extra-arguments (list "-C" kj/fastmail-maildir "send")))
-
-(provide 'kj-email)
diff --git a/emacs/.config/emacs-kj/lisp/kj-eshell.el b/emacs/.config/emacs-kj/lisp/kj-eshell.el
deleted file mode 100644
index 7004b1d..0000000
--- a/emacs/.config/emacs-kj/lisp/kj-eshell.el
+++ /dev/null
@@ -1,83 +0,0 @@
-;;; -*- lexical-binding: t; -*-
-(use-package eshell
- :bind
- (:map eshell-mode-map
- ("M-r" . consult-history))
- :hook ((eshell-first-time-mode . kj/eshell-on-load))
- :config
- (add-hook 'eshell-mode-hook
- (lambda ()
- (setenv "PAGER" "cat"))
- (setenv "EDITOR" "emacsclient"))
- (setq eshell-prefer-lisp-functions nil
- eshell-scroll-to-bottom-on-input 'all
- eshell-hist-ignoredups t
- eshell-destroy-buffer-when-process-dies t
- eshell-error-if-no-glob t)
- (setq tramp-remote-path '(tramp-own-remote-path))
-
- (defun kj/eshell-on-load ()
- (dolist (command '("htop" "tmux" "vim" "nvim" "watch"))
- (add-to-list 'eshell-visual-commands
- command))
-
- ;; (define-key eshell-prompt-mode-map (kbd "C-d") 'eshell-life-is-too-much)
- )
-
- (add-to-list 'eshell-complex-commands "ssh")
-
- (add-to-list 'eshell-modules-list 'eshell-tramp)
- (add-hook 'eshell-mode-hook 'visual-line-mode))
-
-(use-package pcmpl-args)
-
-(use-package esh-help
- :init
- (setup-esh-help-eldoc))
-
-(use-package eshell-syntax-highlighting
- :hook (eshell-mode . eshell-syntax-highlighting-mode))
-
-(defun eshell/ssh (&rest args)
- (if (= 1 (length args))
- (throw 'eshell-replace-command
- (eshell/cd
- (format "/ssh:%s:" (car args))))
- (throw 'eshell-replace-command
- (eshell-parse-command "*ssh"
- (eshell-stringify-list (flatten-tree args))))))
-
-(defvar kj/eshell-here-directory)
-
-(defun kj/eshell-buffer-name ()
- (let ((base (concat "*eshell:" default-directory)))
- (cond
- ((not (get-buffer base)) base)
- (t (cl-loop for n from 2
- for name = (format "%s<%d>" base n)
- until (not (get-buffer name))
- finally return name)))))
-
-(defun kj/eshell-update-buffer-name ()
- (interactive)
- (rename-buffer (kj/eshell-buffer-name)))
-(add-hook 'eshell-directory-change-hook 'kj/eshell-update-buffer-name)
-
-(defun kj/new-eshell-here ()
- (let ((default-directory kj/eshell-here-directory))
- (eshell t)))
-
-(defun kj/eshell-here ()
- (interactive)
- (unless (eq last-command 'kj/eshell-here)
- (setq kj/eshell-here-directory
- (if (derived-mode-p 'eshell-mode)
- (with-current-buffer (other-buffer (current-buffer) t)
- default-directory)
- default-directory)))
- (if (derived-mode-p 'eshell-mode)
- (kj/new-eshell-here)
- (eshell))
- (kj/eshell-update-buffer-name))
-
-(provide 'kj-eshell)
diff --git a/emacs/.config/emacs-kj/lisp/kj-history.el b/emacs/.config/emacs-kj/lisp/kj-history.el
deleted file mode 100644
index 31cd8c1..0000000
--- a/emacs/.config/emacs-kj/lisp/kj-history.el
+++ /dev/null
@@ -1,65 +0,0 @@
-;; -*- lexical-binding: t; -*-
-
-(defvar kj/history-command "fc -R $HISTFILE && fc -l 1"
- "History command used to get shell history.")
-
-(defvar kj/history-regexp
- (rx bol (* " ")
- ;; Index
- (* digit)
- (* " ")
- ;; Command
- (group (1+ (not "\n")))))
-
-(use-package consult
- :config
- (defun kj/get-shell-history ()
- (with-temp-buffer
- (unless (process-file
- "zsh"
- nil
- (current-buffer)
- nil
- "-c"
- kj/history-command)
- (error "Getting history failed: %s" (buffer-string)))
- (goto-char (point-min))
- (let ((result))
- (save-match-data
- (while (re-search-forward kj/history-regexp nil t)
- (let ((command
- ;; Fix up multi-line commands.
- (string-replace "\\\\n" "\\\n" (match-string-no-properties 1))))
- (push command result))))
- result)))
-
- (defun kj/consult-history ()
- (interactive)
- (if (not
- (or (and (minibufferp)
- (eq minibuffer-history-variable 'shell-command-history))
- (derived-mode-p 'term-mode 'shell-mode)
- ))
- (call-interactively 'consult-history)
- (pcase-let* ((bol
- (cond ((derived-mode-p 'eshell-mode) 'eshell-bol)
- ((derived-mode-p 'term-mode) 'term-bol)
- ((derived-mode-p 'comint-mode) 'comint-bol)))
- (`(,beg . ,end)
- (cond ((minibufferp)
- (cons (minibuffer-prompt-end) (point-max)))
- (bol (save-excursion
- (funcall bol)
- (cons (point) (pos-eol))))
- (t (cons (point) (point)))))
- (str (consult--read
- (kj/get-shell-history)
- :prompt "Shell history: "
- :history t
- :sort nil
- :initial (buffer-substring-no-properties beg end)
- :state (consult--insertion-preview beg end))))
- (delete-region beg end)
- (insert (substring-no-properties str))))))
-
-(provide 'kj-history)
diff --git a/emacs/.config/emacs-kj/lisp/kj-lib.el b/emacs/.config/emacs-kj/lisp/kj-lib.el
deleted file mode 100644
index 5df1822..0000000
--- a/emacs/.config/emacs-kj/lisp/kj-lib.el
+++ /dev/null
@@ -1,11 +0,0 @@
-;;; -*- lexical-binding: t; -*-
-
-(defmacro define-repeating-key (keymap key cmd &optional desc)
- `(let ((def
- ,(if desc
- `'(,desc . ,cmd)
- `',cmd)))
- (define-key ,keymap ,key def)
- (put ',cmd 'repeat-map ',keymap)))
-
-(provide 'kj-lib)
diff --git a/emacs/.config/emacs-kj/lisp/kj-multiple-cursors.el b/emacs/.config/emacs-kj/lisp/kj-multiple-cursors.el
deleted file mode 100644
index 962193d..0000000
--- a/emacs/.config/emacs-kj/lisp/kj-multiple-cursors.el
+++ /dev/null
@@ -1,20 +0,0 @@
-;;; -*- lexical-binding: t; -*-
-
-(use-package multiple-cursors
- :config
- (defvar kj/multiple-cursors-map (make-sparse-keymap "cursors"))
- (define-repeating-key kj/multiple-cursors-map "." mc/mark-next-like-this "→ this")
- (define-repeating-key kj/multiple-cursors-map "," mc/mark-previous-like-this "← this")
- (define-repeating-key kj/multiple-cursors-map ">" mc/skip-to-next-like-this "⇥ this")
- (define-repeating-key kj/multiple-cursors-map "<" mc/skip-to-previous-like-this "⇤ this")
- (define-repeating-key kj/multiple-cursors-map "<" mc/skip-to-previous-like-this "⇤ this")
- (define-repeating-key kj/multiple-cursors-map "*" mc/mark-all-like-this "all like this")
- (define-repeating-key kj/multiple-cursors-map "w" mc/mark-next-like-this-word "word")
- (define-repeating-key kj/multiple-cursors-map "s" mc/mark-next-like-this-symbol "symbol")
- (define-repeating-key kj/multiple-cursors-map "(" mc/mark-all-symbols-like-this-in-defun "symbol defun")
- (define-repeating-key kj/multiple-cursors-map (kbd "DEL") mc/unmark-next-like-this "DEL last")
- (define-repeating-key kj/multiple-cursors-map (kbd "<delete>") mc/unmark-previous-like-this "DEL first")
- (define-key kj/multiple-cursors-map (kbd "C-g") '("quit" . ignore))
- (global-set-key (kbd "C-c m") (cons "cursors" kj/multiple-cursors-map)))
-
-(provide 'kj-multiple-cursors)
diff --git a/emacs/.config/emacs-kj/lisp/kj-org.el b/emacs/.config/emacs-kj/lisp/kj-org.el
deleted file mode 100644
index b6fda9c..0000000
--- a/emacs/.config/emacs-kj/lisp/kj-org.el
+++ /dev/null
@@ -1,251 +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
- )
-
- ;; 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"))
- (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)
diff --git a/emacs/.config/emacs-kj/lisp/kj-popup.el b/emacs/.config/emacs-kj/lisp/kj-popup.el
deleted file mode 100644
index 0ac99a5..0000000
--- a/emacs/.config/emacs-kj/lisp/kj-popup.el
+++ /dev/null
@@ -1,95 +0,0 @@
-;;; -*- lexical-binding: t; -*-
-;;; Window placement
-;;; TODO: Test popper.el.
-;; (global-set-key (kbd "C-`") #'window-toggle-side-windows)
-;; (global-set-key (kbd "M-`") #'kj/popup-toggle-override)
-;; (setq window-sides-slots '(0 0 2 2)) ; 2 right side windows
-(setq switch-to-buffer-obey-display-actions t)
-(setq switch-to-buffer-in-dedicated-window 'pop)
-(setq even-window-sizes 'width-only)
-(defvar kj/popup-override nil)
-
-(defun kj/popup-clear-overrides ()
- (interactive)
- (dolist (buffer (buffer-list))
- (with-current-buffer buffer
- (kill-local-variable 'kj/popup-override))))
-
-(defun kj/popup-toggle-override ()
- (interactive)
- (if (local-variable-p 'kj/popup-override)
- (kill-local-variable 'kj/popup-override)
- (setq-local kj/popup-override
- (not (kj/popup-buffer-base (buffer-name)))))
- (let ((buffer (buffer-name)))
- (switch-to-prev-buffer)
- (switch-to-buffer buffer)))
-
-(defun kj/popup-buffer-base (buffer &optional condition)
- (or
- (s-matches-p
- (rx (| "*Help*"
- "*info*"
- (seq "*Messages*")
- (seq "*Warnings*")
- (seq "*Backtrace*")
- (seq "*eldoc " (* anything) "*")
- (seq "*WoMan " (* anything) "*")
- (seq "*man " (* anything) "*")
- (seq "fig: " (* anything))
- (seq "*htop*" (* anything))
- (seq "*Proced*" (* anything))
- (seq "*eshell" (* anything))
- (seq "*shell" (* anything))
- "*Occur*")) buffer)
- (with-current-buffer buffer
- (apply #'derived-mode-p
- '(magit-mode
- compilation-mode
- shell-mode
- comint-mode
- Custom-mode ; For customization
- fig-commit-mode)))))
-
-(defun kj/popup-buffer (buffer &optional condition)
- (with-current-buffer buffer
- (if (local-variable-p 'kj/popup-override)
- kj/popup-override
- (kj/popup-buffer-base buffer condition))))
-
-;; (setq transient-display-buffer-action
-;; '(display-buffer-in-best-side
-;; (slot . -1)
-;; (inhibit-same-window . t)
-;; (window-parameters
-;; (no-other-window . t))))
-
-(defun kj/display-new-popup (buffer alist)
- (let ((popup-window
- (display-buffer-in-direction
- buffer
- (append (if (> (frame-width) 160)
- '((direction . rightmost)
- (window-width . 80))
- '((direction . bottom)))))))
- (set-window-parameter popup-window 'kj/popup t)
- popup-window))
-
-(defun kj/find-popup-window ()
- (seq-find
- (lambda (w)
- (window-parameter w 'kj/popup))
- (window-list)))
-
-(defun display-popup-buffer (buffer alist)
- (let ((window (kj/find-popup-window)))
- (if window
- (window--display-buffer buffer window 'reuse alist)
- (kj/display-new-popup buffer alist))))
-
-;; (add-to-list 'display-buffer-alist
-;; `(kj/popup-buffer
-;; (display-popup-buffer)
-;; (slot . 0)))
-
-(provide 'kj-popup)