~~/.doom.d -> ~/.config/doom

This commit is contained in:
dx
2020-07-15 15:56:08 +01:00
parent 33edf2cf6d
commit 6bdf6db3b4
42 changed files with 16 additions and 14 deletions

View File

@@ -0,0 +1,14 @@
#+TITLE: εmacs configuration
#+DATE: December 30, 2019
#+STARTUP: inlineimages nofold
This is my Doom Emacs configuration. Use the links below to access various parts
of my config.
[[file:modules/config.org][Main config]]
[[file:modules/literate.org][Literate module]]
[[file:modules/personal.org][Personal functions module]]
[[file:modules/writers.org][Writer packages module]]

View File

@@ -0,0 +1,20 @@
;;; ~/Dotfiles/doom.d/config.el -*- lexical-binding: t; -*-
(defconst +bootstrap/org-files '("config.org" "personal.org") "Org files to load relative to =doom-private-dir=/org/*")
(defconst +bootstrap/byte-compile t "Byte compile org files")
(defun +bootstrap/apply-files (babel-func)
"Apply babel-func to a transformed list of org-files"
(cl-map nil #'(lambda (file) (funcall babel-func (expand-file-name (concat doom-private-dir "org/" file)))) +bootstrap/org-files))
(defun +bootstrap/load-files ()
"Load org files into current Emacs session via =org-babel-load-file="
(interactive)
(+bootstrap/apply-files #'org-babel-load-file))
(defun +bootstrap/compile-files ()
"Compile org files via =org-babel-tangle-file="
(interactive)
(+bootstrap/apply-files #'org-babel-tangle-file))
(+bootstrap/load-files)

261
Doom/.config/doom/init.el Normal file
View File

@@ -0,0 +1,261 @@
;;; init.el -*- lexical-binding: t; -*-
;; Copy this file to ~/.doom.d/init.el or ~/.config/doom/init.el ('doom
;; quickstart' will do this for you). The `doom!' block below controls what
;; modules are enabled and in what order they will be loaded. Remember to run
;; 'doom refresh' after modifying it.
;;
;; More information about these modules (and what flags they support) can be
;; found in modules/README.org.
(doom! :private
;;(oreoline)
bindings
startup
gentemplate
narrow
;; (ocaml +lsp)
;; (rss +elfeed)
;;(completion)
:input
;;chinese
;;japanese
:completion
(company +childframe) ; the ultimate code completion backend
;; (ivy
;; +fuzzy
;; +icons) ; a search engine for love and life
;;helm ; the *other* search engine for love and life
ido ; the other *other* search engine...
: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
;;fill-column ; a `fill-column' indicator
hl-todo ; highlight TODO/FIXME/NOTE tags
indent-guides ; highlighted indent columns
;;(modeline) ; snazzy, Atom-inspired modeline, plus API
nav-flash ; blink the current line after jumping
;;neotree ; a project drawer, like NERDTree for vim
ophints ; highlight the region an operation acts on
(popup ; tame sudden yet inevitable temporary windows
+all ; catch all popups that start with an asterix
+defaults) ; default popup rules
(pretty-code +fira) ; replace bits of code with pretty symbols
;;tabs ; FIXME an (incomplete) tab bar for Emacs
;;treemacs ; a project drawer, like neotree but cooler
;;unicode ; extended unicode support for various languages
vc-gutter ; 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
:editor
(evil +everywhere); come to the dark side, we have cookies
file-templates ; auto-snippets for empty files
fold ; (nigh) universal code folding
(format) ; automated prettiness
;;lispy ; vim for lisp, for people who dont 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
:emacs
(dired ; making dired pretty [functional]
;; +ranger ; bringing the goodness of ranger to dired
+icons) ; colorful icons for dired-mode
electric ; smarter, keyword-based electric-indent
vc ; version-control and Emacs, sitting in a tree
(ibuffer +icons)
:term
eshell ; a consistent, cross-platform shell (WIP)
;;shell ; a terminal REPL for Emacs
;;term ; terminals in Emacs
vterm ; another terminals in Emacs
:checkers
syntax ; tasing you for every semicolon you forget
spell ; tasing you for misspelling mispelling
:tools
;;ansible
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) ; helps you navigate your code and documentation
lsp
;;macos ; MacOS-specific commands
magit ; 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
;;terraform ; infrastructure as code
;;tmux ; an API for interacting with tmux
;;upload ; map local to remote projects via ssh/ftp
:lang
;;agda ; types of types of types of types...
;;assembly ; assembly for fun or debugging
(cc
+lsp) ; C/C++/Obj-C madness
;;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) ; unity, .NET, and mono shenanigans
data ; config/data formats
;;erlang ; an elegant language for a more civilized age
;;elixir ; erlang done right
;;elm ; care for a cup of TEA?
emacs-lisp ; drown in parentheses
;;ess ; emacs speaks statistics
;;(fsharp +lsp) ; ML stands for Microsoft's Language
;;go ; the hipster dialect
(haskell) ; a language that's lazier than I am
;;hy ; readability of scheme w/ speed of python
;;idris ;
;;(java +lsp) ; the poster child for carpal tunnel syndrome
(javascript
+lsp) ; 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
;;ledger ; an accounting system in Emacs
;;lua ; one-based indices? one-based indices
markdown ; writing docs for people to ignore
;;nim ; python + lisp at the speed of c
;;nix ; I hereby declare "nix geht mehr!"
(org ; organize your plain life in plain text
+dragndrop ; file drag & drop support
+ipython ; ipython support for babel
+pandoc ; pandoc integration into org's exporter
+pomodoro
+gnuplot
+present) ; using Emacs for presentations
;;perl ; write code no one else can comprehend
;;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
;;rest ; Emacs as a REST client
;;ruby ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
(rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
;;scala ; java, but good
sh ; she sells {ba,z,fi}sh shells on the C xor
;;solidity ; do you need a blockchain? No.
;;swift ; who asked for emoji variables?
;;terra ; Earth and Moon in alignment for performance.
web ; the tubes
;;vala ; GObjective-C
:email
;;(mu4e +gmail) ; WIP
;;notmuch ; WIP
;;(wanderlust +gmail) ; WIP
;; Applications are complex and opinionated modules that transform Emacs
;; toward a specific purpose. They may have additional dependencies and
;; should be loaded late.
:app
;;calendar
;;irc ; how neckbeards socialize
;;rss ; emacs as an RSS reader
;;twitter ; twitter client https://twitter.com/vnought
:config
;; For literate config users. This will tangle+compile a config.org
;; literate config in your `doom-private-dir' whenever it changes.
;; literate
;; The default module sets reasonable defaults for Emacs. It also
;; provides a Spacemacs-inspired keybinding scheme and a smartparens
;; config. Use it as a reference for your own modules.
(default +smartparens))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(ansi-color-names-vector
["#1c1e1f" "#ff6c6b" "#98be65" "#ECBE7B" "#51afef" "#c678dd" "#46D9FF" "#bbc2cf"])
'(c-basic-offset 2)
'(c-default-style
'((c-mode . "linux")
(c++-mode . "linux")
(csharp-mode . "java")))
'(c-offsets-alist '((c . c-lineup-C-comments)))
'(custom-safe-themes
'("f2b83b9388b1a57f6286153130ee704243870d40ae9ec931d0a1798a5a916e76" "8c1dd3d6fdfb2bee6b8f05d13d167f200befe1712d0abfdc47bb6d3b706c3434" "b3bcf1b12ef2a7606c7697d71b934ca0bdd495d52f901e73ce008c4c9825a3aa" "93268bf5365f22c685550a3cbb8c687a1211e827edc76ce7be3c4bd764054bad" "f30aded97e67a487d30f38a1ac48eddb49fdb06ac01ebeaff39439997cbdd869" "7ffb0d3d0c797b980ed7330adc04a66516d49a61e4187a7054dda014676421d9" "cabc32838ccceea97404f6fcb7ce791c6e38491fd19baa0fcfb336dcc5f6e23c" "d8e3a2b8c72c3cb52d070a5e1969849197488b92d7211cc86c97e033239fdde2" "1728dfd9560bff76a7dc6c3f61e9f4d3e6ef9d017a83a841c117bd9bebe18613" "423435c7b0e6c0942f16519fa9e17793da940184a50201a4d932eafe4c94c92d" "fe76f3d5094967034192f6a505085db8db6deb0e135749d9a54dc488d6d3ee2f" "0d087b2853473609d9efd2e9fbeac088e89f36718c4a4c89c568dd1b628eae41" "c8f959fb1ea32ddfc0f50db85fea2e7d86b72bb4d106803018be1c3566fd6c72" "7d56fb712ad356e2dacb43af7ec255c761a590e1182fe0537e1ec824b7897357" "a2286409934b11f2f3b7d89b1eaebb965fd63bc1e0be1c159c02e396afb893c8" "66d53738cc824d0bc5b703276975581b8de2b903d6ce366cd62207b5dd6d3d13" "0fe9f7a04e7a00ad99ecacc875c8ccb4153204e29d3e57e9669691e6ed8340ce" "2878517f049b28342d7a360fd3f4b227086c4be8f8409f32e0f234d129cee925" "f951343d4bbe5a90dba0f058de8317ca58a6822faa65d8463b0e751a07ec887c" "428754d8f3ed6449c1078ed5b4335f4949dc2ad54ed9de43c56ea9b803375c23" "f8c30fa07ba7e8fe884f22b428dae6724955fa61ad84a658c3b0164ae391fb52" "a16e816774b437acb78beb9916a60ea236cfcd05784227a7d829623f8468c5a2" "9c27124b3a653d43b3ffa088cd092c34f3f82296cf0d5d4f719c0c0817e1afa6" "e838d6375a73fda607820c65eb3ea1f9336be7bd9a5528c9161e10c4aa663b5b" "427fa665823299f8258d8e27c80a1481edbb8f5463a6fb2665261e9076626710" "4e132458143b6bab453e812f03208075189deca7ad5954a4abb27d5afce10a9a" "06e4b3fdcbadc29ff95a7146dee846cd027cfefca871b2e9142b54ad5de4832f" "8e04ea7bf8a736b0bfacd363f4810ffce774ff9ba24f356172ae2b83307aebb2" "614e5089876ea69b515c50b6d7fa0a37eb7ed50fda224623ec49e1c91a0af6a1" "8047ac280914cbe8dcdc489703c398f0941339cfca77dfc09f3641f1f040267c" "1a6d627434899f6d21e35b85fee62079db55ef04ecd9b70b82e5d475406d9c69" "43c808b039893c885bdeec885b4f7572141bd9392da7f0bd8d8346e02b2ec8da" "2f0cbe053485bccbbbb582acdba7c7c9585ad808ee8ab32f0d727c3d39b42275" "f5568ed375abea716d1bdfae0316d1d179f69972eaccd1f331b3e9863d7e174a" "b0fd04a1b4b614840073a82a53e88fe2abc3d731462d6fde4e541807825af342" "155a5de9192c2f6d53efcc9c554892a0d87d87f99ad8cc14b330f4f4be204445" "cdb3e7a8864cede434b168c9a060bf853eeb5b3f9f758310d2a2e23be41a24ae" "8c847a5675ece40017de93045a28ebd9ede7b843469c5dec78988717f943952a" "ef4edbfc3ec509612f3cf82476beddd2aeb3da7bdc3a35726337a0cc838a4ef4" "e3c87e869f94af65d358aa279945a3daf46f8185f1a5756ca1c90759024593dd" "34c99997eaa73d64b1aaa95caca9f0d64229871c200c5254526d0062f8074693" "cb477d192ee6456dc2eb5ca5a0b7bd16bdb26514be8f8512b937291317c7b166" "fd944f09d4d0c4d4a3c82bd7b3360f17e3ada8adf29f28199d09308ba01cc092" "8db4b03b9ae654d4a57804286eb3e332725c84d7cdab38463cb6b97d5762ad26" "a28d89cf398c60dade1b0a7e3dce9d4691c236c05a050b7e6ba808bfce2622e1" "80365dd15f97396bdc38490390c23337063c8965c4556b8f50937e63b5e9a65c" "f0dc4ddca147f3c7b1c7397141b888562a48d9888f1595d69572db73be99a024" "6d589ac0e52375d311afaa745205abb6ccb3b21f6ba037104d71111e7e76a3fc" "9954ed41d89d2dcf601c8e7499b6bb2778180bfcaeb7cdfc648078b8e05348c6" "75d3dde259ce79660bac8e9e237b55674b910b470f313cdf4b019230d01a982a" "10461a3c8ca61c52dfbbdedd974319b7f7fd720b091996481c8fb1dded6c6116" "797f9204474ae55a3f65d2fc5fb28caf117bb7e0e3eaac58729a9edb38bf7f14" "256bd513a9875cd855077162cdfee8d75b0ad7e18fe8b8cbc10412561fbef892" default))
'(doom-themes-treemacs-theme "doom-colors")
'(elcord-use-major-mode-as-main-icon t)
'(evil-ex-search-highlight-all t)
'(evil-ex-search-persistent-highlight nil)
'(fci-rule-color "#5B6268")
'(flymake-proc-allowed-file-name-masks
'(("\"\\\\.ino\\\\\"" flymake-proc-simple-make-init nil nil)
("\\.\\(?:c\\(?:pp\\|xx\\|\\+\\+\\)?\\|CC\\)\\'" flymake-proc-simple-make-init nil flymake-proc-real-file-name-considering-includes)
("\\.xml\\'" flymake-proc-xml-init nil nil)
("\\.html?\\'" flymake-proc-xml-init nil nil)
("\\.cs\\'" flymake-proc-simple-make-init nil nil)
("\\.php[345]?\\'" flymake-proc-php-init nil nil)
("\\.h\\'" flymake-proc-master-make-header-init flymake-proc-master-cleanup nil)
("\\.java\\'" flymake-proc-simple-make-java-init flymake-proc-simple-java-cleanup nil)
("[0-9]+\\.tex\\'" flymake-proc-master-tex-init flymake-proc-master-cleanup nil)
("\\.tex\\'" flymake-proc-simple-tex-init nil nil)
("\\.idl\\'" flymake-proc-simple-make-init nil nil)))
'(jdee-db-active-breakpoint-face-colors (cons "#1B2229" "#51afef"))
'(jdee-db-requested-breakpoint-face-colors (cons "#1B2229" "#98be65"))
'(jdee-db-spec-breakpoint-face-colors (cons "#1B2229" "#3f444a"))
'(js-indent-level 2)
'(objed-cursor-color "#ff6c6b")
'(org-agenda-files '("~/Dotfiles/doom.d/config.org"))
'(package-selected-packages
'(moe-theme yaml-imenu tao-theme sane-term nginx-mode mingus lorem-ipsum insert-kaomoji hindent flycheck-yamllint emms crm-custom counsel-fd ada-mode))
'(pug-tab-width 2)
'(safe-local-variable-values
'((org-babel-default-header-args:elisp
(:results . "none"))))
'(vc-annotate-background "#282c34")
'(vc-annotate-color-map
(list
(cons 20 "#98be65")
(cons 40 "#b4be6c")
(cons 60 "#d0be73")
(cons 80 "#ECBE7B")
(cons 100 "#e6ab6a")
(cons 120 "#e09859")
(cons 140 "#da8548")
(cons 160 "#d38079")
(cons 180 "#cc7cab")
(cons 200 "#c678dd")
(cons 220 "#d974b7")
(cons 240 "#ec7091")
(cons 260 "#ff6c6b")
(cons 280 "#cf6162")
(cons 300 "#9f585a")
(cons 320 "#6f4e52")
(cons 340 "#5B6268")
(cons 360 "#5B6268")))
'(vc-annotate-very-old-color nil))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)

