18 Commits

Author SHA1 Message Date
a1da3d1985 Update .gitlab-ci.yml 2022-03-23 21:09:40 +00:00
95d92726c7 Update .gitlab-ci.yml 2022-03-23 20:57:50 +00:00
72424b42bf Update .gitlab-ci.yml 2022-03-23 20:55:49 +00:00
b073436765 Update config.el 2022-03-23 20:55:00 +00:00
1de5957007 Update config.el 2022-03-23 20:22:18 +00:00
fc1b18e08e Set doom environment variables to use checked-out copy 2022-03-23 17:20:03 +00:00
b92c5d9be1 Require git 2022-03-23 17:14:44 +00:00
8376804a88 Use 22.04 for newer emacs 2022-03-23 17:10:56 +00:00
1163ea98be Update .gitlab-ci.yml, .mgr_config/tests/test-emacs.sh files 2022-03-23 17:06:28 +00:00
30c41fe2ee Update .gitlab-ci.yml, .mgr_config/tests/test-emacs.sh files 2022-03-23 16:48:35 +00:00
7008dfe41d Update test-emacs.sh 2022-03-23 16:46:10 +00:00
6d4883ed37 Update test-emacs.sh 2022-03-23 16:42:04 +00:00
e7efaf1eb1 Add test that emacs config loads 2022-03-23 09:38:17 -07:00
0c0bb939e5 Add mgr-gitlab 2022-03-22 22:58:05 -04:00
9e6e0c0969 Fix load order error with all-the-icons-rich/counsel 2022-03-22 08:16:19 -07:00
9e55849ae1 Add vterm configurations 2022-03-22 08:06:09 -07:00
fe74e03373 Update config.el 2022-03-22 14:57:06 +00:00
4cbc6c1740 Update init.el 2022-03-22 14:54:03 +00:00
7 changed files with 188 additions and 36 deletions

View File

