Compare commits
No commits in common. "4928f304c66f1f00bc44f1aeb6b461fe175decb2" and "b23a3da5b003e89853fe6aa1b6ab7f1680241039" have entirely different histories.
4928f304c6
...
b23a3da5b0
@ -231,7 +231,6 @@ Adds Evil commands to comment out lines of code:
|
||||
(general-def 'normal prodigy-view-mode-map "0" nil :keymaps 'override)
|
||||
(general-def 'normal messages-buffer-mode-map "SPC" leader-map :keymaps 'override)
|
||||
#+END_SRC
|
||||
|
||||
* Hydra
|
||||
[[https://github.com/abo-abo/hydra][Hydra]]s are convenient keybinding menus.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -2960,8 +2959,7 @@ Emacs support for the Language Server Protocol
|
||||
:custom
|
||||
(lsp-enable-snippet nil)
|
||||
(lsp-eldoc-render-all nil)
|
||||
(lsp-headerline-breadcrumb-enable nil)
|
||||
(lsp-file-watch-threshold 100000))
|
||||
(lsp-headerline-breadcrumb-enable nil))
|
||||
|
||||
(use-package lsp-ui
|
||||
:after (lsp-mode)
|
||||
@ -6481,14 +6479,9 @@ A package that bundles together common code beautifying tools for many languages
|
||||
Enable ANSI colors in compile buffers:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(autoload 'ansi-color-apply-on-region "ansi-color")
|
||||
|
||||
(defun local/postprocess-compilation-buffer ()
|
||||
(goto-char compilation-filter-start)
|
||||
(when (looking-at "\033c")
|
||||
(delete-region (point-min) (match-end 0)))
|
||||
(ansi-color-apply-on-region (point) (point-max)))
|
||||
|
||||
(add-hook 'compilation-filter-hook 'local/postprocess-compilation-buffer)
|
||||
(defun colorize-compilation-buffer ()
|
||||
(ansi-color-apply-on-region compilation-filter-start (point-max)))
|
||||
(add-hook 'compilation-filter-hook #'colorize-compilation-buffer)
|
||||
#+END_SRC
|
||||
|
||||
Set up some keybindings for Comint-mode compilation buffers:
|
||||
@ -6501,167 +6494,9 @@ Recognize text of the form <filename>:<line number> as a compilation
|
||||
error:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(with-eval-after-load 'compile
|
||||
(add-to-list 'compilation-error-regexp-alist '("\\([^[:space:]]+\\):\\([[:digit:]]+\\)$" 1 2)))
|
||||
(add-to-list 'compilation-error-regexp-alist '("\\(.+\\):\\([[:digit:]]+\\)$" 1 2)))
|
||||
#+END_SRC
|
||||
|
||||
* Run-command
|
||||
A [[https://github.com/bard/emacs-run-command][useful library]] that lets you define dynamic commands based on the
|
||||
current buffer:
|
||||
#+begin_src emacs-lisp
|
||||
(use-package run-command
|
||||
:straight (run-command :host github :repo "bard/emacs-run-command"
|
||||
:fork (:host github :repo "jdormit/emacs-run-command"))
|
||||
:config
|
||||
(defun run-command-recipe-terraform ()
|
||||
(when (directory-files default-directory
|
||||
nil
|
||||
(rx (one-or-more any)
|
||||
".tf"
|
||||
eol))
|
||||
(list
|
||||
(list :command-name "plan"
|
||||
:command-line "terraform plan")
|
||||
(list :command-name "apply"
|
||||
:command-line "terraform apply")
|
||||
(list :command-name "destroy"
|
||||
:command-line "terraform destroy"))))
|
||||
|
||||
(defvar-local run-command-local-commands nil)
|
||||
(put 'run-command-local-commands 'safe-local-variable (lambda (_) t))
|
||||
|
||||
(defun run-command-recipe-local ()
|
||||
(when run-command-local-commands
|
||||
(mapcar (cl-function
|
||||
(lambda ((name . spec))
|
||||
(let ((name (if (symbolp name) (symbol-name name) name)))
|
||||
(list :command-name name
|
||||
:command-line spec))))
|
||||
run-command-local-commands)))
|
||||
|
||||
(defun run-command-recipe-package-json--get-scripts (package-json-file)
|
||||
"Extract NPM scripts from `package-json-file'."
|
||||
(with-temp-buffer
|
||||
(insert-file-contents package-json-file)
|
||||
(let* ((json-data (json-parse-buffer))
|
||||
(script-hash (gethash "scripts" json-data))
|
||||
(scripts '()))
|
||||
(when script-hash
|
||||
(maphash (lambda (key _value) (push key scripts)) script-hash))
|
||||
scripts)))
|
||||
|
||||
(defun run-command-recipe-package-json ()
|
||||
(when-let* ((project-dir
|
||||
(locate-dominating-file default-directory "package.json"))
|
||||
(scripts
|
||||
(run-command-recipe-package-json--get-scripts (concat project-dir "package.json")))
|
||||
(script-runner
|
||||
(if (file-exists-p (concat project-dir "yarn.lock")) "yarn" "npm")))
|
||||
(mapcar (lambda (script)
|
||||
(list :command-name script
|
||||
:command-line (concat script-runner " run " script)
|
||||
:display script
|
||||
:working-dir project-dir))
|
||||
scripts)))
|
||||
|
||||
(defun makefile-target-list-default (makefile)
|
||||
"Return the target list for MAKEFILE by parsing it."
|
||||
(let (targets)
|
||||
(with-temp-buffer
|
||||
(insert-file-contents makefile)
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward "^\\([^: \n]+\\) *:\\(?: \\|$\\)" nil t)
|
||||
(let ((str (match-string 1)))
|
||||
(unless (string-match "^\\." str)
|
||||
(push str targets)))))
|
||||
(nreverse targets)))
|
||||
|
||||
(defun run-command-recipe-makefile ()
|
||||
(when-let* ((project-dir (locate-dominating-file default-directory "Makefile"))
|
||||
(makefile (concat project-dir "Makefile"))
|
||||
(targets (makefile-target-list-default makefile)))
|
||||
(mapcar (lambda (target)
|
||||
(list :command-name target
|
||||
:command-line (concat "make " target)
|
||||
:display target
|
||||
:working-dir project-dir))
|
||||
targets)))
|
||||
|
||||
(defun run-command-recipe-project ()
|
||||
(when (projectile-project-root)
|
||||
(mapcar (lambda (cmd)
|
||||
(when-let ((cmd-val (symbol-value
|
||||
(intern
|
||||
(format "projectile-project-%s-cmd" cmd)))))
|
||||
(list :command-name cmd
|
||||
:command-line cmd-val
|
||||
:working-dir (projectile-compilation-dir))))
|
||||
'("test" "run" "compilation" "configure" "install" "package"))))
|
||||
|
||||
(defvar-local run-command-project-local-commands nil)
|
||||
(put 'run-command-project-local-commands 'safe-local-variable (lambda (_) t))
|
||||
|
||||
(defun run-command-recipe-project-local ()
|
||||
(when (and run-command-project-local-commands (projectile-project-root))
|
||||
(mapcar (cl-function
|
||||
(lambda ((name . spec))
|
||||
(let ((name (if (symbolp name) (symbol-name name) name)))
|
||||
(list :command-name name
|
||||
:command-line spec
|
||||
:working-dir (projectile-compilation-dir)))))
|
||||
run-command-project-local-commands)))
|
||||
|
||||
|
||||
(defun run-command-recipe-executables ()
|
||||
(let* ((buffer-file (buffer-file-name))
|
||||
(executable-p (and buffer-file (file-executable-p buffer-file))))
|
||||
(list
|
||||
(when executable-p
|
||||
(list
|
||||
:command-name "run-buffer-file"
|
||||
:command-line buffer-file
|
||||
:display "Run this buffer's file"))
|
||||
(when (and executable-p (executable-find "entr"))
|
||||
(list
|
||||
:command-name "run-buffer-file-watch"
|
||||
:command-line (format "echo %s | entr -c /_" buffer-file)
|
||||
:display "Run this buffer's file (re-run on each save)")))))
|
||||
|
||||
(defun run-command-recipe-obelix ()
|
||||
(when-let* ((config (or (locate-dominating-file default-directory "obelix.json")
|
||||
(locate-dominating-file default-directory "obelix.edn")))
|
||||
(dir (file-name-directory config)))
|
||||
(list
|
||||
(list :command-name "build"
|
||||
:command-line "obelix build"
|
||||
:working-dir dir)
|
||||
(list :command-name "serve"
|
||||
:command-line "obelix serve"
|
||||
:working-dir dir))))
|
||||
|
||||
(defun run-command-recipe-kustomize ()
|
||||
(when-let* ((kustomization (locate-dominating-file default-directory "kustomization.yaml"))
|
||||
(dir (file-name-directory kustomization)))
|
||||
(list
|
||||
(list :command-name "build"
|
||||
:command-line "kustomize build --enable_alpha_plugins"
|
||||
:working-dir dir))))
|
||||
|
||||
:general
|
||||
(leader-map "\"" #'run-command)
|
||||
(run-command-term-minor-mode-map [remap recompile] #'run-command-term-recompile)
|
||||
:custom
|
||||
(run-command-run-method 'term)
|
||||
(run-command-recipes '(run-command-recipe-terraform
|
||||
run-command-recipe-local
|
||||
run-command-recipe-package-json
|
||||
run-command-recipe-makefile
|
||||
run-command-recipe-project
|
||||
run-command-recipe-project-local
|
||||
run-command-recipe-executables
|
||||
run-command-recipe-obelix
|
||||
run-command-recipe-kustomize)))
|
||||
#+end_src
|
||||
|
||||
|
||||
* Wallabag
|
||||
[[https://github.com/jdormit/emacs-wallabag-client][My Wallabag client]] is still a WIP, but it is useful enough to pull in right now:
|
||||
@ -7008,11 +6843,3 @@ makes quotes curly and dashes long, etc.
|
||||
(use-package rego-mode
|
||||
:mode (("\\.rego\\'" . rego-mode)))
|
||||
#+END_SRC
|
||||
|
||||
* Homebrew
|
||||
#+begin_src emacs-lisp
|
||||
(use-package homebrew
|
||||
:straight (:host github :repo "jdormit/homebrew.el")
|
||||
:defer t)
|
||||
#+end_src
|
||||
|
||||
|
@ -1,9 +1,5 @@
|
||||
provider_installation {
|
||||
filesystem_mirror {
|
||||
path = "/usr/local/etc/terraform/providers"
|
||||
include = ["terraform.homebrew/*/*"]
|
||||
}
|
||||
direct {
|
||||
include = ["*/*"]
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user