From fb79d526b03b3f0ec6019b2d420f53b6fbc51dd1 Mon Sep 17 00:00:00 2001 From: Christopher James Hayward Date: Mon, 8 Mar 2021 15:09:03 -0500 Subject: [PATCH] Separate development / projects --- README.org | 3 +- modules/development.org | 192 ++++++++++++++++++++++++++++++++++++++++ modules/projects.org | 180 ++----------------------------------- 3 files changed, 201 insertions(+), 174 deletions(-) create mode 100644 modules/development.org diff --git a/README.org b/README.org index 09cae37..7f4ac17 100644 --- a/README.org +++ b/README.org @@ -69,7 +69,7 @@ Here's a complete list of all of the options configurable for each host, and the (defconst dotfiles/modules-p '(core editor email encryption desktop writing website capture projects - interface dashboard) + development interface dashboard) "All of the available modules.") (defvar dotfiles/modules dotfiles/modules-p @@ -151,6 +151,7 @@ Breaking down the project into logical units or chapters to keep the code more m + [[file:modules/website.org][Website]] + [[file:modules/capture.org][Capture]] + [[file:modules/projects.org][Projects]] ++ [[file:modules/development.org][Development]] + [[file:modules/interface.org][Interface]] + [[file:modules/dashboard.org][Dashboard]] diff --git a/modules/development.org b/modules/development.org new file mode 100644 index 0000000..96c43f7 --- /dev/null +++ b/modules/development.org @@ -0,0 +1,192 @@ +#+TITLE: Development +#+AUTHOR: Christopher James Hayward +#+EMAIL: chris@chrishayward.xyz + +#+PROPERTY: header-args:emacs-lisp :tangle development.el :comments org +#+PROPERTY: header-args:shell :tangle no +#+PROPERTY: header-args :results silent :eval no-export :comments org + +#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil +#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil + +Support for individual programming languages, has a hard dependency on the [[file:projects.org][Projects]] module for integration with *LSP*[fn:1] / *DAP*[fn:2] + +* Go + +First class language support for *Golang*[fn:3]. + ++ Full support of *LSP*[fn:1] ++ Full support of *DAP*[fn:1] + +** Installing requirements + +Get started by installing the *gopls*[fn:4] language server. + +#+begin_src shell +GO111MODULE=on go get golang.org/x/tools/gopls@latest +#+end_src + +** Setup the environment + +Make some modifications to the environment. + +*** Overriding the $GOPATH + +Set the =$GOPATH= environment variable prior to loading the module, allowing modification of the default value. + +#+begin_src emacs-lisp +(setenv "GOPATH" (concat (getenv "HOME") "/.go/")) +#+end_src + +*** Adding $GOBIN to the $PATH + +Include the ~bin~ subdirectory of the =$GOPATH= in the =$PATH= variable, adding compiled Golang applications to the system path. + +#+begin_src emacs-lisp +(setenv "PATH" (concat (getenv "GOPATH") "bin:" (getenv "PATH"))) +#+end_src + +** Configuration + +Include the *go-mode*[fn:5] package for integration with *lsp-mode* from the [[file:projects.org][Projects]] module. + +#+begin_src emacs-lisp +(use-package go-mode + :hook (go-mode . lsp) + :custom (lsp-go-gopls-server-path + (expand-file-name "~/.go/bin/gopls"))) +#+end_src + +*** Before save hooks + +Apply some custom behaviour prior to saving buffers. + ++ Format buffers ++ Organize imports + +#+begin_src emacs-lisp +(defun dotfiles/go-hook () + (add-hook 'before-save-hook #'lsp-format-buffer t t) + (add-hook 'before-save-hook #'lsp-organize-imports t t)) + +(add-hook 'go-mode-hook #'dotfiles/go-hook) +#+end_src + +*** Babel structure templates + +Add a structure template for *Golang*[fn:3] source blocks. + +#+begin_src emacs-lisp +(add-to-list 'org-structure-template-alist '("go" . "src go")) +#+end_src + +* HTTP + +Interactive with *HTTP* endpoints using the *ob-http*[fn:6] package. You can see how it works in my post [[file:../docs/posts/kanye-as-a-service.org.gpg][Kanye as a Service]]. Essentialy it adds interactive *HTTP* blocks that can output their results in place. + +#+begin_src emacs-lisp +(use-package ob-http + :after org + :config (org-babel-do-load-languages + 'org-babel-load-languages '((http . t)))) +#+end_src + +* C/C++ + +Add support for the *C/C++* family of languages via the *CCLS*[fn:7] language server. + ++ Integrate with *LSP*[fn:2] ++ Integrate with *DAP*[fn:1] ++ Load babel language modules ++ Create new structure templates + * ~