View File

@@ -0,0 +1,158 @@
#+TITLE: private/bindings Literate configuration
#+PROPERTY: header-args(elisp) :tangle config.el
* Introduction
This is the main document for this module (=private/bindings=).
To compile, simply execute the source code block below
#+BEGIN_SRC elisp :tangle no
(org-babel-tangle-file "README.org" "config.el")
#+END_SRC
* Initial
#+BEGIN_SRC elisp
;;; private/bindings/config.el -*- lexical-binding: t; -*-
#+END_SRC
* Leader
Bindings for the leader map
** Single binds
These are immediate bindings to the leader map that instantly launch functions when pressed.
This binding space is reserved for stuff I use quite often.
#+BEGIN_SRC elisp
(map!
:leader
"SPC" #'execute-extended-command
"!" #'async-shell-command
"T" #'eshell
"-" #'dired-jump
"_" #'dired-jump-other-window
";" #'eval-expression
"h" #'help-command
"w" #'ace-window)
#+END_SRC
** Files
#+BEGIN_SRC elisp
(map!
:leader
:prefix "f"
"r" #'counsel-recentf
"f" #'find-file
"p" #'(lambda () (interactive) (doom-project-find-file "~/Dotfiles"))
"s" #'save-buffer
"d" #'dired)
#+END_SRC
** Buffers
#+BEGIN_SRC elisp
(map!
:leader
:prefix "b"
"n" #'next-buffer
"p" #'previous-buffer
"d" #'kill-current-buffer
"b" #'switch-to-buffer
"i" #'ibuffer)
#+END_SRC
** Search
#+BEGIN_SRC elisp
(map!
:leader
:prefix "s"
"i" #'imenu
"o" #'+lookup/online
(:after counsel
"s" #'swiper
"r" #'counsel-rg)
(:after counsel-etags
"t" #'counsel-etags-find-tag))
#+END_SRC
** Projectile
#+BEGIN_SRC elisp
(map!
:leader
:after projectile
:desc "Switch to p-buffer" ">" #'projectile-switch-to-buffer
:desc "Projects" "p" #'projectile-switch-project
(:prefix ("p" . "project")
:desc "Regen tags" "g" #'projectile-regenerate-tags
:desc "Open project files" "f" #'projectile-find-file))
#+END_SRC
** Code
#+BEGIN_SRC elisp
(map!
:leader
:prefix ("c" . "code") ; Code
:desc "Compile" "c" #'compile
:desc "Compile via make" "m" #'+make/run
:desc "Undo tree" "u" #'undo-tree-visualize
(:after lsp
:desc "Format code lsp" "f" #'+default/lsp-format-region-or-buffer
:desc "Execute action" "a" #'lsp-execute-code-action))
#+END_SRC
** Magit and VC
#+BEGIN_SRC elisp
(map!
:leader
:prefix "g"
"g" #'magit-status
"c" #'magit-clone
"f" #'magit-fetch
"p" #'magit-pull)
#+END_SRC
** Notes
#+BEGIN_SRC elisp
(map!
:leader
:prefix ("n" . "notes")
:desc "Open notes in dired" "-" #'(lambda () (interactive) (dired org-directory))
:desc "Open quicknotes" "q" #'(lambda () (interactive) (find-file (format "%s/qnotes.org" org-directory))))
#+END_SRC
** Frames
#+BEGIN_SRC elisp
(map!
:leader
:prefix "F"
"d" #'delete-frame)
#+END_SRC
* Company
#+BEGIN_SRC elisp
(map!
:after company
:map company-active-map
"C-j" #'company-select-next
"C-k" #'company-select-previous
"C-SPC" #'company-complete)
#+END_SRC
* Multi cursors
Setup bindings for multi cursors.
As it's a motion based system, use the "gz" namespace.
#+BEGIN_SRC elisp
(map!
:prefix "g"
(:prefix "z"
"m" #'evil-mc-resume-cursors
"p" #'evil-mc-pause-cursors
"d" #'evil-mc-make-all-cursors
"j" #'evil-mc-make-cursor-move-next-line
"k" #'evil-mc-make-cursor-move-prev-line
"z" #'evil-mc-make-cursor-at-pos))
#+END_SRC
* Quit
Quit Emacs or restart it
#+BEGIN_SRC elisp
(map!
:prefix "q"
"q" #'save-buffers-kill-terminal
"r" #'doom/restart)
#+END_SRC
* Remaps
#+BEGIN_SRC elisp
(define-key!
[remap org-goto] #'counsel-org-goto)
#+END_SRC
* Misc
Misc bindings that don't fit to any other category.
#+BEGIN_SRC elisp
(map!
"C-x C-z" #'text-scale-adjust
"TAB" #'evil-jump-item
"M-c" #'count-words-region
"M-s" #'occur)
#+END_SRC

View File

@@ -0,0 +1,21 @@
;;; private/completion/config.el -*- lexical-binding: t; -*-
(map!
:map icomplete-minibuffer-map
;; unbind anything I want to use for useful stuff
"C-j" nil
"C-k" nil
"C-b" nil
"TAB" nil
"C-j" #'icomplete-forward-completions
"C-k" #'icomplete-backward-completions
"C-n" #'icomplete-forward-completions
"C-p" #'icomplete-backward-completions
"TAB" #'icomplete-force-complete
"C-b" #'completions)
(setq icomplete-separator "\t|\t")
(setq icomplete-in-buffer t)
(add-hook 'doom-first-input-hook #'icomplete-mode)

View File

@@ -0,0 +1,19 @@
#+TITLE: private/gentemplate
#+DATE: March 17, 2020
* Description
This module allows users to clone templates from my Github to specific machines.
These templates allow for quick and easy setup for languages or frameworks where
this sort of thing isn't very nice to do (for example C++).
This module is used through the main function =+gentemplate/generate-template=.
It will ask what template you want to use then where to put it, finally doing
the necessary work to get you that template. You may mutate the variables
=+gentemplate/template-list= and =+gentemplate/profile-url= to customise your
templates.
* Prerequisites
- git
* Requirements
- ivy
- magit
- cl

View File

@@ -0,0 +1,36 @@
;;; private/gentemplate/config.el -*- lexical-binding: t; -*-
(require 'cl-lib)
(defvar +gentemplate/profile-url
"https://github.com/oreodave/"
"Profile to download templates from on github.")
(defvar +gentemplate/template-list
(list "CTemplate" "CPPTemplate" "PythonTemplate" "NodeTemplate" "ArduinoTemplate" "JavaTemplate")
"List of templates to use, relative to the profile-url")
(defun +gentemplate/offline ()
(eq (cl-list-length (network-interface-list)) 1))
(defun +gentemplate/copy-template (template-name dest)
"Copy a template project via it's `template-name' to a folder called `dest'"
(copy-directory (expand-file-name (concat "~/Code/Templates/" template-name)) dest))
(after! (ivy magit-clone)
(defun +gentemplate/download-template (template-name dest)
"Download a given template via its `template-name' to the `dest' folder"
(magit-clone-regular (concat +gentemplate/profile-url template-name) dest nil))
(defun +gentemplate/generate-template ()
(interactive)
(ivy-read
"Enter template: "
+gentemplate/template-list
:action
(lambda (template-name)
(let ((dir (read-directory-name "Enter directory to download to: "))
(offline (+gentemplate/offline)))
(if offline
(+gentemplate/copy-template template-name dir)
(+gentemplate/download-template template-name dir)))))))

View File

@@ -0,0 +1,7 @@
#+TITLE: private/narrow
#+DATE: May 10, 2020
* Description
Minimal configuration for narrowing to function.
* Prerequisites
* Requirements

View File

@@ -0,0 +1,14 @@
;;; private/narrow/config.el -*- lexical-binding: t; -*-
(defvar +narrow/narrow-state 't "To narrow or not to narrow. Flips between t and nil")
(defun +narrow/toggle-narrow-state ()
"Toggle the state of +narrow/narrow-state between 't and 'nil"
(if (= +narrow/narrow-state 't)
(setq +narrow/narrow-state nil)
(setq +narrow/narrow-state 't)))
(defun +narrow/toggle-narrow ()
(interactive)
(cond ((+narrow/narrow-state) (narrow-to-defun) (+narrow/toggle-narrow-state))
(t (widen))))

View File

@@ -0,0 +1,16 @@
#+TITLE: private/ocaml
#+DATE: March 29, 2020
* Description
My own ocaml module. Has LSP support, which is well defined.
Pretty minimalist and allows for quick coding. Uses the terminal a lot so I'd
suggest using vterm as well for quick access to the terminal.
* Prerequisites
- ocaml compiler
- opam
- ocamllsp (from opam) (if LSP)
* Requirements
- lsp
- tuareg
- utop

View File

@@ -0,0 +1,20 @@
;;; private/ocaml/config.el -*- lexical-binding: t; -*-
(use-package! utop
:config
(map!
:localleader
:map tuareg-mode-map
:desc "Repl" "c" #'utop
(:prefix ("e" . "eval")
:desc "Buffer" "b" #'utop-eval-buffer
:desc "Region" "r" #'utop-eval-region)))
(when (featurep! +lsp)
(after! lsp
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection "ocamllsp")
:major-modes '(tuareg-mode)
:server-id 'ocaml-lsp))
(add-hook 'tuareg-mode-hook #'lsp!)))

View File

@@ -0,0 +1,6 @@
;; -*- no-byte-compile: t; -*-
;;; private/ocaml/packages.el
(package! tuareg)
(package! utop)

View File

@@ -0,0 +1,13 @@
#+TITLE: private/oreoline
#+DATE: March 29, 2020
* Description
My very own modeline. Minimalist, isn't particularly fancy but does the job.
Uses telephone line with some configuration. Has support for a light version as well.
Has LSP support as well as evil support (can present evil modes and LSP mode).
* Prerequisites
None
* Requirements
- telephone line
- evil-anzu

View File

@@ -0,0 +1,74 @@
;;; ui/telephone/config.el -*- lexical-binding: t; -*-
(use-package! telephone-line
:hook (after-init . telephone-line-mode)
:init
;; Faces
(defface +oreoline-accent-dark '((t (:foreground "black" :background "Cadet Blue" ))) "")
(defface +oreoline-evil-dark '((t (:foreground "white" :background "dark green" ))) "")
(defface +oreoline-evil-inactive '((t (:foreground "cornsilk" :background "gray26" ))) "")
(defface +oreoline-accent-light '((t (:foreground "black" :background "Light Slate Grey"))) "")
(defface +oreoline-evil-light '((t (:foreground "black" :background "Sky Blue" ))) "")
;; Set telephone line faces
(setq telephone-line-faces
'((evil . (+oreoline-evil-dark . +oreoline-evil-inactive))
(modal . telephone-line-modal-face)
(ryo . telephone-line-ryo-modal-face)
(accent . (+oreoline-accent-dark . telephone-line-accent-inactive))
(nil mode-line . mode-line-inactive)))
(when (featurep! +light)
(setq telephone-line-faces
'((evil . (+oreoline-evil-light . +oreoline-evil-inactive))
(modal . telephone-line-modal-face)
(ryo . telephone-line-ryo-modal-face)
(accent . (+oreoline-accent-light . telephone-line-accent-inactive))
(nil mode-line . mode-line-inactive))))
;; Seperators
(setq telephone-line-primary-left-separator 'telephone-line-abs-left
telephone-line-secondary-left-separator 'telephone-line-identity-hollow-left
telephone-line-primary-right-separator 'telephone-line-abs-right
telephone-line-secondary-right-separator 'telephone-line-identity-hollow-right)
;; LSP segment
(telephone-line-defsegment +oreoline-lsp-segment ()
(if (bound-and-true-p lsp-mode)
(propertize "")
(propertize "")))
;; Visual line check
(telephone-line-defsegment +oreoline-visual-segment ()
(if mark-active
(let ((lines (count-lines (region-beginning) (region-end)))
(chars (- (region-end) (region-beginning))))
(if (< lines 2)
(propertize (format "%sC" chars))
(propertize (format "%sL %sC" lines chars))))
(propertize "~")))
(setq
;; LHS
telephone-line-lhs
'((evil . (telephone-line-evil-tag-segment
telephone-line-buffer-modified-segment))
(accent . (telephone-line-filesize-segment
telephone-line-buffer-name-segment
telephone-line-erc-modified-channels-segment
telephone-line-process-segment))
(nil . ()))
;; RHS
telephone-line-rhs
'((nil . (telephone-line-misc-info-segment))
(accent . (telephone-line-vc-segment
+oreoline-lsp-segment
telephone-line-major-mode-segment
telephone-line-flycheck-segment))
(modal . (+oreoline-visual-segment))
(evil . (telephone-line-airline-position-segment))))
:config
(size-indication-mode +1))
(use-package! evil-anzu
:after-call evil-ex-start-search evil-ex-start-word-search evil-ex-search-activate-highlight)

View File

@@ -0,0 +1,5 @@
;; -*- no-byte-compile: t; -*-
;;; ui/telephone/packages.el
(package! telephone-line)
(package! evil-anzu)

View File

@@ -0,0 +1,13 @@
#+TITLE: private/rss
#+DATE: May 2, 2020
* Description
This module allows the manipulation and usage of the /newsticker/ system. This is a nice RSS reader inbuilt to Emacs.
Use =+rss/set-feed-urls= to set the urls for use in newsticker. Bind
=+rss/open-newsticker= =+rss/close-newsticker= to appropriate bindings.
* Prerequisites
None
* Requirements
- cl-lib
- newsticker

View File

@@ -0,0 +1,51 @@
;;; private/rss/config.el -*- lexical-binding: t; -*-
(require 'seq)
(require 'cl-lib)
(defvar +rss/feed-urls '(("Arch Linux" "https://www.archlinux.org/feeds/news/" Linux)
("LEMMiNO" "https://www.youtube.com/feeds/videos.xml?channel_id=UCRcgy6GzDeccI7dkbbBna3Q" YouTube)
("Gamer from Mars" "https://www.youtube.com/feeds/videos.xml?channel_id=UCJ6z_yj_dDNrhn-c8ZyKV4g" YouTube)
("Pop Culture Detective" "https://www.youtube.com/feeds/videos.xml?channel_id=UCHiwtz2tCEfS17N9A-WoSSw" YouTube)
("Dark Sominium" "https://www.youtube.com/feeds/videos.xml?channel_id=UC_e39rWdkQqo5-LbiLiU10g" YouTube Stories)
("Dark Sominium Music" "https://www.youtube.com/feeds/videos.xml?channel_id=UCkLiZ_zLynyNd5fd62hg1Kw" YouTube Music)
("Nexpo" "https://www.youtube.com/feeds/videos.xml?channel_id=UCpFFItkfZz1qz5PpHpqzYBw" YouTube)
("Techquickie" "https://www.youtube.com/feeds/videos.xml?channel_id=UC0vBXGSyV14uvJ4hECDOl0Q" YouTube)
("3B1B" "https://www.youtube.com/feeds/videos.xml?channel_id=UCYO_jab_esuFRV4b17AJtAw" YouTube)))
(when (featurep! +elfeed)
(after! elfeed
(setq elfeed-feeds (cl-map 'list (lambda (item) (append (list (nth 1 item)) (cdr (cdr item)))) +rss/feed-urls))))
(when (featurep! +newsticker)
(defun +rss/set-feed-urls (LIST)
"Set the newsticker-url-list to LIST. LIST should have format =(TAG URL START_TIME INTERVAL)="
(setq newsticker-url-list LIST))
(defun +rss/get-newsticker-buffers ()
"Using seq, filter the buffer list for newsticker buffers"
(seq-remove (lambda (buffer)
(not (and (cl-search "*Newsticker" (buffer-name buffer))
(= (cl-search "*Newsticker" (buffer-name buffer))))))
(buffer-list)))
(defun +rss/close-newsticker()
"Routine to close the newsticker system"
(interactive)
(newsticker-stop)
(dolist (buf (+rss/get-newsticker-buffers))
(kill-buffer buf))
(+workspace/delete "RSS"))
(use-package! newsticker
:config
(+rss/set-feed-urls ; Format is =(TAG URL START_TIME INTERVAL)=
(cl-map 'list (lambda (item) (list (nth 0 item) (nth 1 item) nil 3600)) +rss/feed-urls))
(defun +rss/open-newsticker ()
"Routine to start and open the newsticker"
(interactive)
(newsticker-start)
(+workspace/new "RSS")
(newsticker-treeview))))

View File

@@ -0,0 +1,4 @@
;; -*- no-byte-compile: t; -*-
;;; private/rss/packages.el
(package! elfeed)

View File

@@ -0,0 +1,10 @@
#+TITLE: private/startup
#+DATE: July 15, 2020
* Description
Basically setup the default Emacs mode-line and the scratch buffer for ease of use.
This replaces the =modeline= and =doom-dashboard= modules as it leverages the default Emacs utilities.
* Prerequisites
Emacs of some kind, preferably 27 just for the sake of preserving versioning.
* Requirements
None

View File

@@ -0,0 +1,14 @@
;;; private/startup/config.el -*- lexical-binding: t; -*-
(defun +startup/create-scratch-message ()
"Generate a string for the scratch buffer"
(format "Welcome to Emacs! (。◕‿◕。)
Load time was %s
Time of startup: %s"
(emacs-init-time)
(current-time-string (current-time))))
(add-hook 'doom-first-input-hook
#'(lambda ()
(setq-default mode-line-format (list "%l:%c %P \t %+%b(" '(:eval (format "%s" major-mode)) ") \t %I \t" vc-mode mode-line-end-spaces))
(setq-default initial-scratch-message (+startup/create-scratch-message))))

View File

@@ -0,0 +1,354 @@
#+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.
- Use it for most of my code editing and development needs.
- Incredibly versatile tool in my inventory.
* Initial setup
** Doom Variables
- Set the doom local-leader to "SPC ," because it's faster
- Good font choices:
- Hack
- Source Code Pro/Variable
- IBM Plex Mono
- Space Mono
- Z003 if I'm feeling fancy (▀̿Ĺ̯▀̿̿)
#+BEGIN_SRC elisp
(after! core-keybinds
(map! :leader "," nil)
(setq doom-localleader-key "SPC ,")
(setq doom-themes-enable-italic nil)
(setq doom-themes-enable-bold t)
(setq doom-theme 'doom-monokai-classic)
(setq doom-font (font-spec :family "Source Code Pro" :size 15)))
#+END_SRC
** Other variables
Some quality of life things and others that I couldn't really put in one category
- Using line-numbers that are relative now instead of nothing.
- Set org directory
- Add libgen to search providers
#+BEGIN_SRC elisp
(setq completion-ignore-case t
truncate-lines t
display-line-numbers-type t
bookmark-default-file (expand-file-name (concat doom-private-dir "bookmarks")))
(setq-default frame-title-format '("%b - Emacs"))
(add-to-list 'default-frame-alist '(alpha . 90))
(cl-pushnew '("Libgen" "http://gen.lib.rus.ec/search.php?req=%s") +lookup-provider-url-alist :key #'car :test 'string=)
#+END_SRC
** HACK: Load org mode again?
#+BEGIN_SRC elisp
(load (expand-file-name (concat user-emacs-directory "modules/lang/org/config.el")))
#+END_SRC
* Package Configuration
Configuration for or based heavily around specific packages that I find very important
** Ido
Just add vimish keybindings to ido completion
#+BEGIN_SRC elisp
(map!
:map (ido-common-completion-map ido-file-completion-map ido-buffer-completion-map)
"C-k" #'ido-prev-match
"C-j" #'ido-next-match)
(setq ido-ignore-buffers '("\\` " "^\\*ESS\\*" "^\\*[Hh]elp" "^\\*.*Completions\\*$" "^\\*tramp" "^\\*cvs-" "^*Ido"))
#+END_SRC
** DAP
*** Function
First to setup is a routine for setting up all the dap-panes for debugging.
Easier to do than just running all those functions manually
- Routine sets up the panes that I like to use, instead of M-x'ing it
- *<SPC>cD* starts up the routine
#+BEGIN_SRC elisp
(after! dap-mode
(defun dx:debug ()
(interactive)
(dap-ui-mode)
(dap-ui-locals)
(dap-ui-sessions)))
#+END_SRC
*** Keybind
#+BEGIN_SRC elisp
(map!
:after dap-mode
:leader
:desc "Start debugging setup" "cD" #'dx:debug)
#+END_SRC
** Spelling checker
Keybinds to org-mode for flyspell package
#+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
** Projectile
Add CMakeLists.txt to projectile-project-roots.
#+BEGIN_SRC elisp
(after! projectile
(cl-pushnew "CMakeLists.txt" projectile-project-root-files :test 'string=)
(setq projectile-tags-command
"ctags -e -R --exclude=dist --exclude=.ccls --exclude=.ccls-cache"))
#+END_SRC
** Prettify symbols
Configuration for the module (pretty-code).
*** Setup symbols
Some symbols aren't present in the current doom version, or my fonts are screwing up, so I wrote them here.
Maybe a bit of a bandage over broken glass, but at least it's something.
#+BEGIN_SRC elisp
(setq +pretty-code-symbols
'(:name "»"
:src_block "»"
:src_block_end "«"
:quote ""
:quote_end ""
:lambda "λ"
:def "ƒ"
:composition ""
:map ""
:null ""
:true "𝕋"
:false "𝔽"
:int ""
:float ""
:str "𝕊"
:bool "𝔹"
:not "¬"
:in ""
:not-in ""
:and ""
:or ""
:for ""
:some ""
:return ""
:yield ""
:tuple ""
:pipe "|"
:dot ""))
#+END_SRC
The 'x' symbol in the =+pretty-code-fira-code-font-ligatures= is annoying, and unneeded.
So I remove it.
#+BEGIN_SRC elisp
(assoc-delete-all "x" +pretty-code-fira-code-font-ligatures #'string=)
#+END_SRC
*** Pretty symbols
Setup pretty symbols specifically for C++.
I import the string type via `using std::string` which isn't supported in standard doom so I added support for it as well.
#+BEGIN_SRC elisp
(after! cc-mode
(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
** Calc
*** Configuration
#+BEGIN_SRC elisp
(use-package! calc
:config
(setq calc-angle-mode 'rad)
(map!
:leader
:desc "Calc" ":" #'calc))
#+END_SRC
** Dired and ranger
I like doing shell comamnds from dired, but I don't want Emacs to hang when doing them.
So, as '!' is a common use command and "&" is the async comamnd, I'll just switcheroo the "!" and "&" for their designated commands.
#+BEGIN_SRC elisp
(map!
:map dired-mode-map
:n "!" #'dired-do-async-shell-command
:n "&" #'dired-do-shell-command)
#+END_SRC
** Compilation
Add keybind to recompile (inside the buffer)
#+BEGIN_SRC elisp
(map!
(:map 'compilation-mode-map
:n "u" #'recompile))
#+END_SRC
** Company
#+BEGIN_SRC elisp
(add-hook
'company-mode-hook
#'(lambda () (setq company-frontends '(company-preview-frontend company-pseudo-tooltip-frontend))))
#+END_SRC
* Language Configuration
Configuration for various languages which I feel can be useful
** C-style languages
Configuration for C and C++.
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 . +))))
(setq c-default-style "user"))
#+END_SRC
** Python
Configuration for the Python language in doom
*** Set interpreter and flycheck to Python 3
I do python development for Python3 so I need to set the flycheck python checker, as well as the interpreter, to be Python3
#+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"))
#+END_SRC
*** Map to python-mode-map
Most of my python work is in scripts or ideas, so I don't need extensive testing utilities or anything like that
I adhere greatly to the REPL in python, so I need access to it often.
#+BEGIN_SRC elisp
(after! python
(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
** Org
Org configuration to maximise org workflow.
*** Org variables
Setup the agenda-files and the org-directory.
#+BEGIN_SRC elisp
(after! org
(add-hook 'org-mode-hook #'visual-line-mode)
(add-hook 'org-mode-hook #'org-toggle-latex-fragment)
(setq org-directory "~/Text"
org-agenda-files '("~/Text/")
org-src-window-setup 'split-window-right
org-superstar-headline-bullets-list '("" "" "" "")
org-log-repeat 'note))
#+END_SRC
*** Fragtog
#+BEGIN_SRC elisp
(use-package! org-fragtog
:config
(add-hook 'org-mode-hook #'org-fragtog-mode))
#+END_SRC
*** Thesaurus
Powerthesaurus installation, added a keybind in org-mode for looking up words.
#+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
*** Org keymap
- I like using org-export often, so bind it to a primary bind.
- Loading latex fragments is nice
#+BEGIN_SRC elisp
(map! ; Org keybinds
:after org
:map org-mode-map
:localleader
:desc "Org dispatch" "e" #'org-export-dispatch
:desc "Org LaTeX" "E" #'org-latex-export-as-latex)
#+END_SRC
** Haskell
Setup repl binds for Haskell
#+BEGIN_SRC elisp
(map!
:after haskell-mode
:map haskell-mode-map
:localleader
"l" #'haskell-process-load-file
"r" #'haskell-process-reload
"o" #'haskell-process-start)
#+END_SRC
** Sxhkd
Define a major-mode for sxhkd config files.
#+BEGIN_SRC elisp
(define-generic-mode sxhkd-mode
'(?#)
'("alt" "Escape" "super" "bspc" "ctrl" "space" "shift" "hyper" "XF86*")
'("{" "}")
'("sxhkdrc")
nil
"Simple mode for sxhkdrc files.")
#+END_SRC
* Key-map
General keymap
** 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 "Convert auto-fill" "f" #'dx:org/fill-to-long-lines
:desc "Change theme" "t" #'dx:themes/set-new-theme ; From my own collection
:desc "Generate template" "g" #'+gentemplate/generate-template) ; From my own collection
#+END_SRC
** Remaps
Adding a new configuration option.
Remapping functions that other modules set to default functions.
#+BEGIN_SRC elisp
(define-key!
[remap compile] #'compile)
#+END_SRC
** Non-leader
Non-leader bindings for text-based commands.
#+BEGIN_SRC elisp
(map!
"M-v" #'dx:newline
"M-V" #'(lambda () (interactive) (dx:newline 1)))
#+END_SRC

View File

@@ -0,0 +1,105 @@
#+TITLE: Literate configuration (NO LONGER IN USE)
* 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.
/Note/: My current literate system now uses the =org-babel-load*= functions to handle most of the hard work.
It's easier to use and manage, and I just don't use that many org files anymore so no need for such a big setup.
* Constants
Initialise some basic constants for where stuff is.
- literate/bin-dir: Where to compile to
- literate/preloaded-files: Relative to ~$DOOM~, which files are already
preloaded/don't need to be compiled
#+BEGIN_SRC elisp
(defconst dx:literate/bin-dir (expand-file-name (concat doom-private-dir "bin/")) "Directory to store elisp compiled files")
(defconst dx:literate/load-files '("~/.doom.d/org/personal.org") "Files to load after compilation")
(defconst dx:literate/directory (expand-file-name (concat doom-private-dir "org/")) "Directory to get org files from")
#+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 dx: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 dx:literate/destination(SRC)
"Parse a src.org file to a bin/src.el file"
(replace-regexp-in-string ".*/\\(\\w+\\).org"
(expand-file-name (concat dx:literate/bin-dir "\\1.el")) SRC))
#+END_SRC
* Parser
** Tangle function
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 dx: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
(async-shell-command
(concat "emacs "
"-q " "--batch "
"-l " "ob-tangle "
"--eval "
(format "'(org-babel-tangle-file %S %S)'" SRC DEST))
"*org-tangle-messages*"
"*org-tangle-errors*"))))))
#+END_SRC
** Popup rules
I don't want Emacs to focus onto the output buffer of the tangling process when I save, which is what happens with a standard async-shell-command.
So setup a rule for the 'messages' and 'errors' buffers to not focus them (by setting their time to live to 0).
#+BEGIN_SRC elisp
(set-popup-rule! "\*org-tangle-.*" :ttl 0 :quit t)
#+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 dx:literate/compile-hook ()
"Any org file within $DOOM/org will be compiled on save"
(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 "org")))
(not (string= buffer-file-name (expand-file-name (concat doom-private-dir "README.org")))))
(dx:literate/tangle buffer-file-name (dx:literate/destination buffer-file-name))))
(after! org
(add-hook 'after-save-hook #'dx: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 dx:literate/tangle-all (&optional location)
"Tangle all org files in `location' to el files in the `destination'"
(interactive)
(or location (setq location doom-private-dir))
(message "Starting compilation process")
(let ((files (directory-files-recursively location ".org")))
(dolist (file files)
(message "Compiling and parsing %s" file)
(dx:literate/tangle file (dx:literate/destination file)))))
#+END_SRC
* Load configuration
Final step of the literate cycle: load the config for the first time. Load any org files in =dx:literate/load-files=.
#+BEGIN_SRC elisp
(dolist (file dx:literate/load-files)
(load (dx:literate/destination file)))
#+END_SRC

View File

@@ -0,0 +1,59 @@
#+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
** 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
* Org-mode
** Fragtog
Fragtog allows for latex segments to be instantly compiled and only when you hover over them will you get the code, similar to prettify-symbols.
#+BEGIN_SRC elisp
(package! org-fragtog :recipe (:host github :repo "io12/org-fragtog"))
#+END_SRC
* Coding
** Tags
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 use 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
** YAML
YAML packages which I think would be cool to use:
- yaml-mode is just necessary as you can't edit without coloring (in my opinion)
- yaml-imenu is a cool package for large yaml files
- flycheck-yamllint is a nice little package which
#+BEGIN_SRC elisp
(package! yaml-mode)
(package! yaml-imenu)
(package! flycheck-yamllint)
#+END_SRC

View File

@@ -0,0 +1,101 @@
#+TITLE: Personal module
* Preclude
Personal functionality or variables that aid my workflow or are just cool.
* Variables
Some user variables
#+BEGIN_SRC elisp
(setq user-full-name "Aryadev Chavali"
user-mail-address "aryadevchavali1@gmail.com")
#+END_SRC
* Change theme
Allow user to set a theme from a limited set of candidates, based on "dx: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/doom-monokai-classic: 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:
- Light themes other than solarized-light and acario
- Horrid low contrast ones with no colour. Grayscale particularly. I can't
handle those.
#+BEGIN_SRC elisp
(setq dx:themes/theme-list '(doom-solarized-dark
doom-gruvbox
doom-molokai
doom-monokai-classic
doom-solarized-light
doom-acario-light))
(defun dx:themes/set-new-theme ()
"Set the theme from my own selection, mutate as you see fit"
(interactive)
(let ((theme (completing-read "Select theme: " dx:themes/theme-list)))
(condition-case nil
(progn
(mapc #'disable-theme custom-enabled-themes)
(load-theme (intern theme) t)
(when (fboundp 'powerline-reset)
(powerline-reset)))
(error "Problem loading theme %s" theme))))
#+END_SRC
* Password store
Function to get a password given a key.
#+BEGIN_SRC elisp
(defun dx:password-store/get-password (KEY)
(shell-command-to-string (concat "pass " KEY)))
#+END_SRC
* Insert newlines without o/O
Insert a newline without having to exit normal mode!
#+BEGIN_SRC elisp
(defun dx:newline (&optional BACKWARD)
(interactive)
(message "%s" BACKWARD)
(let ((old (point)))
(cond ((and BACKWARD (= BACKWARD 1)) (+default/newline-above))
(t (+default/newline-below)))
(goto-char (+ old 1))
(evil-normal-state)))
#+END_SRC
* Convert auto-fill lines to long truncate-lines
Consider some org file with auto filled lines.
I don't like auto-filled lines.
So I want to convert them.
I've setup macros countless times to do this operation for me, may as well formalize it as a function.
Firstly, I need a function to count the number of instances of some substring occur in some other string.
Shamelessly copied from rosetta code.
#+BEGIN_SRC elisp
(defun dx:org/count-sub (str pat)
(loop with z = 0 with s = 0 while s do
(when (setf s (cl-search pat str :start2 s))
(incf z) (incf s (length pat)))
finally (return z)))
#+END_SRC
Then the main function, works like so:
1) Search the text in the region for newlines then join the lines to make a single segment
2) Search for sentences through Emacs builtin =forward-sentence= and =forward-char= functions then newline via sentences
#+BEGIN_SRC elisp
(defun dx:org/fill-to-long-lines ()
(interactive)
(let* ((beg (region-beginning))
(end (region-end))
(region-text (buffer-substring-no-properties beg end))
(n-sentences (dx:org/count-sub region-text "."))
(parsed-text (apply #'concatenate 'string (cl-loop for c from beg to end collect
(if (string= (buffer-substring-no-properties c (+ c 1)) "\n") " "
(buffer-substring-no-properties c (+ c 1)))))))
(delete-region beg end)
(insert parsed-text)
(message "%s" n-sentences)
(evil-normal-state)
(evil-digit-argument-or-evil-beginning-of-line)
(cl-loop for i from 1 to n-sentences do (forward-sentence) (forward-char) (newline))))
#+END_SRC

View File

@@ -0,0 +1,4 @@
;; -*- no-byte-compile: t; -*-
;;; ~/.doom.d/packages.el
(org-babel-load-file (expand-file-name (concat doom-private-dir "org/packages.org")))

View File

@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: For_reverse
# key: forr
# --
for (${1:int} ${2:i} = ${3:sz}; $2 >= ${4:0}; --$2) {
$0
}

View File

@@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: class ... { ... }
# key: class
# --
${1:public} class ${2:Name}
{
$0
}

View File

@@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: Foreach loop
# key: foreach
# condition: t
# --
foreach (${1:var} ${2:i} in ${3:collection})
{
$0
}

View File

@@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: public void Method { ... }
# key: method
# --
${1:public} ${2:void} ${3:Method}(${4:int x})
{
${0:return x;}
}

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: /// <param>...</param>
# key: comment
# --
/// <param name="$1">$0</param>

View File

@@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: property ... ... { ... }
# key: prop
# condition: t
# --
public ${1:int} ${2:property} { get; set; }$0

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: /// <returns>...</returns>
# key: comment
# --
/// <returns>$0</returns>

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: author
# key: <au
# --
#+AUTHOR: $1

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: date
# key: <da
# --
#+DATE: ${1:Year}:${2:month}:${3:day}

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: description
# key: desc
# --
#+DESCRIPTION: ${1:description of your org-mode file}

View File

@@ -0,0 +1,10 @@
# -*- mode: snippet -*-
# name: img
# key: img_
# --
<img src="$1"
alt="$2" align="${3:left}"
title="${4:image title}"
class="img"
</img>
$0

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: include
# key: <i
# --
#+INCLUDE: $1

View File

@@ -0,0 +1,14 @@
# -*- mode: snippet -*-
# name: Review template
# key: REVIEW
# --
#+TITLE: $1
* Short description
$0
* Where and when did I hear about $1?
* What did I like about $1?
* What did I dislike about $1?
* Conclusion
* Rating

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: Title
# key: <ti
# --
#+TITLE: ${1:What the hell}

View File

@@ -0,0 +1,19 @@
# -*- mode: snippet -*-
# name: New component
# key: rce
# --
import React, { Component } from 'react';
class $1 extends Component {
state = {};
render() {
return (
<div>
$0
</div>
)
}
}
export default $1