Full Refactor and history reset
This commit is contained in:
415
dotfiles/emacs/config.org
Normal file
415
dotfiles/emacs/config.org
Normal file
@@ -0,0 +1,415 @@
|
||||
#+PROPERTY: header-args :tangle config.el
|
||||
|
||||
* My Info
|
||||
Basic info for some templates
|
||||
|
||||
#+begin_src elisp
|
||||
(setq user-full-name "Joe Bellus"
|
||||
user-mail-address "joe@5sigma.io")
|
||||
#+end_src
|
||||
|
||||
* Appearance
|
||||
** Fonts
|
||||
Setup default fonts and faces.
|
||||
#+begin_src elisp
|
||||
(setq doom-font (font-spec :family "PragmataPro Mono Liga" :size 16 :weight 'bold)
|
||||
doom-variable-pitch-font (font-spec :family "Iosevka" :size 16 :weight 'light)
|
||||
doom-big-font (font-spec :family "Iosevka" :size 22. :weight 'medium)
|
||||
doom-themes-enable-bold t
|
||||
doom-themes-enable-italic t
|
||||
)
|
||||
#+End_src
|
||||
** Window Size
|
||||
#+begin_src elisp
|
||||
;; (setq default-frame-alist '((width . 200) (height . 55)))
|
||||
#+end_src
|
||||
|
||||
** Theme
|
||||
#+begin_src elisp
|
||||
(setq doom-theme 'doom-palenight)
|
||||
;; (after! doom-themes
|
||||
;; (load-theme 'doom-nano-light t))
|
||||
;; (use-package! doom-nano-modeline
|
||||
;; :config
|
||||
;; (doom-nano-modeline-mode 1)
|
||||
;; (global-hide-mode-line-mode nil))
|
||||
#+end_src
|
||||
|
||||
** Translucency
|
||||
Setup some translucency to make things look nice.
|
||||
#+begin_src emacs-lisp
|
||||
(doom/set-frame-opacity 100)
|
||||
(set-frame-parameter nil 'alpha-background 100)
|
||||
(add-to-list 'default-frame-alist '(alpha-background . 100))
|
||||
#+end_src
|
||||
|
||||
* Startup
|
||||
** Load custom scripts
|
||||
#+begin_src elisp
|
||||
;; (add-to-list 'load-path "~/.config/doom/el")
|
||||
#+end_src
|
||||
|
||||
** Startup buffer
|
||||
#+begin_src elisp
|
||||
(setq +doom-dashboard-menu-sections '
|
||||
(
|
||||
("Recently opened files" :icon
|
||||
(nerd-icons-faicon "nf-fa-file_text" :face 'doom-dashboard-menu-title)
|
||||
:action recentf-open-files)
|
||||
("Open org-agenda"
|
||||
:icon (nerd-icons-octicon "nf-oct-calendar" :face 'doom-dashboard-menu-title)
|
||||
:when (fboundp 'org-agenda)
|
||||
:action org-agenda)
|
||||
("Open Notes"
|
||||
:icon (nerd-icons-faicon "nf-fa-file_text" :face 'doom-dashboard-menu-title)
|
||||
:action +default/browse-notes)
|
||||
))
|
||||
|
||||
(remove-hook '+doom-dashboard-functions #'doom-dashboard-widget-shortmenu)
|
||||
(remove-hook '+doom-dashboard-functions #'doom-dashboard-widget-banner)
|
||||
(remove-hook '+doom-dashboard-functions #'doom-dashboard-widget-footer)
|
||||
(remove-hook '+doom-dashboard-functions #'doom-dashboard-widget-loaded)
|
||||
|
||||
(setq +doom-dashboard-banner-padding '(1 . 1))
|
||||
(add-hook! '+doom-dashboard-functions :append 'doom-dashboard-widget-shortmenu)
|
||||
(add-hook! '+doom-dashboard-functions :append 'doom-dashboard-widget-loaded)
|
||||
#+end_src
|
||||
|
||||
* Editor
|
||||
** Line numbering
|
||||
Enable basic line numbering
|
||||
|
||||
#+begin_src elisp
|
||||
(setq display-line-numbers-type t)
|
||||
#+end_src
|
||||
|
||||
** Quit Confirmation
|
||||
Don't prompt to quit
|
||||
|
||||
#+begin_src elisp
|
||||
(setq confirm-kill-emacs nil)
|
||||
#+end_src
|
||||
** Horizontal scrolling
|
||||
#+begin_src elisp
|
||||
(setq mouse-wheel-tilt-scroll t)
|
||||
#+end_src
|
||||
** Precision mouse scrolling
|
||||
#+begin_src elisp
|
||||
(setq pixel-scroll-precision-mode t)
|
||||
#+end_src
|
||||
|
||||
* Org Mode
|
||||
** General settings
|
||||
#+begin_src elisp
|
||||
(require 'org)
|
||||
(setq org-ellipsis " ⋯"
|
||||
org-hide-emphasis-markers t
|
||||
org-src-fontify-natively t
|
||||
org-fontify-quote-and-verse-blocks t
|
||||
org-src-tab-acts-natively t
|
||||
org-hide-block-startup nil
|
||||
org-startup-folded 'content
|
||||
org-cycle-separator-lines 2
|
||||
org-directory "~/org/"
|
||||
org-agenda-files '("~/org/" "~/org/agenda/" "~/org/agenda/projects/")
|
||||
)
|
||||
|
||||
(setq-default prettify-symbols-alist '(("#+BEGIN_SRC" . "⇨")
|
||||
("#+END_SRC" . "")
|
||||
("#+begin_src" . "⇨")
|
||||
("#+end_src" . "")))
|
||||
(setq prettify-symbols-unprettify-at-point 'right-edge)
|
||||
|
||||
(defun org-setup ()
|
||||
(setq-local display-line-numbers nil))
|
||||
(add-hook 'org-mode-hook 'org-setup)
|
||||
#+end_src
|
||||
|
||||
** Visual fill column
|
||||
#+begin_src elisp
|
||||
(setq visual-fill-column-width 110
|
||||
visual-fill-column-center-text t)
|
||||
#+end_src
|
||||
|
||||
** Org presentation
|
||||
#+begin_src elisp
|
||||
(defun my/org-present-start ()
|
||||
(visual-fill-column-mode 1)
|
||||
(setq header-line-format " ")
|
||||
(visual-line-mode 1)
|
||||
(hide-mode-line-mode)
|
||||
(setq-local
|
||||
hl-line-mode nil)
|
||||
(setq-local face-remapping-alist
|
||||
'((default (:height 1.5) variable-pitch)
|
||||
(header-line (:height 4.0) variable-pitch)
|
||||
(org-document-title (:height 1.75) org-document-title)
|
||||
(org-code (:height 1.55) org-code)
|
||||
(org-verbatim (:height 1.55) org-verbatim)
|
||||
(org-block (:height 1.25) org-block)
|
||||
(org-block-begin-line (:height 0.7) org-block)))
|
||||
)
|
||||
|
||||
(defun my/org-present-end ()
|
||||
(visual-fill-column-mode 0)
|
||||
(hide-mode-line-mode)
|
||||
(visual-line-mode 0)
|
||||
(setq header-line-format nil)
|
||||
(setq-local face-remapping-alist nil
|
||||
hl-line-mode t))
|
||||
(add-hook 'org-present-mode-hook 'my/org-present-start)
|
||||
(add-hook 'org-present-mode-quit-hook 'my/org-present-end)
|
||||
#+end_src
|
||||
|
||||
** Setup org header faces
|
||||
#+begin_src elisp
|
||||
(dolist
|
||||
(face '((org-level-1 . 1.2)
|
||||
(org-level-2 . 1.1)
|
||||
(org-level-3 . 1.05)
|
||||
(org-level-4 . 1.0)
|
||||
(org-level-5 . 1.0)
|
||||
(org-level-6 . 1.0)
|
||||
(org-level-7 . 1.0)
|
||||
(org-level-8 . 1.0)))
|
||||
(set-face-attribute (car face) nil
|
||||
:font "Iosevka"
|
||||
:weight 'medium
|
||||
:height (cdr face)))
|
||||
(set-face-attribute 'org-document-title nil :font "Iosevka" :weight 'bold :height 1.3)
|
||||
(set-face-attribute 'org-block nil :foreground nil :inherit 'fixed-pitch)
|
||||
(set-face-attribute 'org-table nil :inherit 'fixed-pitch)
|
||||
(set-face-attribute 'org-formula nil :inherit 'fixed-pitch)
|
||||
(set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch))
|
||||
(set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch))
|
||||
(set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch))
|
||||
(set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch))
|
||||
(set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch)
|
||||
(set-face-attribute 'bold nil :foreground "#c678dd" :weight 'extrabold)
|
||||
#+end_src
|
||||
|
||||
** Bullets
|
||||
#+begin_src elisp
|
||||
(use-package org-bullets
|
||||
:after org
|
||||
:hook (org-mode . org-bullets-mode)
|
||||
:custom
|
||||
(org-bullets-bullet-list '("⁖" "◉" "○" "●" "○" "●" "○" "●")))
|
||||
#+end_src
|
||||
|
||||
** Capture templates
|
||||
#+begin_src elisp
|
||||
(setq +org-capture-todo-file "agenda/tasks.org")
|
||||
(setq +org-capture-notes-file "notes/personal/index.org")
|
||||
|
||||
(setq org-capture-templates
|
||||
'(
|
||||
("n" "Notes")
|
||||
("nq" "Quikerve notes" entry
|
||||
(file+headline "notes/quikserve/index.org" "Inbox")
|
||||
"* %u %?\n%i\n%a" :prepend t)
|
||||
("np" "Personal notes" entry
|
||||
(file+headline +org-capture-notes-file "Inbox")
|
||||
"* %u %?\n%i\n%a" :prepend t)
|
||||
|
||||
|
||||
("t" "Tasks")
|
||||
("tp" "Personal todo" entry
|
||||
(file+headline +org-capture-todo-file "Inbox")
|
||||
"* TODO %?\n%i\n%a" :prepend t)
|
||||
("tq" "Quikserve todo" entry
|
||||
(file+headline "agenda/quikserve.org" "Inbox")
|
||||
"* TODO %?\n%i\n%a" :prepend t)
|
||||
|
||||
|
||||
("j" "Journal")
|
||||
("jp" "Personal journal" entry
|
||||
(file+olp+datetree "journal/personal.org")
|
||||
"* %U %?\n%i\n%a" :prepend t)
|
||||
("jq" "Quikserve journal" entry
|
||||
(file+olp+datetree "journal/quikserve.org")
|
||||
"* %U %?\n%i\n%a" :prepend t)
|
||||
|
||||
("p" "Templates for projects")
|
||||
("pt" "Project TODO" entry (file+headline project-agenda-file "Inbox")
|
||||
"* TODO %?\n%i\n%a" :prepend t)
|
||||
("pn" "Project notes" entry (file+headline project-notes-file "Quicknotes")
|
||||
"* %U %?\n%i\n%a" :prepend t)
|
||||
("pc" "Project-local changelog" entry
|
||||
(file+headline +org-capture-project-changelog-file "Unreleased")
|
||||
"* %U %?\n%i" :prepend t)))
|
||||
|
||||
(defun project-agenda-file ()
|
||||
(expand-file-name (concat "agenda/projects/" (project-name (project-current)) ".org") org-directory))
|
||||
|
||||
(defun project-notes-file ()
|
||||
(expand-file-name (concat "notes/projects/" (project-name (project-current)) ".org") org-directory))
|
||||
#+end_src
|
||||
|
||||
** Don't show before schedule time
|
||||
Hide items in the TODO list and agenda if they have a scheduled time that has not passed
|
||||
#+begin_src elisp
|
||||
(setq org-agenda-todo-ignore-scheduled 'future)
|
||||
(setq org-agenda-todo-ignore-with-date t)
|
||||
(setq org-agenda-tags-todo-honor-ignore-options t)
|
||||
(setq org-agenda-skip-deadline-prewarning-if-scheduled 'pre-scheduled)
|
||||
#+end_src
|
||||
** Latex
|
||||
#+begin_src elisp
|
||||
(setq org-export-with-author t)
|
||||
(setq org-export-with-date t)
|
||||
(setq org-export-with-toc t)
|
||||
(setq org-export-with-section-numbers nil)
|
||||
(setq org-latex-toc-command "\\tableofcontents \\clearpage")
|
||||
(setq org-latex-tables-centered nil)
|
||||
(setq org-latex-tables-booktabs nil)
|
||||
(setq org-latex-default-class "document")
|
||||
(add-to-list 'org-latex-packages-alist '("" "listings"))
|
||||
(add-to-list 'org-latex-packages-alist '("" "color"))
|
||||
(with-eval-after-load 'ox-latex
|
||||
(add-to-list 'org-latex-classes
|
||||
'("quikserve"
|
||||
"
|
||||
\\documentclass{article}
|
||||
[DEFAULT-PACKAGES]
|
||||
\\include{/home/joe/org/assets/quikserve.tex}
|
||||
[EXTRA]
|
||||
"
|
||||
("\\section{%s}" . "\\section*{%s}")
|
||||
("\\subsection{%s}" . "\\subsection*{%s}")
|
||||
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
|
||||
("\\paragraph{%s}" . "\\paragraph*{%s}")
|
||||
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
|
||||
)
|
||||
)
|
||||
|
||||
#+end_src
|
||||
** Verb
|
||||
#+begin_src elisp
|
||||
(with-eval-after-load 'org
|
||||
(define-key org-mode-map (kbd "C-c C-r") verb-command-map))
|
||||
|
||||
#+end_src
|
||||
* Email
|
||||
#+begin_src elisp
|
||||
(setq mu4e-drafts-folder "/fivesigma/Drafts"
|
||||
mu4e-sent-folder "/fivesigma/Sent"
|
||||
|
||||
mu4e-trash-folder "/fivesigma/Trash"
|
||||
mu4e-refile-folder "/fivesigme/Archive"
|
||||
user-full-name "Joe Bellus"
|
||||
user-mail-address "joe@5sigma.io")
|
||||
|
||||
(setq mu4e-update-interval 120)
|
||||
(setq sendmail-program (executable-find "msmtp")
|
||||
send-mail-function #'smtpmail-send-it
|
||||
smtpmail-stream-type 'starttls
|
||||
message-sendmail-f-is-evil t
|
||||
message-sendmail-extra-arguments '("--read-envelope-from")
|
||||
message-send-mail-function #'message-send-mail-with-sendmail
|
||||
mu4e-bookmarks '(
|
||||
(:name "Inbox" :query "maildir:/fivesigma/Inbox" :key ?i)
|
||||
(:name "Today's messages" :query "date:today..now" :key ?t)
|
||||
(:name "Last 7 days" :query "date:7d..now" :hide-unread t :key ?r)
|
||||
("flag:flagged" "Flagged messages" ?f)))
|
||||
|
||||
(setq mu4e-hide-index-messages t)
|
||||
(setq mu4e-html2text-command 'mu4e-shr2text)
|
||||
(setq shr-color-visible-luminance-min 60)
|
||||
(setq shr-color-visible-distance-min 5)
|
||||
(setq shr-use-colors nil)
|
||||
(setq mu4e-get-mail-command "true")
|
||||
#+end_src
|
||||
|
||||
* Language Server
|
||||
#+begin_src elisp
|
||||
(setq lsp-auto-execute-action nil)
|
||||
#+end_src
|
||||
* Clock table
|
||||
Add a key bind to show a 'clocktable' report in a new buffer
|
||||
#+begin_src elisp
|
||||
(defun kb/show-clocktable ()
|
||||
(interactive)
|
||||
(get-buffer-create "clocktable")
|
||||
(with-current-buffer "clocktable"
|
||||
(org-mode)
|
||||
(erase-buffer)
|
||||
(setq-local org-link-descriptive (not org-link-descriptive))
|
||||
(insert (org-clock-get-clocktable :scope 'agenda :fileskip0 t :stepskip0 t :link t))
|
||||
)
|
||||
(switch-to-buffer "clocktable")
|
||||
)
|
||||
|
||||
(map! :leader
|
||||
:desc "Show clocktable"
|
||||
"o C" #'kb/show-clocktable)
|
||||
#+end_src
|
||||
|
||||
* Tramp
|
||||
Set tramp to default to ssh
|
||||
#+begin_src elisp
|
||||
(setq tramp-default-method "ssh")
|
||||
#+end_src
|
||||
|
||||
* Misc Key binds
|
||||
** Project management
|
||||
#+begin_src elisp
|
||||
(map! :leader
|
||||
:desc "Project terminal"
|
||||
"p v" #'projectile-run-vterm-other-window)
|
||||
|
||||
(map! :leader "p F" nil)
|
||||
(map! :leader "p g" nil)
|
||||
(map! :leader "p t" nil)
|
||||
(map! :leader "p C" nil)
|
||||
(map! :leader "p c" nil)
|
||||
(map! :leader "p s" nil)
|
||||
|
||||
#+end_src
|
||||
|
||||
** Utilities
|
||||
#+begin_src elisp
|
||||
(map! :leader "f c" (lambda () (interactive) (doom-project-browse "~/.config/nix/")))
|
||||
#+end_src
|
||||
|
||||
** Code
|
||||
#+begin_src elisp
|
||||
(map! :leader "c X" #'flymake-show-project-diagnostics)
|
||||
#+end_src
|
||||
|
||||
* Direnv
|
||||
#+begin_src elisp
|
||||
(direnv-mode)
|
||||
(setq direnv-always-show-summary nil)
|
||||
#+end_src
|
||||
|
||||
* Elixir
|
||||
** LSP
|
||||
#+begin_src elisp
|
||||
(with-eval-after-load 'eglot
|
||||
(setf (alist-get 'elixir-mode eglot-server-programs)
|
||||
(if (and (fboundp 'w32-shell-dos-semantics)
|
||||
(w32-shell-dos-semantics))
|
||||
'("language_server.bat")
|
||||
(eglot-alternatives
|
||||
'("language_server.sh" "lexical")))))
|
||||
|
||||
(with-eval-after-load 'eglot
|
||||
(setf (alist-get 'elixir-ts-mode eglot-server-programs)
|
||||
(if (and (fboundp 'w32-shell-dos-semantics)
|
||||
(w32-shell-dos-semantics))
|
||||
'("language_server.bat")
|
||||
(eglot-alternatives
|
||||
'("language_server.sh" "lexical")))))
|
||||
#+end_src
|
||||
|
||||
|
||||
|
||||
* Fix mu4e
|
||||
#+begin_src elisp
|
||||
;;(defalias 'mu4e~compose-remap-faces 'mu4e--compose-remap-faces)
|
||||
;;(defalias 'mu4e~compose-setup-completion 'mu4e--compose-setup-completion)
|
||||
;;(defalias 'mu4e~request-contacts 'mu4e--request-contacts-maybe)
|
||||
;; (mu4e-compat-define-aliases-backwards)
|
||||
;; (mu4e-compat-define-aliases-forwards)
|
||||
#+end_src
|
||||
196
dotfiles/emacs/el/conduct.el
Normal file
196
dotfiles/emacs/el/conduct.el
Normal file
@@ -0,0 +1,196 @@
|
||||
;;; el/conduct.el -*- lexical-binding: t; -*-
|
||||
|
||||
|
||||
(require 'shell)
|
||||
(define-derived-mode conduct-mode shell-mode "Conduct"
|
||||
"Conduct process buffer" :interactive nil
|
||||
(read-only-mode)
|
||||
(evil-define-key 'insert conduct-mode-map "q" 'conduct/buffer-kill)
|
||||
(evil-define-key 'normal conduct-mode-map "r" 'conduct/buffer-restart)
|
||||
(evil-define-key 'normal conduct-mode-map "r" 'conduct/buffer-restart)
|
||||
(evil-define-key 'normal conduct-mode-map "q" 'conduct/buffer-kill))
|
||||
|
||||
(provide 'conduct-mode)
|
||||
|
||||
(defun conduct/buffer-restart () (interactive) (conduct/restart-task current-task))
|
||||
(defun conduct/buffer-kill () (interactive) (conduct/kill-task current-task))
|
||||
|
||||
(defun conduct-run ()
|
||||
"Run a task or task group defined in the current project"
|
||||
(interactive)
|
||||
|
||||
(let* (
|
||||
(config-data (conduct/load-config))
|
||||
(tasks (alist-get 'tasks config-data))
|
||||
(groups (alist-get 'groups config-data))
|
||||
(select-tasks (append (mapcar 'conduct/format-task-name tasks) nil))
|
||||
(select-groups (append (mapcar 'conduct/format-group-name groups) nil))
|
||||
(items (seq-remove #'conduct/is-running (append select-tasks select-groups)))
|
||||
(selected-name (conduct/extract-name-from-selection (completing-read "Task: " items)))
|
||||
(task-names (conduct/get-task-name selected-name config-data))
|
||||
(group-names (conduct/get-group-name selected-name config-data))
|
||||
(names (append task-names group-names)))
|
||||
(dolist (name names)
|
||||
(unless (conduct/get-task-buffer (conduct/get-named-task name config-data))
|
||||
(conduct/run-task (conduct/get-named-task name config-data))))))
|
||||
|
||||
(defun conduct-kill ()
|
||||
"Kill a defined project task"
|
||||
(interactive)
|
||||
|
||||
(let* (
|
||||
(config-data (conduct/load-config))
|
||||
(tasks (alist-get 'tasks config-data))
|
||||
(groups (alist-get 'groups config-data))
|
||||
(select-tasks (seq-filter #'conduct/is-running (append (mapcar 'conduct/format-task-name tasks) nil)))
|
||||
(select-groups (append (mapcar 'conduct/format-group-name groups) nil))
|
||||
(items (append select-tasks select-groups))
|
||||
(selected-name (conduct/extract-name-from-selection (completing-read "Task: " items)))
|
||||
(task-names (conduct/get-task-name selected-name config-data))
|
||||
(group-names (conduct/get-group-name selected-name config-data))
|
||||
(names (append task-names group-names)))
|
||||
|
||||
(dolist (name names)
|
||||
(conduct/kill-task (conduct/get-named-task name config-data)))))
|
||||
|
||||
(defun conduct-show ()
|
||||
"Kill a defined project task"
|
||||
(interactive)
|
||||
|
||||
(let* (
|
||||
(config-data (conduct/load-config))
|
||||
(tasks (alist-get 'tasks config-data))
|
||||
(select-tasks (seq-filter #'conduct/is-running (append (mapcar 'conduct/format-task-name tasks) nil)))
|
||||
(selected-name (conduct/extract-name-from-selection (completing-read "Task: " select-tasks))))
|
||||
|
||||
(switch-to-buffer (format "task-%s" selected-name))))
|
||||
|
||||
(defun conduct-restart ()
|
||||
"Kill a defined project task"
|
||||
(interactive)
|
||||
|
||||
(let* (
|
||||
(config-data (conduct/load-config))
|
||||
(tasks (alist-get 'tasks config-data))
|
||||
(select-tasks (seq-filter #'conduct/is-running (append (mapcar 'conduct/format-task-name tasks) nil)))
|
||||
(selected-name (conduct/extract-name-from-selection (completing-read "Task: " select-tasks)))
|
||||
(task (conduct/get-named-task selected-name config-data)))
|
||||
(conduct/restart-task task)))
|
||||
|
||||
(defun conduct/create-task-path (task)
|
||||
"Generate a new path based on the project root and the path for TASK"
|
||||
(concat
|
||||
(file-name-as-directory (project-root (project-current)))
|
||||
(or (alist-get 'path task) ".")))
|
||||
|
||||
|
||||
(defun conduct/load-config ()
|
||||
"Load the conduct.json config file from the current project root"
|
||||
(let* (
|
||||
(config-file (concat
|
||||
(file-name-as-directory (project-root (project-current)))
|
||||
"conduct.json")))
|
||||
(json-read-file config-file)))
|
||||
|
||||
(defun conduct/get-named-task (name data)
|
||||
"Return the task for NAME. NAME is assumed to be a string"
|
||||
(assoc (intern name) (alist-get 'tasks data)))
|
||||
|
||||
(defun conduct/get-task-name (name data)
|
||||
"Returns the name of the task as a single item list. If it exists in DATA"
|
||||
(when-let (name (assoc (intern name) (alist-get 'tasks data)))
|
||||
(list (symbol-name (car name)))))
|
||||
|
||||
|
||||
(defun conduct/get-group-name (name data)
|
||||
"Returns a list of all tasks for the group named NAME in DATA"
|
||||
(append (cdr (assoc (intern name) (alist-get 'groups data))) nil))
|
||||
|
||||
(defun conduct/run-task (task)
|
||||
"Run the given task definition"
|
||||
(let* (
|
||||
(name (concat "task-" (symbol-name (car task))))
|
||||
(buffer (concat "task-" (symbol-name (car task))))
|
||||
(raw-cmd (alist-get 'command (cdr task)))
|
||||
(task-cmd (concat "cd " (conduct/create-task-path (cdr task)) " && " raw-cmd))
|
||||
(command (list "/bin/sh" "-c" task-cmd))
|
||||
(process (make-process :name name :buffer buffer :command command :sentinel 'conduct/task-sentinal)))
|
||||
(with-current-buffer buffer
|
||||
(conduct-mode)
|
||||
(setq-local current-task task)
|
||||
(set-process-query-on-exit-flag process nil)
|
||||
(set-process-filter process 'comint-output-filter)
|
||||
(display-buffer buffer)
|
||||
buffer)))
|
||||
|
||||
|
||||
|
||||
(defun conduct/get-task-buffer (task)
|
||||
"Get the buffer related to a TASK defintiion"
|
||||
(get-buffer (concat "task-" (symbol-name (car task)))))
|
||||
|
||||
|
||||
(defun conduct/restart-task (task)
|
||||
"Kill the process and buffer for a TASK"
|
||||
(if-let* ((buffer (conduct/get-task-buffer task))
|
||||
(old-process (get-buffer-process buffer))
|
||||
(raw-cmd (alist-get 'command (cdr task)))
|
||||
(task-cmd (concat "cd " (conduct/create-task-path (cdr task)) " && " raw-cmd))
|
||||
(command (list "/bin/sh" "-c" task-cmd))
|
||||
(name (concat "task-" (symbol-name (car task)))))
|
||||
(with-current-buffer buffer
|
||||
(set-process-sentinel old-process (lambda(_process _event) (set-process-filter (make-process :name name :buffer buffer :command command :sentinel 'conduct/task-sentinal) 'comint-output-filter)))
|
||||
(kill-process old-process))
|
||||
(message "Task buffer not found for %s" (alist-get 'name task))))
|
||||
|
||||
(defun conduct/kill-task (task)
|
||||
"Kill the process and buffer for a TASK"
|
||||
(if-let* ((buffer (conduct/get-task-buffer task))
|
||||
(process (get-buffer-process buffer)))
|
||||
(progn
|
||||
(kill-process (get-buffer-process buffer)))
|
||||
(message "Task buffer not found for %s" (alist-get 'name task))))
|
||||
|
||||
(defun conduct/format-group-name (group)
|
||||
"Format the name for GROUP that can be used in the popup selection"
|
||||
(concat
|
||||
(propertize (symbol-name (car group)) 'face 'outline-1)
|
||||
(propertize "|" 'invisible t)
|
||||
" "
|
||||
(propertize (mapconcat #'identity (cdr group) ", ") 'face 'org-archived)))
|
||||
|
||||
(defun conduct/extract-name-from-selection (selection)
|
||||
(car (split-string selection "|")))
|
||||
|
||||
(defun conduct/is-running (task-name)
|
||||
(let* ((process-name (concat "task-" (conduct/extract-name-from-selection task-name))))
|
||||
(member process-name (mapcar #'process-name (process-list)))))
|
||||
|
||||
(defun conduct/format-task-name (task)
|
||||
"Format the name for TASK to be used in the popup selection"
|
||||
(let* (
|
||||
(task-name (symbol-name (car task))))
|
||||
(concat
|
||||
(propertize task-name 'face 'bold)
|
||||
(propertize "|" 'invisible t)
|
||||
(propertize " ")
|
||||
(propertize (alist-get 'command (cdr task)) 'face 'org-archived))))
|
||||
|
||||
(defun conduct/check-signal (sig s)
|
||||
"Check the process signal against a value"
|
||||
(and (> (length s) (length sig)) (equal sig (substring s 0 (length sig)))))
|
||||
|
||||
(defun conduct/task-sentinal (process event)
|
||||
"Monitor the task process and close the buffer if it ends"
|
||||
(cond
|
||||
((conduct/check-signal "finished" event)
|
||||
(message "Task ended: %s" (buffer-name (process-buffer process)))
|
||||
(kill-buffer (process-buffer process)))
|
||||
((conduct/check-signal "exited" event) (kill-buffer (process-buffer process)))
|
||||
((conduct/check-signal "deleted" event) (kill-buffer (process-buffer process)))
|
||||
((conduct/check-signal "failed" event)
|
||||
(message "Task failed: %s" (buffer-name (process-buffer process)))
|
||||
(kill-buffer (process-buffer process)))
|
||||
((conduct/check-signal "killed" event)
|
||||
(kill-buffer (process-buffer process)))
|
||||
(t (message (format "Process: %s had the event '%s'" process event)))))
|
||||
193
dotfiles/emacs/init.el
Normal file
193
dotfiles/emacs/init.el
Normal file
@@ -0,0 +1,193 @@
|
||||
;;; init.el -*- lexical-binding: t; -*- This file controls what Doom modules are enabled and what order they load
|
||||
;; in. Remember to run 'doom sync' after modifying it!
|
||||
|
||||
;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's
|
||||
;; documentation. There you'll find a link to Doom's Module Index where all
|
||||
;; of our modules are listed, including what flags they support.
|
||||
|
||||
;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or
|
||||
;; 'C-c c k' for non-vim users) to view its documentation. This works on
|
||||
;; flags as well (those symbols that start with a plus).
|
||||
;;
|
||||
;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its
|
||||
;; directory (for easy access to its source code).
|
||||
|
||||
(doom! :input
|
||||
;;bidi ; (tfel ot) thgir etirw uoy gnipleh
|
||||
;;chinese
|
||||
;;japanese
|
||||
;;layout ; auie,ctsrnm is the superior home row
|
||||
|
||||
:completion
|
||||
(company +childframe) ; the ultimate code completion backend
|
||||
;;helm ; the *other* search engine for love and life
|
||||
;;ido ; the other *other* search engine...
|
||||
;;ivy ; a search engine for love and life
|
||||
vertico ; the search engine of the future
|
||||
|
||||
:ui
|
||||
;;deft ; notational velocity for Emacs
|
||||
doom ; what makes DOOM look the way it does
|
||||
doom-dashboard ; a nifty splash screen for Emacs
|
||||
;;doom-quit ; DOOM quit-message prompts when you quit Emacs
|
||||
;;(emoji +unicode) ; 🙂
|
||||
hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
|
||||
;;hydra
|
||||
;;indent-guides ; highlighted indent columns
|
||||
ligatures ; ligatures and symbols to make your code pretty again
|
||||
;;minimap ; show a map of the code on the side
|
||||
(modeline) ; snazzy, Atom-inspired modeline, plus API
|
||||
;;nav-flash ; blink cursor line after big motions
|
||||
;;neotree ; a project drawer, like NERDTree for vim
|
||||
ophints ; highlight the region an operation acts on
|
||||
(popup +defaults) ; tame sudden yet inevitable temporary windows
|
||||
;;tabs ; a tab bar for Emacs
|
||||
;;treemacs ; a project drawer, like neotree but cooler
|
||||
;;unicode ; extended unicode support for various languages
|
||||
(vc-gutter +pretty) ; vcs diff in the fringe
|
||||
;;vi-tilde-fringe ; fringe tildes to mark beyond EOB
|
||||
;;window-select ; visually switch windows
|
||||
workspaces ; tab emulation, persistence & separate workspaces
|
||||
;;zen ; distraction-free coding or writing
|
||||
|
||||
:editor
|
||||
(evil +everywhere); come to the dark side, we have cookies
|
||||
file-templates ; auto-snippets for empty files
|
||||
fold ; (nigh) universal code folding
|
||||
(format +onsave) ; automated prettiness
|
||||
;;god ; run Emacs commands without modifier keys
|
||||
;;lispy ; vim for lisp, for people who don't like vim
|
||||
;;multiple-cursors ; editing in many places at once
|
||||
;;objed ; text object editing for the innocent
|
||||
parinfer ; turn lisp into python, sort of
|
||||
;;rotate-text ; cycle region at point between text candidates
|
||||
snippets ; my elves. They type so I don't have to
|
||||
;;word-wrap ; soft wrapping with language-aware indent
|
||||
|
||||
:emacs
|
||||
(dired +icons) ; making dired pretty [functional]
|
||||
electric ; smarter, keyword-based electric-indent
|
||||
;;ibuffer ; interactive buffer management
|
||||
undo ; persistent, smarter undo for your inevitable mistakes
|
||||
vc ; version-control and Emacs, sitting in a tree
|
||||
|
||||
:term
|
||||
;;eshell ; the elisp shell that works everywhere
|
||||
;;shell ; simple shell REPL for Emacs
|
||||
;;term ; basic terminal emulator for Emacs
|
||||
vterm ; the best terminal emulation in Emacs
|
||||
|
||||
:checkers
|
||||
syntax ; tasing you for every semicolon you forget
|
||||
(spell +flyspell) ; tasing you for misspelling mispelling
|
||||
grammar ; tasing grammar mistake every you make
|
||||
|
||||
:tools
|
||||
;;ansible
|
||||
;;biblio ; Writes a PhD for you (citation needed)
|
||||
;;collab ; buffers with friends
|
||||
;;debugger ; FIXME stepping through code, to help you add bugs
|
||||
;;direnv
|
||||
docker
|
||||
;;editorconfig ; let someone else argue about tabs vs spaces
|
||||
;;ein ; tame Jupyter notebooks with emacs
|
||||
(eval +overlay) ; run code, run (also, repls)
|
||||
;;gist ; interacting with github gists
|
||||
lookup ; navigate your code and its documentation
|
||||
(lsp +eglot) ; M-x vscode
|
||||
(magit +forge) ; a git porcelain for Emacs
|
||||
;;make ; run make tasks from Emacs
|
||||
;;pass ; password manager for nerds
|
||||
pdf ; pdf enhancements
|
||||
;;prodigy ; FIXME managing external services & code builders
|
||||
;; rgb ; creating color strings
|
||||
;;taskrunner ; taskrunner for all your projects
|
||||
;;terraform ; infrastructure as code
|
||||
;;tmux ; an API for interacting with tmux
|
||||
tree-sitter ; syntax and parsing, sitting in a tree...
|
||||
;;upload ; map local to remote projects via ssh/ftp
|
||||
|
||||
:os
|
||||
(:if IS-MAC macos) ; improve compatibility with macOS
|
||||
;;tty ; improve the terminal Emacs experience
|
||||
|
||||
:lang
|
||||
;;agda ; types of types of types of types...
|
||||
;;beancount ; mind the GAAP
|
||||
(cc +lsp) ; C > C++ == 1
|
||||
;;clojure ; java with a lisp
|
||||
;;common-lisp ; if you've seen one lisp, you've seen them all
|
||||
;;coq ; proofs-as-programs
|
||||
;;crystal ; ruby at the speed of c
|
||||
;;csharp ; unity, .NET, and mono shenanigans
|
||||
;;data ; config/data formats
|
||||
;;(dart +flutter) ; paint ui and not much else
|
||||
;;dhall
|
||||
(elixir +lsp +tree-sitter) ; erlang done right
|
||||
;;elm ; care for a cup of TEA?
|
||||
emacs-lisp ; drown in parentheses
|
||||
;;erlang ; an elegant language for a more civilized age
|
||||
;;ess ; emacs speaks statistics
|
||||
;;factor
|
||||
;;faust ; dsp, but you get to keep your soul
|
||||
;;fortran ; in FORTRAN, GOD is REAL (unless declared INTEGER)
|
||||
;;fsharp ; ML stands for Microsoft's Language
|
||||
;;fstar ; (dependent) types and (monadic) effects and Z3
|
||||
;;gdscript ; the language you waited for
|
||||
;;(go +lsp) ; the hipster dialect
|
||||
;;(graphql +lsp) ; Give queries a REST
|
||||
;;(haskell +lsp) ; a language that's lazier than I am
|
||||
;;hy ; readability of scheme w/ speed of python
|
||||
;;idris ; a language you can depend on
|
||||
(json +lsp +tree-sitter) ; At least it ain't XML
|
||||
;;(java +lsp) ; the poster child for carpal tunnel syndrome
|
||||
javascript ; all(hope(abandon(ye(who(enter(here))))))
|
||||
;;julia ; a better, faster MATLAB
|
||||
;;kotlin ; a better, slicker Java(Script)
|
||||
latex ; writing papers in Emacs has never been so fun
|
||||
;;lean ; for folks with too much to prove
|
||||
ledger ; be audit you can be
|
||||
lua ; one-based indices? one-based indices
|
||||
markdown ; writing docs for people to ignore
|
||||
;;nim ; python + lisp at the speed of c
|
||||
(nix +lsp) ; I hereby declare "nix geht mehr!"
|
||||
;;ocaml ; an objective camel
|
||||
(org +present +pandoc +roam2) ; organize your plain life in plain text
|
||||
;;php ; perl's insecure younger brother
|
||||
;;plantuml ; diagrams for confusing people more
|
||||
;;purescript ; javascript, but functional
|
||||
(python +lsp) ; beautiful is better than ugly
|
||||
;;qt ; the 'cutest' gui framework ever
|
||||
;;racket ; a DSL for DSLs
|
||||
;;raku ; the artist formerly known as perl6
|
||||
rest ; Emacs as a REST client
|
||||
;;rst ; ReST in peace
|
||||
;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
|
||||
(rust +lsp +tree-sitter) ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
|
||||
;;scala ; java, but good
|
||||
;;(scheme +guile) ; a fully conniving family of lisps
|
||||
sh ; she sells {ba,z,fi}sh shells on the C xor
|
||||
;;sml
|
||||
;;solidity ; do you need a blockchain? No.
|
||||
;;swift ; who asked for emoji variables?
|
||||
;;terra ; Earth and Moon in alignment for performance.
|
||||
(web +lsp +tree-sitter) ; the tubes
|
||||
yaml ; JSON, but readable
|
||||
;;zig ; C, but simpler
|
||||
|
||||
:email
|
||||
(mu4e +org)
|
||||
;;notmuch
|
||||
;;(wanderlust +gmail)
|
||||
|
||||
:app
|
||||
;;calendar
|
||||
;;emms
|
||||
;;everywhere ; *leave* Emacs!? You must be joking
|
||||
;;irc ; how neckbeards socialize
|
||||
;;(rss +org) ; emacs as an RSS reader
|
||||
;;twitter ; twitter client https://twitter.com/vnought
|
||||
|
||||
:config
|
||||
literate
|
||||
(default +bindings +smartparens))
|
||||
68
dotfiles/emacs/packages.el
Normal file
68
dotfiles/emacs/packages.el
Normal file
@@ -0,0 +1,68 @@
|
||||
;; -*- no-byte-compile: t; -*-
|
||||
;;; $DOOMDIR/packages.el
|
||||
|
||||
;; To install a package with Doom you must declare them here and run 'doom sync'
|
||||
;; on the command line, then restart Emacs for the changes to take effect -- or
|
||||
;; use 'M-x doom/reload'.
|
||||
|
||||
|
||||
(package! org-ql)
|
||||
(package! org-bullets)
|
||||
(package! org-present)
|
||||
(package! visual-fill-column)
|
||||
(package! direnv)
|
||||
;(package! doom-nano-modeline
|
||||
; :recipe (:repo "ronisbr/doom-nano-modeline" :host github))
|
||||
(package! yuck-mode)
|
||||
(package! org-ql)
|
||||
|
||||
(package! verb)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror:
|
||||
;; (package! some-package)
|
||||
|
||||
;; To install a package directly from a remote git repo, you must specify a
|
||||
;; `:recipe'. You'll find documentation on what `:recipe' accepts here:
|
||||
;; https://github.com/radian-software/straight.el#the-recipe-format
|
||||
;; (package! another-package
|
||||
;; :recipe (:host github :repo "username/repo"))
|
||||
|
||||
;; If the package you are trying to install does not contain a PACKAGENAME.el
|
||||
;; file, or is located in a subdirectory of the repo, you'll need to s)kpecify
|
||||
;; `:files' in the `:recipe':
|
||||
;; (package! this-package
|
||||
;; :recipe (:host github :repo "username/repo"
|
||||
;; :files ("some-file.el" "src/lisp/*.el")))
|
||||
|
||||
;; If you'd like to disable a package included with Doom, you can do so here
|
||||
;; with the `:disable' property:
|
||||
;; (package! builtin-package :disable t)
|
||||
|
||||
;; You can override the recipe of a built in package without having to specify
|
||||
;; all the properties for `:recipe'. These will inherit the rest of its recipe
|
||||
;; from Doom or MELPA/ELPA/Emacsmirror:
|
||||
;; (package! builtin-package :recipe (:nonrecursive t))
|
||||
;; (package! builtin-package-2 :recipe (:repo "myfork/package"))
|
||||
|
||||
;; Specify a `:branch' to install a package from a particular branch or tag.
|
||||
;; This is required for some packages whose default branch isn't 'master' (which
|
||||
;; our package manager can't deal with; see radian-software/straight.el#279)
|
||||
;; (package! builtin-package :recipe (:branch "develop"))
|
||||
|
||||
;; Use `:pin' to specify a particular commit to install.
|
||||
;; (package! builtin-package :pin "1a2b3c4d5e")
|
||||
|
||||
|
||||
;; Doom's packages are pinned to a specific commit and updated from release to
|
||||
;; release. The `unpin!' macro allows you to unpin single packages...
|
||||
;; (unpin! pinned-package)
|
||||
;; ...or multiple packages
|
||||
;; (unpin! pinned-package another-pinned-package)
|
||||
;; ...Or *all* packages (NOT RECOMMENDED; will likely break things)
|
||||
;; (unpin! t)
|
||||
Reference in New Issue
Block a user