@@ -3,7 +3,6 @@
;; Place your private configuration here! Remember, you do not need to run 'doom ;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file! ;; sync' after modifying this file!
;; Some functionality uses this to identify you, e.g. GPG configuration, email ;; Some functionality uses this to identify you, e.g. GPG configuration, email
;; clients, file templates and snippets. ;; clients, file templates and snippets.
(setq user-full-name "Max Regan" (setq user-full-name "Max Regan"
@@ -52,3 +51,30 @@
;; ;;
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how ;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
;; they are implemented. ;; 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 "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))))

View File

@@ -30,8 +30,8 @@
;;deft ; notational velocity for Emacs ;;deft ; notational velocity for Emacs
doom ; what makes DOOM look the way it does doom ; what makes DOOM look the way it does
doom-dashboard ; a nifty splash screen for Emacs doom-dashboard ; a nifty splash screen for Emacs
doom-quit ; DOOM quit-message prompts when you quit Emacs ;; doom-quit ; DOOM quit-message prompts when you quit Emacs
;;(emoji +unicode) ; 🙂 (emoji +unicode) ; 🙂
hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
;;hydra ;;hydra
;;indent-guides ; highlighted indent columns ;;indent-guides ; highlighted indent columns
@@ -43,17 +43,17 @@
ophints ; highlight the region an operation acts on ophints ; highlight the region an operation acts on
(popup +defaults) ; tame sudden yet inevitable temporary windows (popup +defaults) ; tame sudden yet inevitable temporary windows
;;tabs ; a tab bar for Emacs ;;tabs ; a tab bar for Emacs
treemacs ; a project drawer, like neotree but cooler ;;treemacs ; a project drawer, like neotree but cooler
;;unicode ; extended unicode support for various languages ;;unicode ; extended unicode support for various languages
vc-gutter ; vcs diff in the fringe vc-gutter ; vcs diff in the fringe
vi-tilde-fringe ; fringe tildes to mark beyond EOB vi-tilde-fringe ; fringe tildes to mark beyond EOB
;;window-select ; visually switch windows window-select ; visually switch windows
workspaces ; tab emulation, persistence & separate workspaces workspaces ; tab emulation, persistence & separate workspaces
;;zen ; distraction-free coding or writing ;;zen ; distraction-free coding or writing
:editor :editor
;;(evil +everywhere); come to the dark side, we have cookies ;;(evil +everywhere); come to the dark side, we have cookies
file-templates ; auto-snippets for empty files ;; file-templates ; auto-snippets for empty files
fold ; (nigh) universal code folding fold ; (nigh) universal code folding
;;(format +onsave) ; automated prettiness ;;(format +onsave) ; automated prettiness
;;god ; run Emacs commands without modifier keys ;;god ; run Emacs commands without modifier keys
@@ -66,7 +66,7 @@
word-wrap ; soft wrapping with language-aware indent word-wrap ; soft wrapping with language-aware indent
:emacs :emacs
dired ; making dired pretty [functional] (dired +icons) ; making dired pretty [functional]
electric ; smarter, keyword-based electric-indent electric ; smarter, keyword-based electric-indent
;;ibuffer ; interactive buffer management ;;ibuffer ; interactive buffer management
undo ; persistent, smarter undo for your inevitable mistakes undo ; persistent, smarter undo for your inevitable mistakes
@@ -85,16 +85,15 @@
:tools :tools
;;ansible ;;ansible
;;biblio ; Writes a PhD for you (citation needed)
debugger ; FIXME stepping through code, to help you add bugs debugger ; FIXME stepping through code, to help you add bugs
;;direnv ;;direnv
docker docker
;;editorconfig ; let someone else argue about tabs vs spaces editorconfig ; let someone else argue about tabs vs spaces
;;ein ; tame Jupyter notebooks with emacs ;;ein ; tame Jupyter notebooks with emacs
(eval +overlay) ; run code, run (also, repls) (eval +overlay) ; run code, run (also, repls)
;;gist ; interacting with github gists ;;gist ; interacting with github gists
lookup ; navigate your code and its documentation lookup ; navigate your code and its documentation
;;lsp ; M-x vscode lsp ; M-x vscode
magit ; a git porcelain for Emacs magit ; a git porcelain for Emacs
make ; run make tasks from Emacs make ; run make tasks from Emacs
;;pass ; password manager for nerds ;;pass ; password manager for nerds
@@ -108,7 +107,7 @@
:os :os
(:if IS-MAC macos) ; improve compatibility with macOS (:if IS-MAC macos) ; improve compatibility with macOS
;;tty ; improve the terminal Emacs experience tty ; improve the terminal Emacs experience
:lang :lang
;;agda ; types of types of types of types... ;;agda ; types of types of types of types...
@@ -138,7 +137,7 @@
;;hy ; readability of scheme w/ speed of python ;;hy ; readability of scheme w/ speed of python
;;idris ; a language you can depend on ;;idris ; a language you can depend on
json ; At least it ain't XML json ; At least it ain't XML
;;(java +lsp) ; the poster child for carpal tunnel syndrome (java +lsp) ; the poster child for carpal tunnel syndrome
;;javascript ; all(hope(abandon(ye(who(enter(here)))))) ;;javascript ; all(hope(abandon(ye(who(enter(here))))))
;;julia ; a better, faster MATLAB ;;julia ; a better, faster MATLAB
;;kotlin ; a better, slicker Java(Script) ;;kotlin ; a better, slicker Java(Script)
@@ -160,7 +159,7 @@
;;raku ; the artist formerly known as perl6 ;;raku ; the artist formerly known as perl6
;;rest ; Emacs as a REST client ;;rest ; Emacs as a REST client
;;rst ; ReST in peace ;;rst ; ReST in peace
;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} ruby ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
;;rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap() ;;rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
;;scala ; java, but good ;;scala ; java, but good
;;(scheme +guile) ; a fully conniving family of lisps ;;(scheme +guile) ; a fully conniving family of lisps
@@ -170,7 +169,7 @@
;;swift ; who asked for emoji variables? ;;swift ; who asked for emoji variables?
;;terra ; Earth and Moon in alignment for performance. ;;terra ; Earth and Moon in alignment for performance.
;;web ; the tubes ;;web ; the tubes
;;yaml ; JSON, but readable yaml ; JSON, but readable
;;zig ; C, but simpler ;;zig ; C, but simpler
:email :email

View File

@@ -0,0 +1,95 @@
;;; 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: Automatically set remote.pushDefault so it does not prompt
;; 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))
(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))
(provide 'mgr-gitlab)

View File

@@ -55,6 +55,8 @@
(package! git-auto-commit-mode) (package! git-auto-commit-mode)
;; required for mgr-gitlab
(package! gitlab)
;; Testing ;; Testing
(package! dashboard) (package! dashboard)

View File

@@ -4,6 +4,23 @@
# See https://docs.gitlab.com/ee/ci/variables/#priority-of-environment-variables # See https://docs.gitlab.com/ee/ci/variables/#priority-of-environment-variables
stages: stages:
- test - 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: sast:
stage: test stage: test
include: include:

View File

@@ -73,8 +73,18 @@ prompt_function() {
PS1="\$(prompt_function)" PS1="\$(prompt_function)"
# Add doom emacs to path
export PATH=$PATH:$HOME/.emacs.d/bin/ export PATH=$PATH:$HOME/.emacs.d/bin/
export EDITOR="emacs" export EDITOR="emacs"
export VISUAL="emacs" export VISUAL="emacs"
# 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

View File

@@ -0,0 +1,3 @@
#!/bin/bash
emacs --batch --debug-init --load ./.emacs.d/init.el