diff options
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/elisp/ap-functions.el | 6 | ||||
-rw-r--r-- | emacs/init.el | 31 |
2 files changed, 33 insertions, 4 deletions
diff --git a/emacs/elisp/ap-functions.el b/emacs/elisp/ap-functions.el index b6994643..104b4449 100644 --- a/emacs/elisp/ap-functions.el +++ b/emacs/elisp/ap-functions.el @@ -37,10 +37,10 @@ (byte-compile-dest-file filename)))))) ;;;###autoload -(defun shell-execute () - (interactive) +(defun shell-execute (to-current-buffer) + (interactive "P") (let ((file-buffer (if (buffer-file-name) (file-name-nondirectory (buffer-file-name)) "")) (command (read-shell-command "Shell command: " nil nil nil))) - (shell-command (replace-regexp-in-string "%" file-buffer command)))) + (shell-command (replace-regexp-in-string "%" file-buffer command) to-current-buffer))) diff --git a/emacs/init.el b/emacs/init.el index 71c2ffbc..1092e9bd 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -9,6 +9,8 @@ user-full-name "Alan Pearce" custom-file "~/.emacs.d/custom.el") +(load custom-file :noerror) + ;;; Allow lisps to use a common setup. I don't know why they don't have some lispy mode as their parent, but this is close enough (defcustom lisp-common-mode-hook nil "Hook run when entering any Lisp mode." @@ -47,7 +49,10 @@ Values: `desktop', `server', `laptop'") (interactive) (setq env/location (env/get-location))) -(defvar *init-file* (expand-file-name "init.el" (file-name-directory (file-truename user-init-file))) +(defvar *init-file* + (when user-init-file + (expand-file-name "init.el" + (file-name-directory (file-truename user-init-file)))) "Where the emacs init file really is, passing through symlinks.") ;;;; Package Management @@ -576,6 +581,7 @@ Values: `desktop', `server', `laptop'") ;;;; Planning (use-package org + :ensure org-plus-contrib :bind (("C-c C-a" . org-agenda-list) ("C-c a" . org-agenda) ("C-c l" . org-store-link) @@ -763,6 +769,7 @@ Also returns nil if pid is nil." eshell-smart-space-goes-to-end t) (eshell-smart-initialize))))) +(autoload #'eshell/cd "em-dirs") (defun eshell-goto-current-dir (&optional arg) (interactive "P") (let ((dir default-directory)) @@ -908,10 +915,16 @@ Also returns nil if pid is nil." (setq indent-tabs-mode nil) (local-set-key (kbd "RET") #'paredit-newline)) +(defun set-common-lisp-indentation () + (set (make-local-variable 'lisp-indent-function) + #'common-lisp-indent-function)) + (add-hook 'emacs-lisp-mode-hook #'ap/lisp-setup) (add-hook 'emacs-lisp-mode-hook #'turn-on-eldoc-mode) (add-hook 'scheme-mode-hook #'ap/lisp-setup) +(add-hook 'lisp-mode-hook #'ap/lisp-setup) +(add-hook 'lisp-mode-hook #'set-common-lisp-indentation) (use-package bytecomp :defer t @@ -973,6 +986,18 @@ Also returns nil if pid is nil." (add-hook 'emacs-lisp-mode-hook 'imenu-elisp-sections) +(defun eval-and-replace () + "Replace the preceding sexp with its value." + (interactive) + (backward-kill-sexp) + (condition-case nil + (prin1 (eval (read (current-kill 0))) + (current-buffer)) + (error (message "Invalid expression") + (insert (current-kill 0))))) + +(bind-key "C-c e" #'eval-and-replace) + ;;;; Programming (use-package auto-compile @@ -1085,6 +1110,10 @@ Works with: arglist-cont-nonempty, arglist-close." ("\\.mt\\'" . mustache-mode) ("\\.template\\'" . mustache-mode))) +(use-package jinja2-mode + :ensure t + :mode (("\\.j2\\'" . jinja2-mode))) + (use-package nxhtml-mode :defer t :if (eq env/system-type 'laptop) |