summary refs log tree commit diff stats
path: root/emacs
diff options
context:
space:
mode:
authorAlan Pearce2013-08-02 10:32:18 +0100
committerAlan Pearce2013-08-02 10:32:18 +0100
commitcfc894f238825d3c7079eae2c6d9fb7798a0d0be (patch)
treee7fe7d5d4b68e387784a92684d78fb5d3b269e53 /emacs
parent1e5ba0b55f289e00d9c78683b79aefc9fd55f4e2 (diff)
parent1ba96a0584267853ff15e255bfae7afb39bceb7c (diff)
downloadnixfiles-cfc894f238825d3c7079eae2c6d9fb7798a0d0be.tar.lz
nixfiles-cfc894f238825d3c7079eae2c6d9fb7798a0d0be.tar.zst
nixfiles-cfc894f238825d3c7079eae2c6d9fb7798a0d0be.zip
Merge branch 'master' of home:dotfiles
Diffstat (limited to 'emacs')
-rw-r--r--emacs/elisp/ap-functions.el6
-rw-r--r--emacs/init.el31
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)