summaryrefslogtreecommitdiff
path: root/emacs/custom/my-prog.el
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-03-23 09:55:58 -0700
committerFranck Cuny <franck@fcuny.net>2022-03-23 09:55:58 -0700
commit1543ac66ba6f829082b745e6a11a9aeb9e8faec7 (patch)
treef06103de2e5d82426877595cd23d6201f2cdb000 /emacs/custom/my-prog.el
parentrename fcuny-org to my-org (diff)
downloademacs.d-1543ac66ba6f829082b745e6a11a9aeb9e8faec7.tar.gz
rename a few more libraries
Diffstat (limited to 'emacs/custom/my-prog.el')
-rw-r--r--emacs/custom/my-prog.el131
1 files changed, 131 insertions, 0 deletions
diff --git a/emacs/custom/my-prog.el b/emacs/custom/my-prog.el
new file mode 100644
index 0000000..ce41935
--- /dev/null
+++ b/emacs/custom/my-prog.el
@@ -0,0 +1,131 @@
+;;; my-prog.el --- Configures emacs for various programming languages
+;;; Commentary:
+
+;;; Code:
+
+;; (require 'fcuny-vars)
+(require 'use-package)
+
+(use-package man
+ :custom
+ (Man-notify-method 'aggressive)
+ (Man-fontify-manpage-flag t))
+
+(use-package compile
+ :ensure nil
+ :custom
+ (compilation-scroll-output t)
+ ;; Skip over warnings and info messages in compilation
+ (compilation-skip-threshold 2)
+ ;; Don't freeze when process reads from stdin
+ (compilation-disable-input t)
+ ;; Show three lines of context around the current message
+ (compilation-context-lines 3))
+
+(use-package flymake
+ :ensure nil
+ :hook ((prog-mode . flymake-mode)
+ (conf-mode . flymake-mode))
+ :bind (:map flymake-mode-map (("C-c ! s" . flymake-start)
+ ("C-c ! d" . flymake-show-buffer-diagnostics)
+ ("C-c ! n" . flymake-goto-next-error)
+ ("C-c ! p" . flymake-goto-prev-error)))
+ :custom
+ (elisp-flymake-byte-compile-load-path load-path))
+
+;; yasnippet is required to support place holders with eglot
+(use-package yasnippet
+ :ensure t
+ :hook
+ ((prog-mode org-mode dap-ui-repl-mode conf-mode) . yas-minor-mode)
+ :config
+ (yas-reload-all))
+
+(use-package auto-fill
+ :hook (prog-mode . auto-fill-mode)
+ :custom
+ ;; this does not seem to work ..
+ (comment-fill-column 80)
+ (comment-auto-fill-only-comments t))
+
+(use-package company
+ :ensure t
+ :diminish company-mode
+ :hook (prog-mode . company-mode)
+ :custom
+ (company-minimum-prefix-length 2)
+ (company-tooltip-align-annotations t)
+ (company-tooltip-limit 12)
+ (company-idle-delay 1))
+
+(use-package lispy
+ :ensure t
+ :config
+ (dolist (hook '(emacs-lisp-mode-hook))
+ (add-hook hook #'lispy-mode)))
+
+(use-package eldoc
+ :ensure nil
+ :hook
+ ((prog-mode conf-mode) . eldoc-mode)
+ :bind ("C-c C-h" . eldoc))
+
+(use-package eglot
+ :after (yasnippet company)
+ :commands (eglot eglot-ensure)
+ :ensure t
+ :bind (:map eglot-mode-map
+ ("C-c C-r" . eglot-rename)
+ ("C-c C-a" . eglot-code-actions))
+ :hook ((go-mode . eglot-ensure)
+ (nix-mode . eglot-ensure)
+ (eglot-managed-mode-hook . turn-on-eldoc-mode))
+ :init
+ (setq-default eglot-workspace-configuration
+ ;; List of settings for gopls:
+ ;; https://github.com/golang/tools/blob/master/gopls/doc/settings.md
+ '((:gopls .
+ ((staticcheck . t)
+ (matcher . "CaseSensitive")
+ (usePlaceholders . t))))))
+
+(use-package sh-script
+ :mode ("bashrc" . sh-mode)
+ :hook (after-save . executable-make-buffer-file-executable-if-script-p)
+ :config
+ (setq-default sh-indentation 2
+ sh-basic-offset 2))
+
+(use-package python
+ :mode (("\\.py$" . python-mode))
+ :commands python-mode
+ :hook ((python-mode . eldoc-mode))
+ :custom (python-indent-offset 2))
+
+(use-package make-mode
+ :config
+ (add-hook 'makefile-mode-hook (lambda () (setq-local tab-width 2))))
+
+(use-package go-mode
+ :after (eglot)
+ :ensure t
+ :hook ((before-save . gofmt-before-save))
+ :custom
+ (tab-width 4))
+
+(use-package gotest
+ :after (go-mode)
+ :ensure t)
+
+(use-package lisp-mode
+ :bind
+ (("C-c C-e" . eval-buffer)
+ ("C-c C-r" . eval-region)))
+
+(use-package nix-mode
+ :ensure t
+ :mode "\\.nix\\'"
+ :hook ((before-save . nix-format-before-save)))
+
+(provide 'my-prog)
+;;; my-prog.el ends here