~modules/*.org -> config/*.org
Moved all org files from modules, which should really just hold modules, to another location (config). Cleaner and easier to use
This commit is contained in:
472
doom.d/config/config.org
Normal file
472
doom.d/config/config.org
Normal file
@@ -0,0 +1,472 @@
|
||||
#+TITLE: Oreodave's Emacs configuration
|
||||
#+AUTHOR: Oreodave
|
||||
#+DESCRIPTION: My Doom Emacs configuration!
|
||||
|
||||
* Preclude
|
||||
This is my [[https://github.com/hlissner/doom-emacs][Doom Emacs]] configuration, which I try to use for as many things as
|
||||
possible. It is currently my main editor overall, literally overtaking my life.
|
||||
* Variables and Bootstrapping other modules
|
||||
Bootstrapping literate module and setting up basic variables.
|
||||
** Bootstrap literate
|
||||
Load the literate.el file to start parsing.
|
||||
#+BEGIN_SRC elisp
|
||||
(load (expand-file-name (concat doom-private-dir "bin/literate.el")))
|
||||
#+END_SRC
|
||||
** Doom Variables
|
||||
#+BEGIN_SRC elisp
|
||||
(after! core-keybinds
|
||||
(setq doom-localleader-key ",")
|
||||
(setq doom-theme 'doom-molokai)
|
||||
(setq doom-font (font-spec :family "Hack" :size 17)))
|
||||
#+END_SRC
|
||||
- Set the doom localleader to "," because it's faster
|
||||
- Using the font [[https://sourcefoundry.org/hack/][Hack]] with Fira code ligatures
|
||||
** Other variables
|
||||
#+BEGIN_SRC elisp
|
||||
(setq completion-ignore-case t)
|
||||
(setq truncate-lines t)
|
||||
(setq display-line-numbers-type nil)
|
||||
(setq bookmark-default-file (expand-file-name (concat doom-private-dir "/bookmarks")))
|
||||
(setq-default frame-title-format '("%b - εmacs"))
|
||||
(cl-pushnew '("Libgen" "http://gen.lib.rus.ec/search.php?req=%s") +lookup-provider-url-alist :key #'car :test 'string=)
|
||||
#+END_SRC
|
||||
|
||||
Some quality of life things and others that I couldn't really put in one category
|
||||
- Displaying line numbers isn't usually something I do. If need be, I'll just
|
||||
open them with *<SPC>tl*.
|
||||
- Set org directory
|
||||
- Add libgen to search providers
|
||||
* Package Config
|
||||
** Projectile
|
||||
Really simple, just want to set projectile-tags-command when projectile has
|
||||
loaded, and easily add new ignores if necessary. Add a new ignore to the tags-alist.
|
||||
|
||||
Add a few items to the projectile-root-files list
|
||||
#+BEGIN_SRC elisp
|
||||
(after! projectile
|
||||
(setq oreodave-tags-alist '("Makefile" "node_modules" "bin" "dist" "obj" "'*.json'"))
|
||||
(defun oreodave/config/construct-tags ()
|
||||
(reduce (lambda (x y) (concat x y)) (mapcar (lambda (i) (concat " --exclude=" i)) oreodave-tags-alist)
|
||||
:initial-value "exctags -Re ")
|
||||
)
|
||||
(setq projectile-tags-command (oreodave/config/construct-tags))
|
||||
(cl-pushnew "CMakeLists.txt" projectile-project-root-files :test #'string=)
|
||||
(cl-pushnew "README.org" projectile-project-root-files :test #'string=)
|
||||
(cl-pushnew "doc.org" projectile-project-root-files :test #'string=))
|
||||
#+END_SRC
|
||||
** DAP
|
||||
A keybind and a routine
|
||||
|
||||
- Routine sets up the panes that I like to use, instead of having to M-x'ing it
|
||||
- *<SPC>cD* starts up the routine
|
||||
#+BEGIN_SRC elisp
|
||||
(after! dap-mode
|
||||
(defun oreodave/debug ()
|
||||
(interactive)
|
||||
(dap-ui-mode)
|
||||
(dap-ui-locals)
|
||||
(dap-ui-sessions))
|
||||
(map!
|
||||
:leader
|
||||
:desc "Start debugging setup" "cD" #'oreodave/debug))
|
||||
#+END_SRC
|
||||
** Elfeed
|
||||
Custom functions to work with elfeed, generating new feeds on demand and adding
|
||||
a keybind to help with that.
|
||||
#+BEGIN_SRC elisp
|
||||
(after! elfeed
|
||||
(defun oreodave/elfeed/load-feeds ()
|
||||
(interactive)
|
||||
(setq elfeed-feeds nil)
|
||||
(elfeed-load-opml (concat org-directory "/elfeed.opml")))
|
||||
|
||||
(defun oreodave/elfeed/on-new-feed ()
|
||||
(interactive)
|
||||
(elfeed-org-export-opml)
|
||||
(write-file (concat org-directory "/elfeed.opml"))
|
||||
(kill-current-buffer))
|
||||
|
||||
(map!
|
||||
(:map elfeed-search-mode-map
|
||||
:localleader
|
||||
:desc "Update feeds" "u" #'elfeed-update)
|
||||
(:leader
|
||||
:prefix "o"
|
||||
:desc "Open RSS" "f" #'=rss))
|
||||
|
||||
(add-hook 'elfeed-org-new-entry-hook 'oreodave/elfeed/on-new-feed))
|
||||
#+END_SRC
|
||||
** Dashboard
|
||||
My very own dashboard config using doom dashboard, with these features:
|
||||
- Custom load message
|
||||
- Custom splash image and dashboard buffer name
|
||||
- Custom dashboard sections for myself
|
||||
#+BEGIN_SRC elisp
|
||||
(defun doom-display-benchmark-h (&optional return-p)
|
||||
"Display a benchmark, showing number of packages and modules, and how quickly
|
||||
they were loaded at startup.
|
||||
|
||||
If RETURN-P, return the message as a string instead of displaying it."
|
||||
(funcall (if return-p #'format #'message)
|
||||
"εmacs loaded %d packages, %d modules in %.03fs"
|
||||
(- (length load-path) (length doom--initial-load-path))
|
||||
(if doom-modules (hash-table-count doom-modules) 0)
|
||||
(or doom-init-time
|
||||
(setq doom-init-time
|
||||
(float-time (time-subtract (current-time) before-init-time))))))
|
||||
|
||||
(setq fancy-splash-image "~/Pictures/space2.png") ; splash image
|
||||
(setq +doom-dashboard-name "*dashboard*")
|
||||
|
||||
(setq +doom-dashboard-functions ; limit the dashboard items
|
||||
'(doom-dashboard-widget-banner
|
||||
doom-dashboard-widget-loaded
|
||||
doom-dashboard-widget-shortmenu))
|
||||
|
||||
(setq +doom-dashboard-menu-sections ; Set a specific amount of items
|
||||
'(("Open org-agenda"
|
||||
:icon (all-the-icons-octicon "calendar" :face 'font-lock-keyword-face)
|
||||
:when (fboundp 'org-agenda)
|
||||
:action org-agenda)
|
||||
("Check the weather"
|
||||
:icon (all-the-icons-wicon "rain" :face 'font-lock-keyword-face)
|
||||
:action oreodave/weather)
|
||||
("Jump to bookmark"
|
||||
:icon (all-the-icons-octicon "bookmark" :face 'font-lock-keyword-face)
|
||||
:action bookmark-jump)
|
||||
("Open private config"
|
||||
:icon (all-the-icons-octicon "file-directory" :face 'font-lock-keyword-face)
|
||||
:action oreodave/goto-dotfiles)))
|
||||
#+END_SRC
|
||||
|
||||
- Space image comes from [[https://flaticon.com][website]]
|
||||
- Remove the Github link to the official Doom Emacs repository: it's in muscle memory
|
||||
at this point.
|
||||
- Added my own menu items:
|
||||
- Books
|
||||
- Weather
|
||||
* Language Config
|
||||
** C-style languages
|
||||
Emacs doesn't have the full range of styles that I want, so lemme just do it myself.
|
||||
#+BEGIN_SRC elisp
|
||||
(after! cc-mode
|
||||
(c-add-style
|
||||
"user"
|
||||
'((c-basic-offset . 2)
|
||||
(c-comment-only-line-offset . 0)
|
||||
(c-hanging-braces-alist (brace-list-open)
|
||||
(brace-entry-open)
|
||||
(substatement-open after)
|
||||
(block-close . c-snug-do-while)
|
||||
(arglist-cont-nonempty))
|
||||
(c-cleanup-list brace-else-brace)
|
||||
(c-offsets-alist
|
||||
(statement-block-intro . +)
|
||||
(knr-argdecl-intro . 0)
|
||||
(substatement-open . 0)
|
||||
(substatement-label . 0)
|
||||
(access-label . 0)
|
||||
(label . 0)
|
||||
(statement-cont . +))))
|
||||
(set-pretty-symbols!
|
||||
'(c-mode c++-mode)
|
||||
:return "return"
|
||||
:or "||"
|
||||
:and "&&"
|
||||
:not "!"
|
||||
:bool "bool"
|
||||
:str "string"
|
||||
:str "std::string"
|
||||
:float "float"
|
||||
:int "int"
|
||||
:false "false"
|
||||
:true "true"
|
||||
:null "nullptr"))
|
||||
#+END_SRC
|
||||
** LSP
|
||||
Add lsp-ui-doc-mode to lsp-ui-mode: allows you to see documentation in a little
|
||||
VSCode style web-kit window.
|
||||
#+BEGIN_SRC elisp
|
||||
(after! lsp-ui
|
||||
(add-hook 'lsp-ui-hook #'lsp-ui-doc-mode)
|
||||
(setq lsp-ui-doc-position 'top))
|
||||
#+END_SRC
|
||||
** CSharp
|
||||
- I have custom installed the omnisharp roslyn executable, so I'd rather use
|
||||
that
|
||||
#+BEGIN_SRC elisp
|
||||
(after! csharp-mode
|
||||
(setq omnisharp-server-executable-path "~/bin/omnisharp-roslyn/run"))
|
||||
#+END_SRC
|
||||
*** Unit test over whole projects
|
||||
- Implemented my own function which piggy backs counsel etags to globally search
|
||||
tags for test specific context, then goes to it and uses an omnisharp test
|
||||
command to unit test it. Basically global test search in C# projects. To use
|
||||
this, just make sure you have tags compiled and that all your tests are
|
||||
written as some public void *name* _Test (i.e. they are appended with _Test so
|
||||
that the pattern can be matched)
|
||||
#+BEGIN_SRC elisp
|
||||
(after! (csharp-mode counsel-etags)
|
||||
(defun oreodave/csharp/get-unit-test-in-project ()
|
||||
"Unit test anywhere using CTags or ETags and C#"
|
||||
(interactive)
|
||||
(let* ((tags-file (counsel-etags-locate-tags-file))
|
||||
(cands (counsel-etags-collect-cands "void.*Test" t buffer-file-name)))
|
||||
(ivy-read
|
||||
"Choose test: "
|
||||
cands
|
||||
:action
|
||||
(lambda (item)
|
||||
;; From the counsel-etags file-open-api function
|
||||
(when (string-match "\\`\\(.*?\\):\\([0-9]+\\):\\(.*\\)\\'" item)
|
||||
(let*
|
||||
((file (match-string-no-properties 1 item))
|
||||
(linenum (match-string-no-properties 2 item))
|
||||
;; always calculate path relative to TAGS
|
||||
(default-directory (counsel-etags-tags-file-directory)))
|
||||
|
||||
(counsel-etags-push-marker-stack (point-marker))
|
||||
(find-file file)
|
||||
(counsel-etags-forward-line linenum)
|
||||
(omnisharp-unit-test-at-point))))
|
||||
:caller 'oreodave/csharp/get-unit-tests-in-project))))
|
||||
#+END_SRC
|
||||
*** Redo omnisharp-emit-results
|
||||
- Reimplemented omnisharp-emit-results to emit stdout regardless of whether the
|
||||
test failed or not
|
||||
#+BEGIN_SRC elisp
|
||||
(after! (csharp-mode omnisharp)
|
||||
(defun omnisharp--unit-test-emit-results (passed results)
|
||||
"Emits unit test results as returned by the server to the unit test result buffer.
|
||||
PASSED is t if all of the results have passed. RESULTS is a vector of status data for
|
||||
each of the unit tests ran."
|
||||
; we want to clean output buffer for result if things have passed otherwise
|
||||
; compilation & test run output is to be cleared and results shown only for brevity
|
||||
|
||||
(omnisharp--unit-test-message "")
|
||||
|
||||
(seq-doseq (result results)
|
||||
(-let* (((&alist 'MethodName method-name
|
||||
'Outcome outcome
|
||||
'ErrorMessage error-message
|
||||
'ErrorStackTrace error-stack-trace
|
||||
'StandardOutput stdout
|
||||
'StanderError stderr) result)
|
||||
(outcome-is-passed (string-equal "passed" outcome)))
|
||||
|
||||
(omnisharp--unit-test-message
|
||||
(format "[%s] %s "
|
||||
(propertize
|
||||
(upcase outcome)
|
||||
'font-lock-face (if outcome-is-passed
|
||||
'(:foreground "green" :weight bold)
|
||||
'(:foreground "red" :weight bold)))
|
||||
(omnisharp--truncate-symbol-name method-name 76)))
|
||||
|
||||
(if error-stack-trace
|
||||
(omnisharp--unit-test-message error-stack-trace))
|
||||
|
||||
(unless (= (seq-length stdout) 0)
|
||||
(omnisharp--unit-test-message "Standard output:")
|
||||
(seq-doseq (stdout-line stdout)
|
||||
(omnisharp--unit-test-message stdout-line)))
|
||||
|
||||
(unless (= (seq-length stderr) 0)
|
||||
(omnisharp--unit-test-message "Standard error:")
|
||||
(seq-doseq (stderr-line stderr)
|
||||
(omnisharp--unit-test-message stderr-line)))
|
||||
))
|
||||
|
||||
(omnisharp--unit-test-message "")
|
||||
|
||||
(if (eq passed :json-false)
|
||||
(omnisharp--unit-test-message
|
||||
(propertize "*** UNIT TEST RUN HAS FAILED ***"
|
||||
'font-lock-face '(:foreground "red" :weight bold)))
|
||||
(omnisharp--unit-test-message
|
||||
(propertize "*** UNIT TEST RUN HAS SUCCEEDED ***"
|
||||
'font-lock-face '(:foreground "green" :weight bold)))
|
||||
)
|
||||
nil))
|
||||
#+END_SRC
|
||||
*** Map for C# mode
|
||||
#+BEGIN_SRC elisp
|
||||
(after! csharp-mode
|
||||
(map! ; CSharp Keybinds
|
||||
:map csharp-mode-map
|
||||
:localleader
|
||||
:desc "Format buffer" "=" #'omnisharp-code-format-entire-file
|
||||
(:prefix "t"
|
||||
:desc "Select Test in Project" "t" #'oreodave/csharp/get-unit-test-in-project)))
|
||||
#+END_SRC
|
||||
** Python
|
||||
- I do python development for Python3, so I need to set the flycheck python checker, as well as the interpreter, to be Python3
|
||||
- Most of my python work is in scripts or ideas, so I don't need extensive testing utilities or anything like that
|
||||
- I run my python code a LOT and thus need commands for sending bits or whole scripts into the REPL
|
||||
#+BEGIN_SRC elisp
|
||||
(after! python
|
||||
(setq python-version-checked t)
|
||||
(setq python-python-command "python3")
|
||||
(setq python-shell-interpreter "python3")
|
||||
(setq flycheck-python-pycompile-executable "python3")
|
||||
|
||||
(map! ; Python keybinds
|
||||
:map python-mode-map
|
||||
:localleader
|
||||
:desc "Start python minor" "c" #'run-python
|
||||
:desc "Format buffer" "=" #'py-yapf-buffer
|
||||
(:prefix "s"
|
||||
:desc "Send region REPL" "r" #'python-shell-send-region
|
||||
:desc "Send buffer" "b" #'python-shell-send-buffer
|
||||
:desc "Send function" "f" #'python-shell-send-defun)))
|
||||
#+END_SRC
|
||||
** TypeScript
|
||||
- Typescript (in my opinion) should be indented by 2
|
||||
- Setup the LSP server on the lsp-language-id-config in case it hasn't already
|
||||
#+BEGIN_SRC elisp
|
||||
(after! typescript-mode
|
||||
(setq typescript-indent-level 2)
|
||||
(setq tide-format-options '(:indentSize 2 :tabSize 2))
|
||||
(after! lsp
|
||||
(cl-pushnew '(typescript-mode . "typescript") lsp-language-id-configuration :key #'car)
|
||||
(lsp-register-client
|
||||
(make-lsp-client
|
||||
:new-connection (lsp-stdio-connection "typescript-language-server --stdio")
|
||||
:major-modes '(typescript-mode)
|
||||
:server-id 'typescript))))
|
||||
#+END_SRC
|
||||
** Haskell
|
||||
#+BEGIN_SRC elisp
|
||||
(after! (haskell-mode dante)
|
||||
(setq dante-repl-command-line '("stack" "ghci")))
|
||||
#+END_SRC
|
||||
** Ocaml
|
||||
Added ocaml-lsp support.
|
||||
#+BEGIN_SRC elisp
|
||||
(after! lsp
|
||||
(lsp-register-client
|
||||
(make-lsp-client :new-connection (lsp-stdio-connection "ocamllsp")
|
||||
:major-modes '(tuareg-mode)
|
||||
:server-id 'ocaml-lsp)))
|
||||
#+END_SRC
|
||||
** FSharp
|
||||
#+BEGIN_SRC elisp
|
||||
(after! fsharp
|
||||
(setq inferior-fsharp-program "dotnet fsi --readline"))
|
||||
#+END_SRC
|
||||
* Keymap
|
||||
General keymap for leader
|
||||
** Personal
|
||||
- Prefix "SPC m" (rebound from local-leader) that will hold personal keybinds
|
||||
for functions that I like using
|
||||
- Mostly opening directories I use a lot or doing custom stuff that I can't
|
||||
really put in anything in particular
|
||||
#+BEGIN_SRC elisp
|
||||
(map!
|
||||
:leader
|
||||
:prefix ("m" . "personal") ; Personal
|
||||
:desc "Open books" "b" #'(lambda () (interactive) (dired (concat org-directory "/Books"))); I like my books
|
||||
:desc "Open school dir" "s" #'(lambda () (interactive) (dired (expand-file-name "~/School")))
|
||||
:desc "Open notes" "n" #'(lambda () (interactive) (dired org-directory))
|
||||
:desc "Open code" "c" #'(lambda () (interactive) (dired (expand-file-name "~/Code")))
|
||||
:desc "Open weather" "w" #'oreodave/weather
|
||||
:desc "Change theme" "t" #'oreodave/themes/set-new-theme ; From my own collection
|
||||
:desc "Generate template" "g" #'oreodave/templates/generate-template ; From my own collection
|
||||
(:after pdf-view
|
||||
:desc "Goto page on pdf" "p" #'pdf-view-goto-page)
|
||||
:desc "Reload emacs" "r" #'oreodave/reload) ; Reload is necessary
|
||||
#+END_SRC
|
||||
** Counsel
|
||||
- Counsel keybind config
|
||||
- Mostly just convenience stuff that happens to use counsel
|
||||
#+BEGIN_SRC elisp
|
||||
(map!
|
||||
:leader
|
||||
:after counsel ; Counsel or ivy
|
||||
:desc "M-x" "<SPC>" #'counsel-M-x ; Redefine as M-x because of my muscle memory with spacemacs
|
||||
:desc "Find file here" "f." #'counsel-find-file ; Sometimes use this instead of <SPC>ff
|
||||
(:prefix ("s" . "search")
|
||||
:desc "RipGrep!" "r" #'counsel-rg ; Ripgrep is faster than Ag in most cases and makes me feel cool
|
||||
:desc "Search Tags" "t" #'counsel-etags-find-tag)); is quicker to do than <SPC>/b, for something that is done so often
|
||||
#+END_SRC
|
||||
** Window
|
||||
- Keybinds to do with windows
|
||||
- SPC wc < SPC wd
|
||||
- Some ace-window config in the window keybind prefix
|
||||
#+BEGIN_SRC elisp
|
||||
(map!
|
||||
:leader
|
||||
:prefix ("w" . "window") ; Windows
|
||||
:desc "Close window" "d" #'+workspace/close-window-or-workspace ; is slightly closer together than <SPC>wc
|
||||
:desc "Switch window" "W" #'ace-window ; is also used in spacemacs so I'd rather use this
|
||||
:desc "Swap windows" "S" #'ace-swap-window) ; allows me to switch windows more efficiently than before, better than just motions
|
||||
#+END_SRC
|
||||
** Code
|
||||
- Some keybinds for the code prefix which help me with coding or working with
|
||||
code, particularly LSP
|
||||
#+BEGIN_SRC elisp
|
||||
(map!
|
||||
:leader
|
||||
:prefix ("c" . "code") ; Code
|
||||
:desc "Fold all in level" "f" #'hs-hide-level
|
||||
:desc "Compile via make" "C" #'+make/run
|
||||
(:after format-all
|
||||
:desc "Format code" "=" #'format-all-buffer)
|
||||
(:after lsp
|
||||
:desc "Execute action" "a" #'lsp-execute-code-action)
|
||||
(:after dap-mode
|
||||
:desc "Debug hydra" "h" #'dap-hydra))
|
||||
#+END_SRC
|
||||
** Projectile
|
||||
- Projectile config, for leader and for project prefix
|
||||
#+BEGIN_SRC elisp
|
||||
(map!
|
||||
:leader
|
||||
:after projectile
|
||||
:desc "Switch to p-buffer" ">" #'projectile-switch-to-buffer ; Opposing <SPC>< which counsel's all buffers
|
||||
(:prefix ("p" . "project")
|
||||
:desc "Regen tags" "g" #'projectile-regenerate-tags
|
||||
:desc "Open project files" "f" #'projectile-find-file))
|
||||
#+END_SRC
|
||||
** Fonts
|
||||
- Fonts keybinds (prefix "z") for messing with fonts temp on a buffer
|
||||
- Really useful when I need to zoom into something for whatever reason
|
||||
#+BEGIN_SRC elisp
|
||||
(map!
|
||||
:leader
|
||||
:prefix ("z" . "font") ; Fonts
|
||||
:desc "Increase font" "+" #'doom/increase-font-size
|
||||
:desc "Decrease font" "-" #'doom/decrease-font-size
|
||||
:desc "Adjust font" "z" #'text-scale-adjust)
|
||||
#+END_SRC
|
||||
** Frames
|
||||
- Keybinds for frame manipulation:
|
||||
- Generate new frames from current buffer
|
||||
- Generate new frames from a specific buffer
|
||||
- Delete frames
|
||||
- Switch frames
|
||||
#+BEGIN_SRC elisp
|
||||
(map!
|
||||
:leader
|
||||
:prefix ("F" . "frame") ; Frames
|
||||
:desc "Kill frame" "d" #'delete-frame
|
||||
:desc "Current buffer frame" "m" #'make-frame
|
||||
:desc "Choose Buffer frame" "n" #'display-buffer-other-frame
|
||||
:desc "Switch frames" "o" #'other-frame)
|
||||
#+END_SRC
|
||||
** Other
|
||||
- Miscellaneous bindings that don't really fit into any particular item
|
||||
#+BEGIN_SRC elisp
|
||||
(map!
|
||||
:leader
|
||||
:desc "Shell command" "!" #'shell-command ; Better than M-!
|
||||
(:prefix ("b" . "buffers") ; Buffers
|
||||
:desc "Close buffer" "d" #'doom/kill-this-buffer-in-all-windows)
|
||||
(:prefix ("f" . "files")
|
||||
:desc "Open dotfiles" "p" #'oreodave/goto-dotfiles)
|
||||
(:prefix ("o" . "open")
|
||||
:after org
|
||||
:desc "Calendar" "c" #'=calendar)
|
||||
(:prefix ("n" . "notes")
|
||||
:desc "Open notes in dired" "-" #'(lambda () (interactive) (dired org-directory))))
|
||||
#+END_SRC
|
||||
107
doom.d/config/literate.org
Normal file
107
doom.d/config/literate.org
Normal file
@@ -0,0 +1,107 @@
|
||||
#+TITLE: Literate configuration
|
||||
|
||||
* Preclude
|
||||
My setup to produce a literate configuration. Allows me to write org files all
|
||||
around the /doom-private-dir/ and access them. Also shaved like 0.2s off my
|
||||
loading time.
|
||||
* Constants
|
||||
Initialise some basic constants for where stuff is.
|
||||
#+BEGIN_SRC elisp
|
||||
(setq oreodave/literate/bin-dir (expand-file-name (concat doom-private-dir "bin/")))
|
||||
(setq oreodave/literate/preloaded-files (list "README.org" "org/packages.org"
|
||||
"org/config.org" "org/literate.org"))
|
||||
#+END_SRC
|
||||
* Remove function
|
||||
When loading the lisp, we need to load everything excluding "config.el"
|
||||
(preloaded by doom) and "literate.el" (loaded by "config.el"). We'll make a very
|
||||
specific remove function that will remove entries from a given list and return
|
||||
the new list, given the fact that the files variable will be a list of fully
|
||||
expanded file names.
|
||||
#+BEGIN_SRC elisp
|
||||
(defun oreodave/literate/remove-mult (remove-files files)
|
||||
"Remove any occurrences of `remove-files' from `files'"
|
||||
(let ((parsed-remove-files (map 'list
|
||||
#'(lambda (i) (expand-file-name (concat doom-private-dir i)))
|
||||
remove-files))) ; Generate a list of all fully expanded files to remove
|
||||
(remove-if #'(lambda (l) (member l parsed-remove-files)) files))) ; remove any files that are in the remove-files
|
||||
#+END_SRC
|
||||
* Destination for parser
|
||||
Generate the destination for a literate config org file to parse to, in this
|
||||
case the bin folder in the private directory
|
||||
This is not fitted onto the parser because the parser could be fitted to
|
||||
multiple /differing/ outputs easily if it isn't specified a destination.
|
||||
#+BEGIN_SRC elisp
|
||||
(defun oreodave/literate/destination(SRC)
|
||||
"Parse a src.org file to a bin/src.el file"
|
||||
(replace-regexp-in-string ".*/\\(\\w+\\).org"
|
||||
(expand-file-name (concat oreodave/literate/bin-dir "\\1.el")) SRC))
|
||||
#+END_SRC
|
||||
* Parser
|
||||
First we need to get some sort of parser which can, given a source org file and
|
||||
a destination, parse and produce an Emacs lisp file. We'll copy this from the
|
||||
literate module of doom.
|
||||
#+BEGIN_SRC elisp
|
||||
(defun oreodave/literate/tangle (SRC DEST)
|
||||
"Tangle a source org file into a destination el file using a new emacs instance"
|
||||
(let ((default-directory doom-private-dir))
|
||||
(when (file-newer-than-file-p SRC DEST)
|
||||
(let ((output (get-buffer-create "*org-tangle*")))
|
||||
(unwind-protect
|
||||
(or (and (zerop (call-process
|
||||
"emacs" nil output nil
|
||||
"-q" "--batch"
|
||||
"-l" "ob-tangle"
|
||||
"--eval" (format "(org-babel-tangle-file %S %S)"
|
||||
SRC DEST)))
|
||||
(with-current-buffer output
|
||||
(message "%s" (buffer-string))
|
||||
t))
|
||||
(warn (format "Problem with tanging %S to %S" SRC DEST)))
|
||||
(kill-buffer output))))))
|
||||
#+END_SRC
|
||||
* Hook on save
|
||||
Now we need to make a hook function that, when the current buffer is an org file
|
||||
in the doom directory, will run the literate config procedure from above. Use
|
||||
this hook function and add it to the after-save-hook once org mode has been
|
||||
loaded. README.org has been added as an exception because it doesn't contain
|
||||
literate contents.
|
||||
#+BEGIN_SRC elisp
|
||||
(defun oreodave/literate/compile-hook ()
|
||||
(when (and (eq major-mode 'org-mode)
|
||||
(or (file-in-directory-p buffer-file-name doom-private-dir)
|
||||
(file-in-directory-p buffer-file-name (concat doom-private-dir "modules")))
|
||||
(not (string= buffer-file-name (expand-file-name (concat doom-private-dir "README.org")))))
|
||||
(oreodave/literate/tangle buffer-file-name (oreodave/literate/destination buffer-file-name))))
|
||||
|
||||
(after! org
|
||||
(add-hook 'after-save-hook #'oreodave/literate/compile-hook))
|
||||
#+END_SRC
|
||||
* Procedure for all files
|
||||
A procedure that parses all the org files in a given directory into Emacs lisp
|
||||
files, using the parser function made. Assume all org files in the "location"
|
||||
directory contribute to the config.
|
||||
The location is not set because this function could be easily programmed to use
|
||||
multiple /differing/ sources to produce the config. The tangle function is set
|
||||
because this is the function we'll be using for tangling all org files to ELisp files.
|
||||
#+BEGIN_SRC elisp
|
||||
(defun oreodave/literate/tangle-all (&optional location)
|
||||
"Tangle all org files in `location' to el files in the `destination'"
|
||||
(or location (setq location doom-private-dir))
|
||||
(interactive)
|
||||
(message "Starting compilation process")
|
||||
(let ((files (directory-files-recursively location ".org")))
|
||||
(dolist (file files)
|
||||
(message "Compiling and parsing %s" file)
|
||||
(oreodave/literate/tangle file (oreodave/literate/destination file)))))
|
||||
#+END_SRC
|
||||
* Load configuration
|
||||
Final step of the literate cycle: load the config for the first time.
|
||||
Remove the config.el and literate.el files from the load list because:
|
||||
1) config.org is preloaded by doom
|
||||
2) literate.org is loaded by config.org, thus no need to reload it
|
||||
|
||||
#+BEGIN_SRC elisp
|
||||
(let ((files (directory-files-recursively "~/.doom.d/org" ".org"))) ; Load
|
||||
(dolist (file (oreodave/literate/remove-mult oreodave/literate/preloaded-files files))
|
||||
(load (oreodave/literate/destination file))))
|
||||
#+END_SRC
|
||||
58
doom.d/config/packages.org
Normal file
58
doom.d/config/packages.org
Normal file
@@ -0,0 +1,58 @@
|
||||
#+TITLE: Packages
|
||||
|
||||
* Preclude
|
||||
A list of extra packages I have added to doom, and justification for why.
|
||||
Here are some examples of how to do packages in Doom.
|
||||
#+BEGIN_SRC elisp :tangle no
|
||||
(package! some-package) ;melpa
|
||||
(package! another-package :recipe (:host github :repo "username/repo"))
|
||||
(package! builtin-package :disable t)
|
||||
#+END_SRC
|
||||
* Header
|
||||
Don't byte compile this, not a good idea.
|
||||
#+BEGIN_SRC elisp
|
||||
;; -*-no-byte-compile: t-*-
|
||||
#+END_SRC
|
||||
* General
|
||||
** wttrin
|
||||
Weather analysis, useful for when I don't have my phone near me or I need to
|
||||
show just *how* much Emacs can do to someone.
|
||||
#+BEGIN_SRC elisp
|
||||
(package! wttrin)
|
||||
#+END_SRC
|
||||
** powerthesaurus
|
||||
Thesaurus for Emacs, amazingly useful. I do know that doom has it's own
|
||||
dictionary and thesaurus module, but I wish to use my own cos I have very
|
||||
specific needs
|
||||
#+BEGIN_SRC elisp
|
||||
(package! powerthesaurus)
|
||||
#+END_SRC
|
||||
* Coding
|
||||
** counsel-etags
|
||||
Should really be an inbuilt feature for Ivy, as it is so damn useful. Better
|
||||
than the Helm or inbuilt "TAGS" searching options as it provides ways to quickly
|
||||
filter data from the tag set which makes it incredibly fast. I have personally
|
||||
used it in some of my personal functions such as the global testing function I
|
||||
have for C# using both tags and OmniSharp.
|
||||
#+BEGIN_SRC elisp
|
||||
(package! counsel-etags)
|
||||
#+END_SRC
|
||||
** Arduino
|
||||
I sometimes dabble in Arduino coding, and absolutely adore Emacs, so who says I
|
||||
can't make Emacs an Arduino IDE?
|
||||
*** arduino-mode
|
||||
Absolutely necessary for Arduino development: syntax highlighting. I soon plan
|
||||
to make my own Arduino mode on the back of cc-mode, but who knows when that will
|
||||
happen?
|
||||
#+BEGIN_SRC elisp
|
||||
(package! arduino-mode)
|
||||
#+END_SRC
|
||||
*** company-arduino
|
||||
Auto complete is essential to make the ultimate IDE experience™. Thus, company-arduino.
|
||||
#+BEGIN_SRC elisp
|
||||
(package! company-arduino)
|
||||
#+END_SRC
|
||||
** Ocaml
|
||||
#+BEGIN_SRC elisp
|
||||
(package! tuareg)
|
||||
#+END_SRC
|
||||
76
doom.d/config/personal.org
Normal file
76
doom.d/config/personal.org
Normal file
@@ -0,0 +1,76 @@
|
||||
#+TITLE: Personal module
|
||||
|
||||
* Preclude
|
||||
Personal functionality that aid my workflow or are just cool.
|
||||
* Reload
|
||||
Reload the doom session by brute force fully loading the "config.el" file in the
|
||||
doom private directory.
|
||||
#+BEGIN_SRC elisp
|
||||
(defun oreodave/reload ()
|
||||
"Reload instance of doom"
|
||||
(interactive)
|
||||
(load-file (concat doom-private-dir "config.el")))
|
||||
#+END_SRC
|
||||
* Change theme
|
||||
Allow user to set a theme from a limited set of candidates, based on
|
||||
"oreodave/theme-list".
|
||||
|
||||
- Themes sanctioned by me:
|
||||
- doom-solarized-dark: just the right everything. best for day.
|
||||
- doom-gruvbox: good contrast, better for night.
|
||||
- doom-city-lights: Eh contrast, quite dark
|
||||
- doom-outrun-electric: Interesting colour palette
|
||||
- doom-vibrant: Good contrast, bit lighter
|
||||
- doom-molokai: hacker style
|
||||
- doom-solarized-light: Light orange theme that's actually okay on the eyes
|
||||
- doom-acario-light: Light theme with not bad colours
|
||||
- Themes not sanctioned:
|
||||
- Any of the base16 themes for anything other than editing code, not org.
|
||||
Contrast isn't good enough
|
||||
- Light themes other than Emacs default, maybe sometimes solarized-light
|
||||
- Horrid low contrast ones with no colour. Grayscale particularly. I can't
|
||||
handle those.
|
||||
#+BEGIN_SRC elisp
|
||||
(setq oreodave/themes/theme-list '(doom-solarized-dark doom-gruvbox doom-city-lights
|
||||
doom-outrun-electric doom-vibrant doom-molokai
|
||||
doom-solarized-light doom-acario-light))
|
||||
|
||||
(defun oreodave/themes/set-new-theme ()
|
||||
"Set the theme from my own selection, mutate as you see fit"
|
||||
(interactive)
|
||||
(ivy-read "Select theme: "
|
||||
oreodave/themes/theme-list
|
||||
:caller 'oreodave/set-new-theme
|
||||
:action (lambda (x) ; Shamelessly copied from counsel in case of change
|
||||
(condition-case nil
|
||||
(progn
|
||||
(mapc #'disable-theme custom-enabled-themes)
|
||||
(load-theme (intern x) t)
|
||||
(when (fboundp 'powerline-reset)
|
||||
(powerline-reset)))
|
||||
(error "Problem loading theme %s" x)))))
|
||||
#+END_SRC
|
||||
* Password store
|
||||
Function to get a password given a key.
|
||||
#+BEGIN_SRC elisp
|
||||
(defun oreodave/password-store/get-password (KEY)
|
||||
(shell-command-to-string (concat "pass " KEY)))
|
||||
#+END_SRC
|
||||
* Weather
|
||||
Function to quickly check weather, which is what I wanted wttrin for.
|
||||
#+BEGIN_SRC elisp
|
||||
(defun oreodave/weather ()
|
||||
"Check the weather at the 'location' stored in password store"
|
||||
(interactive)
|
||||
(wttrin (oreodave/password-store/get-password "location")))
|
||||
#+END_SRC
|
||||
* Go to dotfiles
|
||||
A better version of 'goto private directory' which actually goes to my Dot files
|
||||
directory overall.
|
||||
|
||||
#+BEGIN_SRC elisp
|
||||
(defun oreodave/goto-dotfiles ()
|
||||
"Go to the dotfiles directory"
|
||||
(interactive)
|
||||
(doom-project-find-file "~/Dotfiles"))
|
||||
#+END_SRC
|
||||
55
doom.d/config/writers.org
Normal file
55
doom.d/config/writers.org
Normal file
@@ -0,0 +1,55 @@
|
||||
#+TITLE: Writers module
|
||||
|
||||
* Thesaurus
|
||||
#+BEGIN_SRC elisp
|
||||
(use-package! powerthesaurus
|
||||
:after-call (org-mode)
|
||||
:defer-incrementally (org)
|
||||
:config
|
||||
(map!
|
||||
:localleader
|
||||
:map org-mode-map
|
||||
:prefix "w"
|
||||
:desc "Thesaurus" "t" #'powerthesaurus-lookup-word-at-point))
|
||||
#+END_SRC
|
||||
Powerthesaurus for thesaurus on writer files
|
||||
* Spelling checker
|
||||
#+BEGIN_SRC elisp
|
||||
(map!
|
||||
:after (flyspell org)
|
||||
:localleader
|
||||
:map org-mode-map
|
||||
:prefix "w"
|
||||
:desc "Correct current word" "c" #'flyspell-correct-at-point
|
||||
:desc "Autocorrect word" "a" #'flyspell-auto-correct-word
|
||||
:desc "Goto next error" "w" #'flyspell-goto-next-error)
|
||||
#+END_SRC
|
||||
* Org
|
||||
** Org
|
||||
#+BEGIN_SRC elisp
|
||||
(setq org-directory "~/Text"
|
||||
org-agenda-files (directory-files-recursively org-directory ".org"))
|
||||
(map! ; Org keybinds
|
||||
:after org
|
||||
:map org-mode-map
|
||||
:localleader
|
||||
:desc "Org dispatch" "e" #'org-export-dispatch
|
||||
:desc "Export to ODT" "E" #'org-pandoc-export-to-odt
|
||||
(:prefix ("N" . "narrow")
|
||||
:desc "Narrow to subtree" "n" #'org-narrow-to-subtree
|
||||
:desc "Go out of narrow" "o" #'widen
|
||||
:desc "Narrow tags" "t" #'org-tags-sparse-tree))
|
||||
#+END_SRC
|
||||
|
||||
I like using the org dispatch facilities more than the default export keybinds
|
||||
in Doom, so I need this binding
|
||||
** Org calendar
|
||||
#+BEGIN_SRC elisp
|
||||
(use-package! org-gcal
|
||||
:after-call (org-agenda +calendar-open-function)
|
||||
:hook (org-agenda-mode-hook calendar-load-hook)
|
||||
:config
|
||||
(setq org-gcal-client-id (password-store-get "GoogleCalendar/id"))
|
||||
(setq org-gcal-client-secret (password-store-get "GoogleCalendar/secret"))
|
||||
(setq org-gcal-file-alist '(("aryadevchavali1@gmail.com" . "~/Text/schedule.org"))))
|
||||
#+END_SRC
|
||||
Reference in New Issue
Block a user