Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 505f6f67db |
@@ -1,149 +0,0 @@
|
|||||||
;;; $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 "Max Regan"
|
|
||||||
user-mail-address "mgregan2@gmail.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
|
|
||||||
;;
|
|
||||||
;; 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-1337)
|
|
||||||
|
|
||||||
;; 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 t)
|
|
||||||
|
|
||||||
;; 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!
|
|
||||||
(setq org-directory "~/org/")
|
|
||||||
|
|
||||||
;; 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.
|
|
||||||
|
|
||||||
(after! lsp-ui
|
|
||||||
;; sideline is super noisy
|
|
||||||
(setq lsp-ui-sideline-enable nil))
|
|
||||||
|
|
||||||
(after! org-journal
|
|
||||||
(setq org-journal-dir "~/org/journal/"))
|
|
||||||
|
|
||||||
(after! counsel
|
|
||||||
(ivy-rich-mode 1)
|
|
||||||
(all-the-icons-ivy-rich-mode 1))
|
|
||||||
|
|
||||||
(use-package! mgr-gitlab
|
|
||||||
:load-path "lisp/mgr-gitlab"
|
|
||||||
:ensure t
|
|
||||||
:config
|
|
||||||
(setq gitlab-host "https://gitlab.maxregan.me"
|
|
||||||
gitlab-token-id (if (file-exists-p mgr-gitlab-token-file)
|
|
||||||
(with-temp-buffer
|
|
||||||
(insert-file-contents mgr-gitlab-token-file)
|
|
||||||
(string-trim (buffer-string)))
|
|
||||||
nil)
|
|
||||||
dashboard-projects-backend 'projectile
|
|
||||||
dashboard-items '((mgr-gitlab-gitlab-projects . 10)
|
|
||||||
(recents . 5)
|
|
||||||
(agenda . 5)
|
|
||||||
(projects . 5))))
|
|
||||||
|
|
||||||
(use-package! persp-mode
|
|
||||||
:config
|
|
||||||
(setq persp-emacsclient-init-frame-behaviour-override "main"))
|
|
||||||
|
|
||||||
;; Hey doom, +ivy/compile is worse, give me projectile-compile-project back
|
|
||||||
(define-key (current-global-map) [remap projectile-compile-project] 'projectile-compile-project)
|
|
||||||
|
|
||||||
(use-package! denote
|
|
||||||
:config (setq denote-known-keywords '("meta" "emacs")
|
|
||||||
denote-directory "~/notes/denote"))
|
|
||||||
|
|
||||||
(use-package! uniquify
|
|
||||||
:config
|
|
||||||
(setq uniquify-buffer-name-style 'post-forward))
|
|
||||||
|
|
||||||
(use-package! clipetty
|
|
||||||
:config (global-clipetty-mode 1))
|
|
||||||
|
|
||||||
(use-package! vterm
|
|
||||||
:config
|
|
||||||
(push '("magit" magit) vterm-eval-cmds)
|
|
||||||
(push '("compile" compile) vterm-eval-cmds))
|
|
||||||
|
|
||||||
(use-package! with-editor
|
|
||||||
:config
|
|
||||||
(add-hook 'shell-mode-hook 'with-editor-export-editor)
|
|
||||||
(add-hook 'eshell-mode-hook 'with-editor-export-editor)
|
|
||||||
(add-hook 'term-exec-hook 'with-editor-export-editor)
|
|
||||||
(add-hook 'vterm-exec-hook 'with-editor-export-editor))
|
|
||||||
|
|
||||||
;; Utils for pinning buffers in windows. This is useful for compilation and shells.
|
|
||||||
|
|
||||||
(defun dedicate-window ()
|
|
||||||
(interactive)
|
|
||||||
(set-window-dedicated-p (get-buffer-window) t))
|
|
||||||
|
|
||||||
(defun undedicate-window ()
|
|
||||||
(interactive)
|
|
||||||
(set-window-dedicated-p (get-buffer-window) nil))
|
|
||||||
|
|
||||||
(defun disable-format-on-save ()
|
|
||||||
(interactive)
|
|
||||||
(format-all-mode -1))
|
|
||||||
|
|
||||||
;; Load optional site-specific config (e.g. work profiles)
|
|
||||||
(if (file-exists-p "~/.doom-site/config.el")
|
|
||||||
(load-file "~/.doom-site/config.el"))
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
(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
|
|
||||||
["#282c34" "#ff6c6b" "#98be65" "#ECBE7B" "#51afef" "#c678dd" "#46D9FF" "#bbc2cf"])
|
|
||||||
'(custom-safe-themes
|
|
||||||
'("835868dcd17131ba8b9619d14c67c127aa18b90a82438c8613586331129dda63" "246a9596178bb806c5f41e5b571546bb6e0f4bd41a9da0df5dfbca7ec6e2250c" default))
|
|
||||||
'(exwm-floating-border-color "#191b20")
|
|
||||||
'(fci-rule-color "#5B6268")
|
|
||||||
'(highlight-tail-colors
|
|
||||||
((("#333a38" "#99bb66" "green")
|
|
||||||
. 0)
|
|
||||||
(("#2b3d48" "#46D9FF" "brightcyan")
|
|
||||||
. 20)))
|
|
||||||
'(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"))
|
|
||||||
'(objed-cursor-color "#ff6c6b")
|
|
||||||
'(pdf-view-midnight-colors (cons "#bbc2cf" "#282c34"))
|
|
||||||
'(rustic-ansi-faces
|
|
||||||
["#282c34" "#ff6c6b" "#98be65" "#ECBE7B" "#51afef" "#c678dd" "#46D9FF" "#bbc2cf"])
|
|
||||||
'(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.
|
|
||||||
)
|
|
||||||
201
.doom.d/init.el
201
.doom.d/init.el
@@ -1,201 +0,0 @@
|
|||||||
;;; init.el -*- lexical-binding: t; -*-
|
|
||||||
|
|
||||||
;; This file controls what Doom modules are enabled and what order they load
|
|
||||||
;; in. Remember to run 'doom sync' after modifying it!
|
|
||||||
|
|
||||||
;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's
|
|
||||||
;; documentation. There you'll find a link to Doom's Module Index where all
|
|
||||||
;; of our modules are listed, including what flags they support.
|
|
||||||
|
|
||||||
;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or
|
|
||||||
;; 'C-c c k' for non-vim users) to view its documentation. This works on
|
|
||||||
;; flags as well (those symbols that start with a plus).
|
|
||||||
;;
|
|
||||||
;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its
|
|
||||||
;; directory (for easy access to its source code).
|
|
||||||
|
|
||||||
(doom! :input
|
|
||||||
;;bidi ; (tfel ot) thgir etirw uoy gnipleh
|
|
||||||
;;chinese
|
|
||||||
;;japanese
|
|
||||||
;;layout ; auie,ctsrnm is the superior home row
|
|
||||||
|
|
||||||
:completion
|
|
||||||
company ; the ultimate code completion backend
|
|
||||||
;;helm ; the *other* search engine for love and life
|
|
||||||
;;ido ; the other *other* search engine...
|
|
||||||
;;ivy ; a search engine for love and life
|
|
||||||
vertico ; the search engine of the future
|
|
||||||
|
|
||||||
:ui
|
|
||||||
;;deft ; notational velocity for Emacs
|
|
||||||
doom ; what makes DOOM look the way it does
|
|
||||||
;;doom-dashboard ; a nifty splash screen for Emacs
|
|
||||||
;;doom-quit ; DOOM quit-message prompts when you quit Emacs
|
|
||||||
(emoji
|
|
||||||
+unicode
|
|
||||||
+github
|
|
||||||
+ascii) ; 🙂
|
|
||||||
hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
|
|
||||||
;;hydra
|
|
||||||
;;indent-guides ; highlighted indent columns
|
|
||||||
;;ligatures ; ligatures and symbols to make your code pretty again
|
|
||||||
;;minimap ; show a map of the code on the side
|
|
||||||
modeline ; snazzy, Atom-inspired modeline, plus API
|
|
||||||
;;nav-flash ; blink cursor line after big motions
|
|
||||||
;;neotree ; a project drawer, like NERDTree for vim
|
|
||||||
ophints ; highlight the region an operation acts on
|
|
||||||
(popup +defaults) ; tame sudden yet inevitable temporary windows
|
|
||||||
;;tabs ; a tab bar for Emacs
|
|
||||||
;;treemacs ; a project drawer, like neotree but cooler
|
|
||||||
unicode ; extended unicode support for various languages
|
|
||||||
vc-gutter ; vcs diff in the fringe
|
|
||||||
vi-tilde-fringe ; fringe tildes to mark beyond EOB
|
|
||||||
window-select ; visually switch windows
|
|
||||||
workspaces ; tab emulation, persistence & separate workspaces
|
|
||||||
;;zen ; distraction-free coding or writing
|
|
||||||
|
|
||||||
:editor
|
|
||||||
;;(evil +everywhere); come to the dark side, we have cookies
|
|
||||||
;; file-templates ; auto-snippets for empty files
|
|
||||||
fold ; (nigh) universal code folding
|
|
||||||
;;(format +onsave) ; automated prettiness
|
|
||||||
;;god ; run Emacs commands without modifier keys
|
|
||||||
;;lispy ; vim for lisp, for people who don't like vim
|
|
||||||
;;multiple-cursors ; editing in many places at once
|
|
||||||
;;objed ; text object editing for the innocent
|
|
||||||
;;parinfer ; turn lisp into python, sort of
|
|
||||||
;;rotate-text ; cycle region at point between text candidates
|
|
||||||
snippets ; my elves. They type so I don't have to
|
|
||||||
word-wrap ; soft wrapping with language-aware indent
|
|
||||||
|
|
||||||
:emacs
|
|
||||||
(dire + icons) ; making dired pretty [functional]
|
|
||||||
electric ; smarter, keyword-based electric-indent
|
|
||||||
;;ibuffer ; interactive buffer management
|
|
||||||
undo ; persistent, smarter undo for your inevitable mistakes
|
|
||||||
vc ; version-control and Emacs, sitting in a tree
|
|
||||||
|
|
||||||
:term
|
|
||||||
eshell ; the elisp shell that works everywhere
|
|
||||||
;;shell ; simple shell REPL for Emacs
|
|
||||||
;;term ; basic terminal emulator for Emacs
|
|
||||||
vterm ; the best terminal emulation in Emacs
|
|
||||||
|
|
||||||
:checkers
|
|
||||||
syntax ; tasing you for every semicolon you forget
|
|
||||||
;;(spell +flyspell) ; tasing you for misspelling mispelling
|
|
||||||
;;grammar ; tasing grammar mistake every you make
|
|
||||||
|
|
||||||
:tools
|
|
||||||
;;ansible
|
|
||||||
;;biblio ; Writes a PhD for you (citation needed)
|
|
||||||
debugger ; FIXME stepping through code, to help you add bugs
|
|
||||||
;;direnv
|
|
||||||
docker
|
|
||||||
editorconfig ; let someone else argue about tabs vs spaces
|
|
||||||
;;ein ; tame Jupyter notebooks with emacs
|
|
||||||
(eval +overlay) ; run code, run (also, repls)
|
|
||||||
;;gist ; interacting with github gists
|
|
||||||
lookup ; navigate your code and its documentation
|
|
||||||
lsp ; M-x vscode
|
|
||||||
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
|
|
||||||
;;taskrunner ; taskrunner for all your projects
|
|
||||||
;;terraform ; infrastructure as code
|
|
||||||
;;tmux ; an API for interacting with tmux
|
|
||||||
;;tree-sitter ; syntax and parsing, sitting in a tree...
|
|
||||||
;;upload ; map local to remote projects via ssh/ftp
|
|
||||||
|
|
||||||
:os
|
|
||||||
(:if IS-MAC macos) ; improve compatibility with macOS
|
|
||||||
(tty +osc) ; improve the terminal Emacs experience
|
|
||||||
|
|
||||||
:lang
|
|
||||||
;;agda ; types of types of types of types...
|
|
||||||
;;beancount ; mind the GAAP
|
|
||||||
(cc +lsp) ; C > C++ == 1
|
|
||||||
;;clojure ; java with a lisp
|
|
||||||
;;common-lisp ; if you've seen one lisp, you've seen them all
|
|
||||||
;;coq ; proofs-as-programs
|
|
||||||
;;crystal ; ruby at the speed of c
|
|
||||||
;;csharp ; unity, .NET, and mono shenanigans
|
|
||||||
;;data ; config/data formats
|
|
||||||
(dart +flutter) ; paint ui and not much else
|
|
||||||
;;dhall
|
|
||||||
;;elixir ; erlang done right
|
|
||||||
;;elm ; care for a cup of TEA?
|
|
||||||
emacs-lisp ; drown in parentheses
|
|
||||||
;;erlang ; an elegant language for a more civilized age
|
|
||||||
;;ess ; emacs speaks statistics
|
|
||||||
;;factor
|
|
||||||
;;faust ; dsp, but you get to keep your soul
|
|
||||||
;;fortran ; in FORTRAN, GOD is REAL (unless declared INTEGER)
|
|
||||||
;;fsharp ; ML stands for Microsoft's Language
|
|
||||||
;;fstar ; (dependent) types and (monadic) effects and Z3
|
|
||||||
;;gdscript ; the language you waited for
|
|
||||||
;;(go +lsp) ; the hipster dialect
|
|
||||||
;;(graphql +lsp) ; Give queries a REST
|
|
||||||
;;(haskell +lsp) ; a language that's lazier than I am
|
|
||||||
;;hy ; readability of scheme w/ speed of python
|
|
||||||
;;idris ; a language you can depend on
|
|
||||||
json ; At least it ain't XML
|
|
||||||
;;(java +lsp) ; the poster child for carpal tunnel syndrome
|
|
||||||
;;javascript ; all(hope(abandon(ye(who(enter(here))))))
|
|
||||||
;;julia ; a better, faster MATLAB
|
|
||||||
;;kotlin ; a better, slicker Java(Script)
|
|
||||||
;;latex ; writing papers in Emacs has never been so fun
|
|
||||||
;;lean ; for folks with too much to prove
|
|
||||||
;;ledger ; be audit you can be
|
|
||||||
;;lua ; one-based indices? one-based indices
|
|
||||||
markdown ; writing docs for people to ignore
|
|
||||||
;;nim ; python + lisp at the speed of c
|
|
||||||
;;nix ; I hereby declare "nix geht mehr!"
|
|
||||||
;;ocaml ; an objective camel
|
|
||||||
org ; organize your plain life in plain text
|
|
||||||
;;php ; perl's insecure younger brother
|
|
||||||
;;plantuml ; diagrams for confusing people more
|
|
||||||
;;purescript ; javascript, but functional
|
|
||||||
python ; beautiful is better than ugly
|
|
||||||
;;qt ; the 'cutest' gui framework ever
|
|
||||||
;;racket ; a DSL for DSLs
|
|
||||||
;;raku ; the artist formerly known as perl6
|
|
||||||
;;rest ; Emacs as a REST client
|
|
||||||
;;rst ; ReST in peace
|
|
||||||
;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
|
|
||||||
(rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
|
|
||||||
;;scala ; java, but good
|
|
||||||
;;(scheme +guile) ; a fully conniving family of lisps
|
|
||||||
sh ; she sells {ba,z,fi}sh shells on the C xor
|
|
||||||
;;sml
|
|
||||||
;;solidity ; do you need a blockchain? No.
|
|
||||||
;;swift ; who asked for emoji variables?
|
|
||||||
;;terra ; Earth and Moon in alignment for performance.
|
|
||||||
;;web ; the tubes
|
|
||||||
yaml ; JSON, but readable
|
|
||||||
;;zig ; C, but simpler
|
|
||||||
|
|
||||||
:email
|
|
||||||
;;(mu4e +org +gmail)
|
|
||||||
;;notmuch
|
|
||||||
;;(wanderlust +gmail)
|
|
||||||
|
|
||||||
:app
|
|
||||||
;;calendar
|
|
||||||
;;emms
|
|
||||||
;;everywhere ; *leave* Emacs!? You must be joking
|
|
||||||
;;irc ; how neckbeards socialize
|
|
||||||
;;(rss +org) ; emacs as an RSS reader
|
|
||||||
;;twitter ; twitter client https://twitter.com/vnought
|
|
||||||
|
|
||||||
:config
|
|
||||||
;;literate
|
|
||||||
(default +bindings +smartparens))
|
|
||||||
|
|
||||||
;; Load optional site-specific config (e.g. work profiles)
|
|
||||||
(if (file-exists-p "~/.doom-site/init.el")
|
|
||||||
(load-file "~/.doom-site/init.el"))
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
;;; mgr-gitlab.el --- Description -*- lexical-binding: t; -*-
|
|
||||||
;;
|
|
||||||
;; Copyright (C) 2022 Max Regan
|
|
||||||
;;
|
|
||||||
;; Author: Max Regan <https://github.com/reganmax>
|
|
||||||
;; Maintainer: Max Regan <reganmax@amazon.com>
|
|
||||||
;; Created: March 17, 2022
|
|
||||||
;; Modified: March 17, 2022
|
|
||||||
;; Version: 0.0.1
|
|
||||||
;; Keywords: abbrev bib c calendar comm convenience data docs emulations extensions faces files frames games hardware help hypermedia i18n internal languages lisp local maint mail matching mouse multimedia news outlines processes terminals tex tools unix vc wp
|
|
||||||
;; Homepage: https://github.com/reganmax/mgr-gitlab
|
|
||||||
;; Package-Requires: ((emacs "27.1"))
|
|
||||||
;;
|
|
||||||
;; This file is not part of GNU Emacs.
|
|
||||||
;;
|
|
||||||
;;; Commentary:
|
|
||||||
;;
|
|
||||||
;; Description: My personal configuration for Gitlab
|
|
||||||
;;
|
|
||||||
;;; Code:
|
|
||||||
|
|
||||||
(require 'gitlab)
|
|
||||||
(require 'dashboard)
|
|
||||||
(require 'projectile)
|
|
||||||
(require 'seq)
|
|
||||||
|
|
||||||
(defvar mgr-gitlab-project-path "~/repos/" "The location into which gitlab projects will be cloned.")
|
|
||||||
(defvar mgr-gitlab-token-file "~/.gitlab_token" "The location into which gitlab projects will be cloned.")
|
|
||||||
|
|
||||||
(defun mgr-gitlab-list-remote-project-names ()
|
|
||||||
"Return a list of all of the project names on the remote server."
|
|
||||||
(seq-map (lambda (el) (alist-get 'name el)) (gitlab-list-all-projects)))
|
|
||||||
|
|
||||||
(defun mgr-gitlab-list-local-project-names ()
|
|
||||||
"Return a list of all of the project names in the mgr-gitlab-project-path."
|
|
||||||
(seq-remove #'file-directory-p (directory-files mgr-gitlab-project-path)))
|
|
||||||
|
|
||||||
(defun mgr-gitlab--get-project-by-name (name)
|
|
||||||
"Return the alist for the project named NAME."
|
|
||||||
(seq-find (lambda (el) (string-equal (alist-get 'name el) name)) (gitlab-list-projects)))
|
|
||||||
|
|
||||||
(defun mgr-gitlab--get-id-for-name (name)
|
|
||||||
"Return an ID for a given project NAME."
|
|
||||||
(alist-get 'id (mgr-gitlab--get-project-by-name name)))
|
|
||||||
|
|
||||||
(defun mgr-gitlab-clone (name)
|
|
||||||
"Clone the project NAME."
|
|
||||||
;; TODO: Clone with API token, if there is one
|
|
||||||
(interactive
|
|
||||||
(list (completing-read "Project: " (mgr-gitlab-list-remote-project-names))))
|
|
||||||
(let* ((url (mgr-gitlab--get-url-by-name name))
|
|
||||||
(dest mgr-gitlab-project-path))
|
|
||||||
(setf magit-clone-set-remote.pushDefault t)
|
|
||||||
(magit-clone-regular url dest nil)))
|
|
||||||
|
|
||||||
(defun mgr-gitlab-clone-all ()
|
|
||||||
"Clone all projects in Gitlab, iteratively."
|
|
||||||
(interactive)
|
|
||||||
(seq-do (lambda (name)
|
|
||||||
(if (not (seq-contains-p (mgr-gitlab-list-local-project-names) name))
|
|
||||||
(progn
|
|
||||||
(message (format "Cloning %s..." name))
|
|
||||||
(mgr-gitlab-clone name))
|
|
||||||
(message (format "Skipping %s." name))))
|
|
||||||
(mgr-gitlab-list-remote-project-names)))
|
|
||||||
|
|
||||||
(defun mgr-gitlab--get-url-by-name (name)
|
|
||||||
"Return a fixed-up repository url for the given project NAME.
|
|
||||||
This also fixes up the capitalization in the project name that
|
|
||||||
gitlab so kindly removes."
|
|
||||||
(let* ((repo (mgr-gitlab--get-project-by-name name))
|
|
||||||
(orig-url (alist-get 'http_url_to_repo repo)))
|
|
||||||
(concat (mapconcat 'identity (butlast (split-string orig-url "/")) "/")
|
|
||||||
"/"
|
|
||||||
name
|
|
||||||
".git")))
|
|
||||||
|
|
||||||
(defun mgr-gitlab-dashboard-insert-gitlab-projects (list-size)
|
|
||||||
"A custom dashboard.el widget to display LIST-SIZE gitlab projects."
|
|
||||||
(dashboard-insert-section
|
|
||||||
"Gitlab Projects:"
|
|
||||||
(cl-map 'list (lambda (el) (alist-get 'name el)) (gitlab-list-all-projects))
|
|
||||||
list-size
|
|
||||||
'projects
|
|
||||||
"P"
|
|
||||||
`(lambda (&rest _)
|
|
||||||
(let ((dir (concat mgr-gitlab-project-path ,el)))
|
|
||||||
(if (not (file-directory-p dir))
|
|
||||||
(mgr-gitlab-clone ,el))
|
|
||||||
(magit-status (concat mgr-gitlab-project-path ,el))))
|
|
||||||
(format "%s" el)))
|
|
||||||
|
|
||||||
(add-to-list 'dashboard-item-generators '(mgr-gitlab-gitlab-projects . mgr-gitlab-dashboard-insert-gitlab-projects))
|
|
||||||
|
|
||||||
(ert-deftest mgr-gitlab-clone-test ()
|
|
||||||
"Tests that mgr-gitlab can clone a repo"
|
|
||||||
(mgr-gitlab-clone "IotButton"))
|
|
||||||
|
|
||||||
(provide 'mgr-gitlab)
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
;; -*- no-byte-compile: t; -*-
|
|
||||||
;;; $DOOMDIR/packages.el
|
|
||||||
|
|
||||||
;; To install a package with Doom you must declare them here and run 'doom sync'
|
|
||||||
;; on the command line, then restart Emacs for the changes to take effect -- or
|
|
||||||
;; use 'M-x doom/reload'.
|
|
||||||
|
|
||||||
|
|
||||||
;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror:
|
|
||||||
;(package! some-package)
|
|
||||||
|
|
||||||
;; To install a package directly from a remote git repo, you must specify a
|
|
||||||
;; `:recipe'. You'll find documentation on what `:recipe' accepts here:
|
|
||||||
;; https://github.com/radian-software/straight.el#the-recipe-format
|
|
||||||
;(package! another-package
|
|
||||||
; :recipe (:host github :repo "username/repo"))
|
|
||||||
|
|
||||||
;; If the package you are trying to install does not contain a PACKAGENAME.el
|
|
||||||
;; file, or is located in a subdirectory of the repo, you'll need to specify
|
|
||||||
;; `:files' in the `:recipe':
|
|
||||||
;(package! this-package
|
|
||||||
; :recipe (:host github :repo "username/repo"
|
|
||||||
; :files ("some-file.el" "src/lisp/*.el")))
|
|
||||||
|
|
||||||
;; If you'd like to disable a package included with Doom, you can do so here
|
|
||||||
;; with the `:disable' property:
|
|
||||||
;(package! builtin-package :disable t)
|
|
||||||
|
|
||||||
;; You can override the recipe of a built in package without having to specify
|
|
||||||
;; all the properties for `:recipe'. These will inherit the rest of its recipe
|
|
||||||
;; from Doom or MELPA/ELPA/Emacsmirror:
|
|
||||||
;(package! builtin-package :recipe (:nonrecursive t))
|
|
||||||
;(package! builtin-package-2 :recipe (:repo "myfork/package"))
|
|
||||||
|
|
||||||
;; Specify a `:branch' to install a package from a particular branch or tag.
|
|
||||||
;; This is required for some packages whose default branch isn't 'master' (which
|
|
||||||
;; our package manager can't deal with; see radian-software/straight.el#279)
|
|
||||||
;(package! builtin-package :recipe (:branch "develop"))
|
|
||||||
|
|
||||||
;; Use `:pin' to specify a particular commit to install.
|
|
||||||
;(package! builtin-package :pin "1a2b3c4d5e")
|
|
||||||
|
|
||||||
|
|
||||||
;; Doom's packages are pinned to a specific commit and updated from release to
|
|
||||||
;; release. The `unpin!' macro allows you to unpin single packages...
|
|
||||||
;(unpin! pinned-package)
|
|
||||||
;; ...or multiple packages
|
|
||||||
;(unpin! pinned-package another-pinned-package)
|
|
||||||
;; ...Or *all* packages (NOT RECOMMENDED; will likely break things)
|
|
||||||
;(unpin! t)
|
|
||||||
|
|
||||||
;; required for mgr-gitlab
|
|
||||||
(package! gitlab)
|
|
||||||
|
|
||||||
(package! all-the-icons-ivy-rich)
|
|
||||||
(package! paredit)
|
|
||||||
(package! denote)
|
|
||||||
|
|
||||||
;; Load optional site-specific config (e.g. work profiles)
|
|
||||||
(if (file-exists-p "~/.doom-site/init.el")
|
|
||||||
(load-file "~/.doom-site/init.el"))
|
|
||||||
|
|
||||||
7
.emacs
Normal file
7
.emacs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
;; Load all of my config from the org file init.org
|
||||||
|
|
||||||
|
(package-initialize)
|
||||||
|
|
||||||
|
(require 'org)
|
||||||
|
|
||||||
|
(org-babel-load-file (expand-file-name "init.org" user-emacs-directory))
|
||||||
1
.emacs.d
1
.emacs.d
Submodule .emacs.d deleted from 2c06577edf
432
.emacs.d/init.org
Normal file
432
.emacs.d/init.org
Normal file
@@ -0,0 +1,432 @@
|
|||||||
|
#+PROPERTY: header-args :results silent
|
||||||
|
|
||||||
|
* Overview
|
||||||
|
|
||||||
|
This is my personal emacs configuration, which enables my workflow. Highlights include:
|
||||||
|
|
||||||
|
- =helm= for completion
|
||||||
|
- =projectile= for project interaction
|
||||||
|
- =magit= for an emacs-based =git= porcelain
|
||||||
|
- =org-mode= for note organization and capture
|
||||||
|
|
||||||
|
** Package Manager Bootstrapping
|
||||||
|
*** Setting Repositories
|
||||||
|
|
||||||
|
First, use =package= to set up additional repos, which will be leveraged later.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(require 'package)
|
||||||
|
(setq package-enable-at-startup nil)
|
||||||
|
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
|
||||||
|
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/"))
|
||||||
|
(package-initialize)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** =use-package=
|
||||||
|
|
||||||
|
Setup =use-package= and configure it to always install missing
|
||||||
|
packages. This means that emacs will be slow to boot, as it reaches
|
||||||
|
out to the network to pull down updated versions. I tend to run emacs
|
||||||
|
as a daemon, so this doesn't happen too often.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(unless (package-installed-p 'use-package)
|
||||||
|
(package-refresh-contents)
|
||||||
|
(package-install 'use-package))
|
||||||
|
|
||||||
|
(eval-when-compile
|
||||||
|
(require 'use-package))
|
||||||
|
(setq use-package-always-ensure t)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Basic Configuration
|
||||||
|
|
||||||
|
Ensure that emacs doesn't add a custom file which will add
|
||||||
|
configuration that isn't in described this file.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(setq custom-file "/dev/null")
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
Configure some startup parameters.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(line-number-mode t) ;; enable line numbers
|
||||||
|
(column-number-mode t) ;; enable column numbers
|
||||||
|
(setq inhibit-splash-screen t) ;; disable the splash screen on boot
|
||||||
|
(menu-bar-mode 0) ;; disable the menu bar
|
||||||
|
(tool-bar-mode 0) ;; disable the tool bar
|
||||||
|
(setq alert-bell-function "ignore")
|
||||||
|
(if (window-system)
|
||||||
|
(scroll-bar-mode -1)) ;; disable scroll bars
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Deleting
|
||||||
|
|
||||||
|
By default, if you a region selected and hit "backspace" it does not
|
||||||
|
actually delete the region, which is weird to me. This changes that
|
||||||
|
behavior.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(setq delete-active-region t)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
**** ChomeOS
|
||||||
|
|
||||||
|
On ChromeOS, M-DEL is mapped to <deletechar>, so remap fix up.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
;; TODO: Figure out how to make this conditional on ChromeOS
|
||||||
|
(global-set-key (kbd "<deletechar>") 'backward-kill-word)'
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Backups
|
||||||
|
|
||||||
|
Enable automatic file saves to a location that won't clutter source
|
||||||
|
directories.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(savehist-mode t)
|
||||||
|
(setq backup-directory-alist '(("." . "~/.emacs_backups")))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Minions Mode (Hide minor modes)
|
||||||
|
|
||||||
|
The modeline can get cluttered with lots of minor modes. Use
|
||||||
|
=minions-mode= to diminish all of the minor modes, and leave room for
|
||||||
|
more important context like major mode, line number, and git branch.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package minions
|
||||||
|
:init (minions-mode t))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Theme
|
||||||
|
|
||||||
|
Monokai theme is my theme of choice.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package monokai-theme)
|
||||||
|
;; This is busted when the font isn't installed (i.e. on MacOS)
|
||||||
|
;; (set-frame-font "Ubuntu Mono-12" nil t)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Navigation
|
||||||
|
|
||||||
|
Don't use the arrow keys, try to stay on the home row.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(mapc 'global-unset-key '([left] [right] [up] [down] [C-down] [C-up] [C-right] [C-left]))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
Use zoom-window to enable full-screening a single window, briefly.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package zoom-window
|
||||||
|
:bind* ("C-c z z" . zoom-window-zoom))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
=ace-window= makes it easy to jump between windows. I usually have 3+,
|
||||||
|
so this is nice.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package ace-window
|
||||||
|
:bind ("C-x o" . ace-window)
|
||||||
|
:custom
|
||||||
|
(aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
|
||||||
|
(aw-scope 'frame))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
|
||||||
|
=smooth-scrolling= makes emacs scroll nicely and keeps the buffer in a
|
||||||
|
sane place when the point moves. bottom of the window.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package smooth-scrolling
|
||||||
|
:config (smooth-scrolling-mode t))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Replacement
|
||||||
|
|
||||||
|
I use replace-string enough to deserve it's own binding.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(global-set-key (kbd "C-c r") 'replace-string)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Org-mode
|
||||||
|
|
||||||
|
Org-mode is great. As a format, it's fine- but it's emacs integration is powerful
|
||||||
|
|
||||||
|
Enable =org-capture=, which is intended for jotting down quick
|
||||||
|
notes. I don't use it enough, so I haven't fleshed out useful
|
||||||
|
templates yet.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package org
|
||||||
|
:bind (("C-c o c" . org-capture)
|
||||||
|
("C-c o l" . org-store-link))
|
||||||
|
:custom (initial-major-mode 'org-mode)
|
||||||
|
(org-src-tab-acts-natively t)
|
||||||
|
(org-confirm-babel-evaluate nil)
|
||||||
|
(org-capture-templates
|
||||||
|
'(("b" "Bookmark" entry
|
||||||
|
(file+headline "~/notes/bookmarks.org" "Unsorted")
|
||||||
|
"* %T %^{Title}\n\n Source: %u, %c\n\n %i")))
|
||||||
|
:init (org-babel-do-load-languages 'org-babel-load-languages
|
||||||
|
'((shell . t)
|
||||||
|
(ruby . t)
|
||||||
|
(python . t)
|
||||||
|
(C . t))))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** org-journal
|
||||||
|
|
||||||
|
On the other hand, I do use org-journal for notetaking and searching
|
||||||
|
through my notes.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package org-journal
|
||||||
|
:bind (("C-c o j c" . org-journal-new-entry)
|
||||||
|
("C-c o j s" . org-journal-search-forever)))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Development Tools
|
||||||
|
*** General Emacs
|
||||||
|
|
||||||
|
When doing compilation, always jump to the first error to reduce development cycle times.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(setq compilation-auto-jump-to-first-error t)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Dired
|
||||||
|
|
||||||
|
=dired-tree= allows expanding directories in dired buffers. This is
|
||||||
|
nice for pinning a dired buffer to the side to use as a file browser.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package dired-subtree)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
=dired= is great, but too detailed by default. Disable
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package dired
|
||||||
|
:ensure nil
|
||||||
|
:hook ((dired . dired-hide-details-mode)
|
||||||
|
(dired . (lambda (toggle-truncate-lines t))))
|
||||||
|
:bind ([?\t] . dired-subtree-toggle))
|
||||||
|
#+END_SRC
|
||||||
|
*** Git (=magit=)
|
||||||
|
|
||||||
|
Install magit, the emacs porcelain for git.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package magit
|
||||||
|
:custom (magit-bury-buffer-function 'magit-mode-quit-window))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Terminals (=multi-Term=)
|
||||||
|
|
||||||
|
Multi-term is useful for having multiple terminal buffers.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package multi-term
|
||||||
|
:custom
|
||||||
|
(term-bind-key-alist
|
||||||
|
'(("C-<backspace>" . term-send-backward-kill-word)
|
||||||
|
("C-<delete>" . term-send-forward-kill-word)
|
||||||
|
("C-<left>" . term-send-backward-word)
|
||||||
|
("C-<right>" . term-send-forward-word)
|
||||||
|
("C-c C-j" . term-line-mode)
|
||||||
|
("C-c C-k" . term-char-mode)
|
||||||
|
("C-c C-c" . term-interrupt-subjob)
|
||||||
|
("C-r" . term-send-reverse-search-history)
|
||||||
|
("C-v" . scroll-up)
|
||||||
|
("C-y" . term-paste)
|
||||||
|
("C-z" . term-stop-subjob)
|
||||||
|
("C-p" . term-send-prior)
|
||||||
|
("C-n" . term-send-next)
|
||||||
|
("M-p" . scroll-up-line)
|
||||||
|
("M-n" . scroll-down-line)
|
||||||
|
("M-DEL" . term-send-backward-kill-word)
|
||||||
|
("M-d" . term-send-forward-kill-word)
|
||||||
|
("M-r" . isearch-backward)
|
||||||
|
("M-s" . term-send-forward-kill-word))))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** File/command completion (=helm=)
|
||||||
|
|
||||||
|
Install helm, a completion framework, and install its functions over
|
||||||
|
some of the usual emacs keybinds.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package helm
|
||||||
|
:config (helm-mode)
|
||||||
|
:bind (("M-x" . helm-M-x)
|
||||||
|
("C-x b" . helm-mini)
|
||||||
|
("C-x C-b" . helm-buffers-list)
|
||||||
|
("M-y" . helm-show-kill-ring))
|
||||||
|
:custom (helm-split-window-inside-p t))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
=helm-gtags= works nicely for finding tags/references. Though it has
|
||||||
|
confused me many times, =helm-gtags= does not depend on =ggtags=.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package helm-gtags)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
=helm-mt= is integrates =multi-term= with helm. It works nicely to
|
||||||
|
label and search multiple sesions.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package helm-mt
|
||||||
|
:bind (("C-c t" . helm-mt)))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
=Helm-projectile= integrates helm with projectile, which makes it very
|
||||||
|
easy to search for files in a given project.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package helm-projectile
|
||||||
|
:bind (("C-c p f" . helm-projectile))
|
||||||
|
:init (add-to-list 'helm-mini-default-sources 'helm-projectile-sources-list)
|
||||||
|
(helm-projectile-on))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package helm-purpose
|
||||||
|
:bind (("C-c b" . helm-purpose-switch-buffer-with-purpose)))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** Code completion (=company=)
|
||||||
|
|
||||||
|
Company is great for doing completion. It probably deserves more
|
||||||
|
configuration than I'm giving it.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package company
|
||||||
|
:init (global-company-mode))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Projects (=projectile=)
|
||||||
|
|
||||||
|
Install projectile for managing buffers within projects.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package projectile
|
||||||
|
:config (projectile-mode)
|
||||||
|
:bind (("C-c p c" . projectile-compile-project)
|
||||||
|
("C-c p t" . projectile-test-project))
|
||||||
|
:custom (projectil-completion-system 'helm))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Licenses (=lice=)
|
||||||
|
|
||||||
|
=lice= makes it easy to drop the MIT license into all of my code.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package lice
|
||||||
|
:custom (lice:copyright-holder "Max Regan")
|
||||||
|
(lice:default-license "mit" "MIT is my default license"))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
|
||||||
|
=TODO: Fix this. It seems like this breaks syntax highlighting.=
|
||||||
|
|
||||||
|
Use the builtin =hs-minor-mode= to hide the initial comment in code
|
||||||
|
files- usually its a big license notice.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
;; (add-hook 'prog-mode-hook #'hs-minor-mode)
|
||||||
|
;; (add-hook 'hs-minor-mode-hook 'hs-hide-initial-comment-block)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Whitespace (=ws-butler=)
|
||||||
|
|
||||||
|
Use =ws-butler= to automatically clean up any trailing whitespace I
|
||||||
|
leave behind. Other lines are left untouched.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package ws-butler
|
||||||
|
:config (ws-butler-global-mode t))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Python (=elpy=)
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(setq python-shell-interpreter "python3")
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package elpy
|
||||||
|
:init (elpy-enable))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
|
||||||
|
*** C/C++
|
||||||
|
|
||||||
|
TBD
|
||||||
|
|
||||||
|
*** Other languages
|
||||||
|
|
||||||
|
Add major modes for other languages/filetypes that I work with on occasion.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package yaml-mode)
|
||||||
|
(use-package markdown-mode)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* Uncategorized
|
||||||
|
|
||||||
|
C-mode configurations. Set tab width to 4, since that's what I'm used
|
||||||
|
to.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defun my-c-common-hook()
|
||||||
|
(setq c-hungry-delete-key t)
|
||||||
|
(setq adaptive-wrap-extra-indent c-basic-offset)
|
||||||
|
(adaptive-wrap-prefix-mode t)
|
||||||
|
(toggle-word-wrap t))
|
||||||
|
|
||||||
|
(add-hook 'c-mode-common-hook 'my-c-common-hook)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(setq-default c-basic-offset 4
|
||||||
|
tab-width 4
|
||||||
|
indent-tabs-mode nil)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package highlight-doxygen
|
||||||
|
:init (highlight-doxygen-global-mode))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
Add the ability to toggle a buffer as dedicated to its window, to
|
||||||
|
prevent other buffers from popping into that window. This comes from
|
||||||
|
[[https://emacs.stackexchange.com/questions/2189][StackOverflow]].
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defun toggle-window-dedicated ()
|
||||||
|
"Control whether or not Emacs is allowed to display another
|
||||||
|
buffer in current window."
|
||||||
|
(interactive)
|
||||||
|
(message
|
||||||
|
(if (let (window (get-buffer-window (current-buffer)))
|
||||||
|
(set-window-dedicated-p window (not (window-dedicated-p window))))
|
||||||
|
"%s is dedicated to the window."
|
||||||
|
"%s is released from the window.")
|
||||||
|
(current-buffer)))
|
||||||
|
|
||||||
|
(global-set-key (kbd "C-c d") 'toggle-window-dedicated)'
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.ino\\'" . c++-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
|
||||||
|
#+END_SRC
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
# You can override the included template(s) by including variable overrides
|
|
||||||
# See https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
|
|
||||||
# Note that environment variables can be set in several places
|
|
||||||
# See https://docs.gitlab.com/ee/ci/variables/#priority-of-environment-variables
|
|
||||||
stages:
|
|
||||||
- test
|
|
||||||
|
|
||||||
variables:
|
|
||||||
GIT_SUBMODULE_STRATEGY: recursive
|
|
||||||
DOOMDIR: ./.doom.d
|
|
||||||
EMACSDIR: ./.emacs.d
|
|
||||||
DOOMLOCALDIR: ./.emacs.d/local
|
|
||||||
|
|
||||||
test-emacs:
|
|
||||||
stage: test
|
|
||||||
image: ubuntu:22.04
|
|
||||||
before_script:
|
|
||||||
- apt-get update
|
|
||||||
- apt-get install -y emacs-nox git
|
|
||||||
- yes | ./.emacs.d/bin/doom install || true
|
|
||||||
script:
|
|
||||||
- ./.mgr_config/tests/test-emacs.sh
|
|
||||||
|
|
||||||
sast:
|
|
||||||
stage: test
|
|
||||||
include:
|
|
||||||
- template: Security/SAST.gitlab-ci.yml
|
|
||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
|||||||
[submodule "doom emacs"]
|
|
||||||
path = .emacs.d
|
|
||||||
url = https://github.com/hlissner/doom-emacs
|
|
||||||
@@ -42,7 +42,7 @@ git_root() {
|
|||||||
prompt_function() {
|
prompt_function() {
|
||||||
prompt=""
|
prompt=""
|
||||||
|
|
||||||
HOST_COLOR_ID=$(( 16#$(hostname | md5sum | cut -f1 -d' ') % 7 + 1)) # [1, 7]
|
HOST_COLOR_ID=$(( 16#$(hostname | md5 ) % 7 + 1 )) # [1, 7]
|
||||||
HOST_COLOR="${RST}\001$(tput setaf $HOST_COLOR_ID)\002"
|
HOST_COLOR="${RST}\001$(tput setaf $HOST_COLOR_ID)\002"
|
||||||
GIT_COLOR="${RST}${FG_CYN}"
|
GIT_COLOR="${RST}${FG_CYN}"
|
||||||
DIR_COLOR="${RST}${FG_YEL}"
|
DIR_COLOR="${RST}${FG_YEL}"
|
||||||
@@ -56,12 +56,15 @@ prompt_function() {
|
|||||||
prompt+="$(whoami)@$(hostname)${RST}:"
|
prompt+="$(whoami)@$(hostname)${RST}:"
|
||||||
if root=$(git_root); then
|
if root=$(git_root); then
|
||||||
# If in a git repository, only print the path relative to the repo root
|
# If in a git repository, only print the path relative to the repo root
|
||||||
path=$(git rev-parse --show-prefix)
|
path=$(realpath --relative-to=$root $PWD)
|
||||||
ref=$(git symbolic-ref --short -q HEAD)
|
ref=$(git symbolic-ref --short -q HEAD)
|
||||||
if [[ $ref == "" ]]; then
|
if [[ $ref == "" ]]; then
|
||||||
ref="${WARN_COLOR}detached${GIT_COLOR}"
|
ref="${WARN_COLOR}detached${GIT_COLOR}"
|
||||||
fi
|
fi
|
||||||
dirty=$(git diff-index --quiet HEAD)
|
dirty=$(git diff-index --quiet HEAD)
|
||||||
|
if [[ $path == . ]]; then
|
||||||
|
path=""
|
||||||
|
fi
|
||||||
prompt+="${GIT_COLOR}[$(basename $root)@${ref}:${DIR_COLOR}${path}${fg}${GIT_COLOR}]${RST}"
|
prompt+="${GIT_COLOR}[$(basename $root)@${ref}:${DIR_COLOR}${path}${fg}${GIT_COLOR}]${RST}"
|
||||||
else
|
else
|
||||||
# If not in a git repo, print the full path
|
# If not in a git repo, print the full path
|
||||||
@@ -73,18 +76,13 @@ prompt_function() {
|
|||||||
|
|
||||||
PS1="\$(prompt_function)"
|
PS1="\$(prompt_function)"
|
||||||
|
|
||||||
# Add doom emacs to path
|
if [[ -z "$INSIDE_EMACS" ]]; then
|
||||||
export PATH=$PATH:$HOME/.emacs.d/bin/
|
EMACS="emacsclient -a="" -c"
|
||||||
|
alias emacs="$EMACS"
|
||||||
export EDITOR="emacs"
|
else
|
||||||
export VISUAL="emacs"
|
EMACS="emacsclient"
|
||||||
|
alias emacs="$EMACS -n"
|
||||||
# Special sauce for better vterm integration in emacs
|
|
||||||
if [[ "$INSIDE_EMACS" = 'vterm' ]] \
|
|
||||||
&& [[ -n ${EMACS_VTERM_PATH} ]] \
|
|
||||||
&& [[ -f ${EMACS_VTERM_PATH}/etc/emacs-vterm-bash.sh ]]; then
|
|
||||||
source ${EMACS_VTERM_PATH}/etc/emacs-vterm-bash.sh
|
|
||||||
|
|
||||||
alias find-file="vterm_cmd find-file"
|
|
||||||
alias magit="vterm_cmd magit"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
export EDITOR="$EMACS"
|
||||||
|
export VISUAL="$EMACS"
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
source = " ".join(sys.argv[1:])
|
|
||||||
INPUT_SRC_NAME = "<py-input>"
|
|
||||||
|
|
||||||
global_vars = {}
|
|
||||||
local_vars = {}
|
|
||||||
|
|
||||||
py_env_conf = Path.home() / ".py-env.py"
|
|
||||||
if py_env_conf.exists():
|
|
||||||
with open(Path.home() / ".py-env.py") as f:
|
|
||||||
code = compile(f.read(), "py-env.py", "exec")
|
|
||||||
exec(code)
|
|
||||||
|
|
||||||
try:
|
|
||||||
code = compile(source, INPUT_SRC_NAME, "eval")
|
|
||||||
val = eval(code)
|
|
||||||
|
|
||||||
# If it's a string, just print it
|
|
||||||
if type(val) == str:
|
|
||||||
print(val)
|
|
||||||
exit(0)
|
|
||||||
|
|
||||||
# If it's not iterable, just print it
|
|
||||||
try:
|
|
||||||
it = iter(val)
|
|
||||||
except TypeError as e:
|
|
||||||
if val is not None:
|
|
||||||
print(val)
|
|
||||||
exit(0)
|
|
||||||
|
|
||||||
# It's iterable, print each element as a line
|
|
||||||
try:
|
|
||||||
for item in val:
|
|
||||||
print(item)
|
|
||||||
exit(0)
|
|
||||||
except Exception as e:
|
|
||||||
e.args = ("Failed to print all elements",) + e.args
|
|
||||||
raise
|
|
||||||
|
|
||||||
except (SyntaxError, NameError) as e:
|
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
|
||||||
code = compile(source, INPUT_SRC_NAME, "exec")
|
|
||||||
exec(code)
|
|
||||||
except (SyntaxError, NameError) as e:
|
|
||||||
e.args = ("Invalid Python code",) + e.args
|
|
||||||
raise e
|
|
||||||
@@ -21,7 +21,6 @@ if [[ $NEEDS_GIT_DIR != 0 ]]; then
|
|||||||
git-home remote add origin https://gitlab.maxregan.me/max/configs.git
|
git-home remote add origin https://gitlab.maxregan.me/max/configs.git
|
||||||
git-home branch master --set-upstream-to origin/master
|
git-home branch master --set-upstream-to origin/master
|
||||||
git-home config status.showUntrackedFiles no
|
git-home config status.showUntrackedFiles no
|
||||||
git-home submodule update --init --recursive
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Checking out configs."
|
echo "Checking out configs."
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
gitlab_start_log_section() {
|
|
||||||
NAME="$1"
|
|
||||||
HEADER="$2"
|
|
||||||
echo -e "\e[0Ksection_start:`date +%s`:${NAME}\r\e[0K${HEADER}"
|
|
||||||
}
|
|
||||||
|
|
||||||
gitlab_end_log_section() {
|
|
||||||
NAME="$1"
|
|
||||||
echo -e "\e[0Ksection_end:`date +%s`:${NAME}\r\e0K"
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e -o pipefail
|
|
||||||
|
|
||||||
SRC_ROOT="$(dirname "${BASH_SOURCE}")"
|
|
||||||
|
|
||||||
source "$SRC_ROOT/gitlab-utils.sh"
|
|
||||||
|
|
||||||
# Load emacs
|
|
||||||
gitlab_start_log_section "test_init" "Running Emacs"
|
|
||||||
emacs --batch --debug-init -l ./.emacs.d/init.el
|
|
||||||
gitlab_end_log_section "test_init"
|
|
||||||
|
|
||||||
# Run tests
|
|
||||||
gitlab_start_log_section "run_unit_tests" "Running Unit Tests"
|
|
||||||
emacs --batch --debug-init -l ert -l ./.emacs.d/init.el -f ert-run-tests-batch-and-exit
|
|
||||||
gitlab_end_log_section "run_unit_tests"
|
|
||||||
76
.py-env.py
76
.py-env.py
@@ -1,76 +0,0 @@
|
|||||||
|
|
||||||
import itertools
|
|
||||||
import json
|
|
||||||
import operator
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import yaml
|
|
||||||
|
|
||||||
from functools import partial, reduce
|
|
||||||
from math import *
|
|
||||||
from pathlib import Path
|
|
||||||
from itertools import chain
|
|
||||||
|
|
||||||
try:
|
|
||||||
from tabulate import tabulate
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
|
||||||
import rich
|
|
||||||
from rich import inspect, print as pp
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
# Always write heavyweight/blocking code in this file lazily to keep startup
|
|
||||||
# time short. In the same vein, be careful not to consume stdin unless an object
|
|
||||||
# in this file is called or iterated upon, e.g. stdin_str()
|
|
||||||
|
|
||||||
# Returns a lazily-evaluable map which executes multiple map functions
|
|
||||||
def maps(items, *map_funs):
|
|
||||||
it = items
|
|
||||||
for func in map_funs:
|
|
||||||
it = map(func, it)
|
|
||||||
return it
|
|
||||||
|
|
||||||
|
|
||||||
# Returns a lazily-evaluable filter which executes multiple predicate functions
|
|
||||||
def filters(items, *pred_funs):
|
|
||||||
it = items
|
|
||||||
for pred in pred_funs:
|
|
||||||
it = filter(pred, it)
|
|
||||||
return it
|
|
||||||
|
|
||||||
|
|
||||||
# Concatenate two items, there's likely a safer way to do this to avoid summing ints
|
|
||||||
concat = lambda a, b: "".join([a, b])
|
|
||||||
# Joins an interable of strings
|
|
||||||
join = "".join
|
|
||||||
|
|
||||||
|
|
||||||
# Return an iterable for file. This doesn't close the handle, but for this
|
|
||||||
# little scripting interface this is fine.
|
|
||||||
def read(filename):
|
|
||||||
return open(filename, "r")
|
|
||||||
|
|
||||||
|
|
||||||
def read_str(filename):
|
|
||||||
return concats(read(filename))
|
|
||||||
|
|
||||||
|
|
||||||
stdin_str = sys.stdin.read
|
|
||||||
# An iterable which yields the characters of stdin
|
|
||||||
stdin = (c for l in sys.stdin for c in l)
|
|
||||||
# An iterable which yields the lines of stdin
|
|
||||||
lines = map(str.strip, sys.stdin)
|
|
||||||
# An iterable which yields integers supplied via stdin lines
|
|
||||||
ints = map(int, lines)
|
|
||||||
# An iterable which yields the bytes of stdin
|
|
||||||
byts = map(lambda x: bytes(x, "utf-8"), stdin) # better name? 'bytes' is taken
|
|
||||||
|
|
||||||
jr = json.loads
|
|
||||||
jw = json.dumps
|
|
||||||
yr = lambda x: yaml.load(x, Loader=yaml.SafeLoader)
|
|
||||||
yw = yaml.dump
|
|
||||||
pwd = Path.cwd()
|
|
||||||
Reference in New Issue
Block a user