diff options
author | William Carroll <wpcarro@gmail.com> | 2020-08-31T14·49+0100 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-08-31T14·49+0100 |
commit | 1e253a756bc1f4f9a96416311490008f5c8518c8 (patch) | |
tree | baafd9ab9f12d571dc1710252b6215fa76d00d7f | |
parent | b475f7166ea13593ce0e0eb30d57e0463268196f (diff) |
Delete entr.el
As I strive to lean down my Emacs configuration modules like this must go.
-rw-r--r-- | emacs/.emacs.d/init.el | 2 | ||||
-rw-r--r-- | emacs/.emacs.d/wpc/entr.el | 115 |
2 files changed, 0 insertions, 117 deletions
diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 37ab0be832b8..87e9a38dce8a 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -21,8 +21,6 @@ (require 'keyboard) (require 'irc) (require 'email) -;; TODO: Consider renaming entr.el. -(require 'entr) (require 'scrot) (require 'timestring) diff --git a/emacs/.emacs.d/wpc/entr.el b/emacs/.emacs.d/wpc/entr.el deleted file mode 100644 index ac2a5812c328..000000000000 --- a/emacs/.emacs.d/wpc/entr.el +++ /dev/null @@ -1,115 +0,0 @@ -;;; entr.el --- Working with terminals and entr -*- lexical-binding: t -*- -;; Author: William Carroll <wpcarro@gmail.com> - -;;; Commentary: -;; Help make watch commands easier. -;; -;; This should be entirely temporary because in reality we should be able to use -;; Emacs's buffer watching abilities to run commands. -;; TODO: Explore Emacs integration that obviates `entr`. - -;;; Code: - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Dependencies -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(require 'f) -(require 'buffer) -(require 'prelude) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Library -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; TODO: Support a generic file-watcher for commonly used languages. -(defconst entr/major-mode->save-handler - '((python-mode . entr/handle-python3)) - "Mapping of language to the `after-save-hook' function it should register.") - -(defun entr/shell-command-to-buffer (cmd name) - "Run CMD in a shell and output to the buffer NAME. -The buffer is a find-or-create operation. -The buffer is erased between runs with `erase-buffer'." - (let ((b (buffer/find-or-create name))) - (with-current-buffer b (erase-buffer)) - (shell-command cmd b) - (buffer/show b))) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Python -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; TODO: This should be a top-level function. -(defconst entr/handle-python3 - (lambda () - (entr/shell-command-to-buffer - (format "python3 %s" (buffer-file-name)) - "*python3*")) - "Function that is registered as the `after-save-hook' for python3.") - -(defun entr/register-python3 () - "Register a buffer-local `after-save-hook' for calling python3 with filename." - (interactive) - (add-hook 'after-save-hook entr/handle-python3 nil t)) - -(defun entr/deregister-python3 () - "Remove the buffer-local `after-save-hook' for python3." - (interactive) - (remove-hook 'after-save-hook entr/handle-python3 t)) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Protobuf -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(defun entr/format-protobuf () - "Formats a protobuf buffer." - (call-interactively #'clang-format)) - -;; TODO: Run this automatically with .proto file extensions. Do this after -;; verifying that `clang-format' complies with Google's style guide. -(defun entr/register-protobuf () - "Register a buffer-local `before-save-hook' for formatting protobuf buffers." - (interactive) - (add-hook - 'before-save-hook - #'entr/format-protobuf - nil - t)) - -;; TODO: Is there an interactive way to remove hooks in Emacs? -(defun entr/deregister-protobuf () - "Remove the buffer-local `before-save-hook' for protobuf." - (interactive) - (remove-hook - 'before-save-hook - #'entr/format-protobuf - t)) - -;; TODO: Support this. Currently the `intern' call is the problem. -;; (defun entr/ivy-remove-hook (hook) -;; "Use Counsel to remove a handler from HOOK." -;; (interactive) -;; (ivy-read -;; "Remove hook: " -;; (intern (prelude/prompt "Hook name: ")) -;; :action (lambda (x) (message x)))) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Miscellaneous -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(defun entr/command (command) - "Create a terminal instance with entr running COMMAND. -COMMAND is a function that is called with the current filename." - ;; Algorithm: - ;; - Get buffer's filename. - ;; - Open terminator running: `echo entr <filename> | entr <command>`. - (interactive) - (with-current-buffer (current-buffer) - (let ((filename (buffer-file-name))) - (prelude/inspect - (format "echo %s | entr %s" filename (funcall command filename)))))) - -(provide 'entr) -;;; entr.el ends here |