aboutsummaryrefslogblamecommitdiffstats
path: root/doom.d/config.el
blob: aaabf5267816c2a69c8ef6e51cd9f75d4df82937 (plain) (tree)



















                                                                                

                                                                              














                                                                               
                                    

                             


                                                                             
                                          



                                                                                


                       








                                                                                           









                                                     
                                          

                                                                        
 








                                                        


                     
                                           
                                                                                                                                                 



































                                                                               
 



                                                    
 











                                          
                                                                   








                                                                       
                                                                                                                                     
                                                                                
                                                                                             

                                                                       
                                                                             



                                    
                                                                                                                                     
                                                                                
                                                                                             

                                                                       
                                                                             






























































                                                                                                                    

                                                                                     


                                                                                    
                                         












                                                                                                

                                                                                    






                                                                                         
                                         


                                                                                               
                             
                                                                                              
                                  











                                                                                                       
                                


                                                               





                                           

                                        







                                          










                                                             
 


                                    
 

                                                           
 
                         
                                                                                   
                                                                                             

                   






                                                                
                                                           

                                                                        
 


                                                           






                                                              



                                
 




                                                                

   

                          































                                                                               
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-

;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file!


;; Some functionality uses this to identify you, e.g. GPG configuration, email
;; clients, file templates and snippets. It is optional.
(setq user-full-name "Matthew Lemon"
      user-mail-address "matt@matthewlemon.com")

;; Doom exposes five (optional) variables for controlling fonts in Doom:
;;
;; - `doom-font' -- the primary font to use
;; - `doom-variable-pitch-font' -- a non-monospace font (where applicable)
;; - `doom-big-font' -- used for `doom-big-font-mode'; use this for
;;   presentations or streaming.
;; - `doom-unicode-font' -- for unicode glyphs
;; - `doom-serif-font' -- for the `fixed-pitch-serif' face
;;
(setq doom-font (font-spec :family "Iosevka Regular" :size 16)
      doom-variable-pitch-font (font-spec :family "Iosevka Regular" :size 16))
