nix/dotfiles/emacs/config.org

12 KiB

My Info

Basic info for some templates

(setq user-full-name "Joe Bellus"
      user-mail-address "joe@5sigma.io")

Appearance

Fonts

Setup default fonts and faces.

(setq doom-font (font-spec :family "JetBrains Mono" :size 16 :weight 'semi-bold)
      doom-variable-pitch-font (font-spec :family "Iosevka" :size 16 :weight 'light)
      doom-big-font (font-spec :family "Iosevka" :size 22. :weight 'semi-bold)
      doom-themes-enable-bold t
      doom-themes-enable-italic t
      )

Theme

(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))

Translucency

Setup some translucency to make things look nice.

(set-frame-parameter (selected-frame) 'alpha '(95 95))
(add-to-list 'default-frame-alist '(alpha 95 95))

Startup

Load custom scripts

(add-to-list 'load-path "~/.config/doom/el")

Startup buffer

(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)

Editor

Line numbering

Enable basic line numbering

(setq display-line-numbers-type t)

Quit Confirmation

Don't prompt to quit

(setq confirm-kill-emacs nil)

Org Mode

General settings

(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)

Visual fill column

(setq visual-fill-column-width 110
      visual-fill-column-center-text t)

Org presentation

(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)

Setup org header faces

(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)

Bullets

(use-package org-bullets
  :after org
  :hook (org-mode . org-bullets-mode)
  :custom
  (org-bullets-bullet-list '("⁖" "◉" "○" "●" "○" "●" "○" "●")))

Capture templates

(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))

Don't show before schedule time

Hide items in the TODO list and agenda if they have a scheduled time that has not passed

(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)

Latex

(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}"))
                        )
        )

Email

(set-email-account! "fivesigma"
                    '((mu4e-sent-folder       . "/fivesigma/Sent")
                      (mu4e-drafts-folder     . "/fivesigma/Drafts")
                      (mu4e-trash-folder      . "/fivesigma/Trash")
                      (mu4e-refile-folder     . "/fivesigm e/Archive")
                      (smtpmail-smtp-user     . "joe@5sigma.io")
                      (mu4e-compose-signature . "\n\n\nThanks,\nJoe Bellus\n\n"))
                    )

(after! mu4e
  (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))

(setq 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")

Language Server

(setq lsp-auto-execute-action nil)

#+end_src

Clock table

Add a key bind to show a 'clocktable' report in a new buffer

(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)

Tramp

Set tramp to default to ssh

(setq tramp-default-method "ssh")

Conduct

(load "conduct.el" t t)
(map! :leader
      :desc "Conduct"
      "o c")
(map! :leader
      :desc "Conduct run"
      "o c r" #'conduct-run)
(map! :leader
      :desc "Conduct kill"
      "o c k" #'conduct-kill)
(map! :leader
      :desc "Conduct show"
      "o c b" #'conduct-show)

Misc Key binds

Project management

(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)

Utilities

(map! :leader "f c" (lambda () (interactive) (doom-project-browse "~/.config/nix/")))

Code

(map! :leader "c X" #'flymake-show-project-diagnostics)

Direnv

(direnv-mode)
(setq direnv-always-show-summary nil)

Elixir

LSP

;;(use-package lsp-mode
;;   :commands lsp
;;   :ensure t
;;   :diminish lsp-mode
;;   :hook
;;   (elixir-mode . lsp)
;;   :init
;;    (setq lsp-elixir-suggest-specs nil)
;;   (add-to-list 'auto-mode-alist '("\\.heex\\'" . elixir-mode))
;;   (add-to-list 'exec-path "~/.local/share/elixir-ls"))