(defun define-word () ;; TODO: needs refinement (interactive) (let ((myword (word-at-point))) ;; (message (shell-command-to-string (concat "mw " myword))))) (with-current-buffer (current-buffer) (save-excursion (set-buffer "worddef") (erase-buffer))) (call-process "mw" nil "worddef" nil myword) (with-current-buffer (current-buffer) (save-excursion (set-buffer "worddef") (ansi-color-apply-on-region (point-min) (point-max)))) (display-buffer-pop-up-window (get-buffer "worddef") '()))) ;; for tidying sexps (defun easy-indent-sexp () (interactive) (end-of-defun) (backward-sexp) (indent-pp-sexp) (forward-sexp)) (define-key lisp-mode-map (kbd "M-q") 'easy-indent-sexp) (define-key emacs-lisp-mode-map (kbd "M-q") 'easy-indent-sexp) ;; for writing keybindings and notes (defun notate-key-sequence () (interactive) (insert (key-description (cdar (help--read-key-sequence t))))) (define-key global-map (kbd "C-c c") 'notate-key-sequence) ;; for working with messy json (defun tidy-json () "Tidies the json in the buffer using python." (interactive) (shell-command-on-region (point-min) (point-max) "python3 -m json.tool" (current-buffer) t "*Python Json Error Buffer*" t))