;;
;; See 'C-h v doom-font' for documentation and more examples of what they
;; accept. For example:
;;
;;(setq doom-font (font-spec :family "Fira Code" :size 12 :weight 'semi-light)
;;      doom-variable-pitch-font (font-spec :family "Fira Sans" :size 13))
;;
;; If you or Emacs can't find your font, use 'M-x describe-font' to look them
;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to
;; refresh your font settings. If Emacs still can't find your font, it likely
;; wasn't installed correctly. Font issues are rarely Doom issues!

;; There are two ways to load a theme. Both assume the theme is installed and
;; available. You can either set `doom-theme' or manually load a theme with the
;; `load-theme' function. This is the default:
;; (setq doom-theme 'doom-laserwave)

(load-theme 'gruber-darker t)

;; This determines the style of line numbers in effect. If set to `nil', line
;; numbers are disabled. For relative line numbers, set this to `relative'.
(setq display-line-numbers-type `relative)

;; 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!
;;
;; --------------------
;; Some of my own stuff
;; --------------------
;; Open cider repl in vertical window
;; https://stackoverflow.com/questions/65992013/doom-emacs-move-cider-repl-windows-vertical
(after! cider
  (set-popup-rules!
   '(("^\\*cider-repl"
      :side right
      :width 100
      :quit nil
      :ttl nil))));
;;
;;Switch to scratch buffer
(defun mrl/switch-to-scratch ()
  (interactive)
  (switch-to-buffer "*scratch*"))
;;
;; --------------------
;; Custom keybindings
;; --------------------
(global-set-key (kbd "C-c s") 'mrl/switch-to-scratch)
(global-set-key (kbd "C-c r") 'counsel-rg)
(global-set-key (kbd "C-c f") 'counsel-fzf)
(global-unset-key (kbd "C-x C-b")) ;; we don't want the old buffer list!

;; org-roam
(after! org-roam
  (setq org-roam-directory ("~/org-roam"))
  (org-roam-db-autosync-mode)
  (setq org-roam-node-display-template
      (concat "${title:*} "
              (propertize "${tags:10}" 'face 'org-tag)))
  )

;; Basic agenda stuff

(after! org
  (setq org-modules '(org-habit ol-bibtex))
  (evil-set-initial-state 'org-capture-mode 'insert) ;; from https://www.reddit.com/r/emacs/comments/hzkyrb/org_capture_evil_go_into_insert_mode/
  (setq org-directory "~/org/")
  (setq org-startup-indented nil)
  (setq org-hide-leading-stars nil)
  (setq org-deadline-warning-days 4)
  (setq org-clock-persist 'history)
  (org-clock-persistence-insinuate)
  (setq org-agenda-span 'day)
  (setq org-agenda-start-day "today")
  (setq org-directory "~/org")
  (setq org-agenda-files (quote ("~/org/home.org"
                                 "~/org/projects.org"
                                 "~/org/refile.org"
                                 "~/org/journal.org"
                                 "~/org/mod.org"
                                 "~/org/notes.org"
                                 "~/org/habits.org")))
  (setq org-default-notes-file (concat org-directory "/notes.org"))
  (setq org-agenda-window-setup 'current-window)
  (setq org-agenda-start-with-log-mode t)
  (setq org-M-RET-may-split-line '(default . nil))
  (setq org-enforce-todo-dependencies t)
  (setq org-log-done 'time)
  (setq org-log-done-with-time 'note)
  (setq diary-file "~/org/diary")
  (setq org-agenda-include-diary nil)
  (setq org-agenda-diary-file "~/org/calendar/cal.org")
  (setq org-agenda-show-future-repeats t)
  (setq org-agenda-skip-deadline-if-done t)
  (setq org-agenda-skip-scheduled-if-done t)
  (setq org-reverse-note-order t)
  (setq +org-habit-min-width 45)
  (setq org-agenda-sort-notime-is-late nil)
  (setq org-columns-default-format "%50ITEM(Task) %10CLOCKSUM %25TIMESTAMP_IA")
  (setq org-archive-location "~/org/archive.org::* From %s")
  (setq org-refile-targets (quote ((nil :maxlevel . 9)
                                   (org-agenda-files :maxlevel . 9))))

  ;; set for sunrise, sunset in Berwick
  (setq calendar-latitude 55.77)
  (setq calendar-longitude -2.01)
  (setq calendar-location-name "Berwick-upon-Tweed")

  ;; Basic org keybindings
  (global-set-key "\C-cl" 'org-store-link)
  (global-set-key "\C-ca" 'org-agenda)
  (global-set-key "\C-cb" 'org-iswitchb)
  (global-set-key "\C-cc" 'org-capture)
  ;;
  ;; Agenda dispatcher
  (setq org-agenda-custom-commands
        '(
          ("D" "Dashboard"
           (
            (tags "current"
                  ((org-agenda-overriding-header "Current Ideas")))
            (tags-todo "PRIORITY=\"A\""
                       ((org-agenda-overriding-header "Urgent Tasks")))
            (agenda "")
            )
           )
          ("w" . "Work")
          ("wt" "Agenda + Work TODO"
           (
            (agenda "")
            (tags-todo "CATEGORY=\"MOD\"&TODO=\"TODO\"-SCHEDULED>=\"<today>\"|CATEGORY=\"Work\"&TODO=\"TODO\"-SCHEDULED>=\"<today>\""
                       ((org-agenda-overriding-header "Work TODO UNSCHEDULED")))
            (tags-todo "CATEGORY=\"MOD\"&TODO=\"WAITING\"|CATEGORY=\"Work\"&TODO=\"WAITING\""
                       ((org-agenda-overriding-header "Work WAITING")))
            )
           ((org-agenda-category-filter-preset '("+MOD" "+Work" "+Meeting")))
           )
          ("wn" "Agenda + Work NEXT"
           (
            (agenda)
            (tags-todo "CATEGORY=\"MOD\"&TODO=\"NEXT\"-SCHEDULED>=\"<today>\"|CATEGORY=\"Work\"&TODO=\"NEXT\"-SCHEDULED>=\"<today>\""
                       ((org-agenda-overriding-header "Work NEXT UNSCHEDULED")))
            (tags-todo "CATEGORY=\"MOD\"&TODO=\"WAITING\"|CATEGORY=\"Work\"&TODO=\"WAITING\""
                       ((org-agenda-overriding-header "Work WAITING")))
            )
           ((org-agenda-category-filter-preset '("+MOD" "+Work" "+Meeting")))
           )
          ("wp" "Work Project NEXT"
           (
            (agenda)
            (tags-todo "+CATEGORY=\"MOD\"TODO=\"NEXT\"+CATEGORY=\"Project\""
                       ((org-agenda-overriding-header "Work Project NEXT actions")))
            ))
          ("h" . "Home")
          ("hh" "Agenda + Home TODO"
           (
            (agenda)
            (tags-todo "+CATEGORY=\"home\"-SCHEDULED>=\"<today>\"-TODO=\"WAITING\"-TODO=\"DOING\""
                       ((org-agenda-overriding-header "Home TODO UNSCHEDULED")
                        (org-agenda-sorting-strategy '(deadline-down scheduled-down priority-down))))
            (tags-todo "+CATEGORY=\"home\"+TODO=\"WAITING\""
                       ((org-agenda-overriding-header "Home WAITING")))
            (tags-todo "+CATEGORY=\"home\"+TODO=\"DOING\"" ((org-agenda-overriding-header "Home in progress")))
            )
           ((org-agenda-category-filter-preset '("+home")))
           )
          ("hn" "Agenda + Home NEXT"
           (
            (agenda "")
            (tags-todo "+CATEGORY=\"home\"+TODO=\"NEXT\"-SCHEDULED>=\"<today>\""
                       ((org-agenda-overriding-header "Home NEXT UNSCHEDULED")
                        (org-agenda-sorting-strategy '(deadline-down scheduled-down priority-down))))
            (tags-todo "+CATEGORY=\"home\"+TODO=\"DOING\""
                       ((org-agenda-overriding-header "Home in progress")))
            )
           ((org-agenda-category-filter-preset '("+home")))
           )
          ("n" "Agenda + All NEXT"
           (
            (agenda "")
            (todo "NEXT")))
          ("t" "Agenda + All TODO"
           (
            (agenda "")
            (alltodo "")))
          ("W" "Agenda + All WAITING"
           (
            (agenda "")
            (todo "WAITING")))
          ("i" tags "idea")
          ("R" tags-todo "REFILE"
           ((org-agenda-overriding-header "Review these pages captured from the web")))
          ))

  ;; org capture templates
  (setq org-capture-templates
        (quote (("h" "Home Tasks & Notes")
                ;; ("w" "Protocol Capture" entry (file+headline "~/org/refile.org" "Web Capture")
                ;;  "* %^{Title or Comment}\nDescription: %:description\nSource: %:link\n%:initial\nCaptured: %U\n")
                ("x" "Protocol Capture" entry (file+headline "~/org/refile.org" "Web Capture")
                 "* TODO Review %:description\nSource: %:link\n%:initial\nCaptured: %U\n" :immediate-finish t)
                ("w" "Protocol Capture" entry (file+headline "~/org/refile.org" "Web Capture")
                 "* %:description\nSource: %:link\n%:initial\nCaptured: %U\n")
                ("ht" "Home TODO" entry (file+headline "~/org/home.org" "Tasks")
                 "** TODO %?\nEntered on %U\n"
                 :prepend t)
                ("hn" "Home NEXT" entry (file+headline "~/org/home.org" "Tasks")
                 "** NEXT %?\nEntered on %U\n"
                 :prepend t)
                ("hS" "Home Someday" entry (file+headline "~/org/home.org" "Someday")
                 "** SOMEDAY %?\nEntered on %U\n")
                ("hN" "Home Note" entry (file+headline "~/org/home.org" "Notes")
                 "** %?\nEntered on %U\n")
                ("hj" "Journal" entry (file+olp+datetree "~/org/home.org" "Journal")
                 "* %?\nEntered on %U\n")
                ("hi" "Home Idea" entry (file+headline "~/org/home.org" "Notes")
                 "** %? :idea:\nEntered on %U\n")
                ("hc" "Home Calendar - Single" entry (file+headline "~/org/home.org" "Calendar")
                 "* %?\n%^T")
                ("hb" "Home Calendar - Block" entry (file+headline "~/org/home.org" "Calendar")
                 "* %?\n%^t--%^t")
                ("w" "Work Tasks & Notes")
                ("wt" "Work TODO" entry (file+headline "~/org/mod.org" "Tasks")
                 "** TODO %?\nEntered on %U\n"
                 :prepend t)
                ("wn" "Work NEXT" entry (file+headline "~/org/mod.org" "Tasks")
                 "** NEXT %?\nEntered on %U\n"
                 :prepend t)
                ("wS" "Work Someday" entry (file+headline "~/org/mod.org" "Someday")
                 "** SOMEDAY %?\nEntered on %U\n")
                ("wN" "Note" entry (file+headline "~/org/mod.org" "Notes")
                 "* %?\nEntered on %U\n")
                ("wc" "Note from Clipboard" entry (file+headline "~/org/mod.org" "Notes")
                 "* %?\n\t\n%c")
                ("wr" "Note from Region" entry (file+headline "~/org/mod.org" "Notes")
                 "* %?\n\t\n%i")
                ("wj" "Journal" entry (file+olp+datetree "~/org/mod.org" "Journal")
                 "* %?\nEntered on %U\n")
                ("wd" "Retrospective Tasks" entry (file+headline "~/org/mod.org" "Tasks")
                 "* DONE %?\nCLOSED: %U")
                ("ws" "Work Calendar - Single" entry (file+headline "~/org/mod.org" "Calendar")
                 "* %?\n%^T")
                ("wb" "Work Calendar - Block" entry (file+headline "~/org/mod.org" "Calendar")
                 "* %?\n%^t--%^t")
                ("wp" "Work Calendar - Trip" entry (file+headline "~/org/mod.org" "Work Trips")
                 "* %?\n%^t--%^t")
                ("wm" "Work Calendar - Meeting" entry (file+headline "~/org/mod.org" "Meetings")
                 "* %?\n:PROPERTIES:\n:CATEGORY: Meeting\n:END:\n%^T")
                ("e" "Emacs Tip")
                ("et" "Emacs Tip" entry (file+headline "~/org/emacs-tips.org" "Emacs Tips")
                 "* %?\n\t%a")
                ("er" "Emacs Tip from Region" entry (file+headline "~/org/emacs-tips.org" "Emacs Tips")
                 "* %?\n\t%i")
                )))
  ;; org tags
  (setq org-tag-alist '(
                        ;; Depth
                        ("@immersive" . ?i) ;; "Deep"
                        ("@process" . ?p)   ;; "Shallow"
                        ("@offdesk" . ?o)   ;; "Away from desk"
                        ;; Type
                        ("brainstorm" . ?b)
                        ("idea" . ?d)
                        ;; Context
                        ("@work" . ?w)
                        ("@home" . ?h)
                        ("@errand" . ?e)
                        ("@emacs" . ?E)
                        ;; Energy
                        ("Challenge" . ?1)
                        ("Average" . ?2)
                        ("Easy" . ?3)
                        ;; Misc
                        ("Maybe" . ?m)
                        ))

  ;; org agenda should be full screen
  (defun open-agenda ()
    "Open the org-agenda."
    (interactive)
    (let ((agenda "*Org Agenda*"))
      (if (equal (get-buffer agenda) nil)
          (org-agenda-list)
        (unless (equal (buffer-name (current-buffer)) agenda)
          (switch-to-buffer agenda))
        (org-agenda-redo t)
        (beginning-of-buffer))))

  ;; Defining stuck projects
  (setq org-stuck-projects
        '("/+PROJ" ("NEXT") nil ""))

  ;; Put state transition logs into a drawer called LOGBOOK
  (setq org-log-into-drawer t)

  (setq org-todo-keywords
        (quote ((sequence "TODO(t)" "NEXT(n)" "DOING(D)" "PROJ(p)"  "|" "DONE(d!)")
                (sequence "WAITING(w@/!)" "SOMEDAY(s@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)")
                )))

  (setq org-todo-keyword-faces
        (quote (("TODO" :foreground "red" :weight bold)
                ("NEXT" :foreground "cyan" :weight bold)
                ("PROJ" :foreground "pink" :weight bold)
                ("DOING" :foreground "orchid" :weight bold)
                ("DONE" :foreground "forest green" :weight bold)
                ("WAITING" :foreground "orange" :weight bold)
                ("SOMEDAY" :foreground "blue" :weight bold)
                ("HOLD" :foreground "magenta" :weight bold)
                ("CANCELLED" :foreground "forest green" :weight bold))))

  ;; tag stuff automatically dependent on a change of state
  (setq org-todo-state-tags-triggers
        (quote (("CANCELLED" ("CANCELLED" . t))
                ("WAITING" ("WAITING" . t))
                ("HOLD" ("WAITING") ("HOLD" . t))
                (done ("WAITING") ("HOLD"))
                ("TODO" ("WAITING") ("CANCELLED") ("HOLD"))
                ("NEXT" ("WAITING") ("CANCELLED") ("HOLD"))
                ("DONE" ("WAITING") ("CANCELLED") ("HOLD")))))

  ;; Get more priority options
  (setq org-highest-priority ?A)
  (setq org-default-priority ?C)
  (setq org-lowest-priority ?E)

  (setq org-priority-faces
        '((?A . (:foreground "#CC0000" :background "#FFE3E3"))
          (?B . (:foreground "#64992C" :background "#EBF4DD"))
          (?C . (:foreground "#64992C" :background "#FFFFFF"))))
  (setq org-ellipsis "...")
  )

(after! deft
  (setq deft-recursive t))

;; Whenever you reconfigure a package, make sure to wrap your config in an
;; `after!' block, otherwise Doom's defaults may override your settings. E.g.
;;
;;   (after! PACKAGE
;;     (setq x y))
;;
;; The exceptions to this rule:
;;
;;   - Setting file/directory variables (like `org-directory')
;;   - Setting variables which explicitly tell you to set them before their
;;     package is loaded (see 'C-h v VARIABLE' to look up their documentation).
;;   - Setting doom variables (which start with 'doom-' or '+').
;;
;; Here are some additional functions/macros that will help you configure Doom.
;;
;; - `load!' for loading external *.el files relative to this one
;; - `use-package!' for configuring packages
;; - `after!' for running code after a package has loaded
;; - `add-load-path!' for adding directories to the `load-path', relative to
;;   this file. Emacs searches the `load-path' when you load packages with
;;   `require' or `use-package'.
;; - `map!' for binding new keys
;;
;; To get information about any of these functions/macros, move the cursor over
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k').
;; This will open documentation for it, including demos of how they are used.
;; Alternatively, use `C-h o' to look up a symbol (functions, variables, faces,
;; etc).
;;
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
;; they are implemented.