From 3b77cea165c47d617035c3fb622aaa9cfcc3bcaa Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 22 Jun 2013 09:05:40 +0100 Subject: Emacs: setup jinja2-mode --- emacs/init.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 5f323a6f..b9b29e16 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1077,6 +1077,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) -- cgit 1.4.1 From bd70cf69863edb293f2cf4a14275327ea411fdcf Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 22 Jun 2013 10:04:20 +0100 Subject: Emacs: don't initialise *init-file* when user-init-file is not set --- emacs/init.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index b9b29e16..6ab12fe4 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -47,7 +47,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 -- cgit 1.4.1 From 189f41ba7afb45813b810810472793f5c9f0c7fa Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 22 Jun 2013 10:04:31 +0100 Subject: Emacs: load custom file --- emacs/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 6ab12fe4..f65b1386 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." -- cgit 1.4.1 From eeb7399103580db187077cbb2aa406348e3a6b6c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 22 Jun 2013 10:04:57 +0100 Subject: Emacs: fix compilation warning regarding eshell/cd --- emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/init.el b/emacs/init.el index f65b1386..9d658ab1 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -760,6 +760,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)) -- cgit 1.4.1 From 47587e317708996e6966adf23859e39194869fba Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 30 Jun 2013 12:08:49 +0100 Subject: Emacs: ensure org-mode package with contrib/ is installed --- emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/init.el b/emacs/init.el index 9d658ab1..43a1314b 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -573,6 +573,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) -- cgit 1.4.1 From 5905ec6debb6dcf9df9843b8f166305c849f0e61 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 17 Jul 2013 13:57:05 +0100 Subject: Make shell-execute work with a universal prefix argument --- emacs/elisp/ap-functions.el | 6 +++--- 1 file changed, 3 insertions(+), 3 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))) -- cgit 1.4.1 From f26545a8cb75a4aeb0773ac309d8145aeb087d1d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 29 Jul 2013 14:08:04 +0100 Subject: zshrc: add X11 window role to wprop alias --- zsh/zshrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zsh/zshrc b/zsh/zshrc index 938dcbd9..c017029f 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -275,7 +275,8 @@ alias E="SUDO_EDITOR=\emacsclient -c -a emacs\" sudoedit" alias aticonfig="DISPLAY=:0 \aticonfig" alias wprop='xprop |awk '\'' /^WM_CLASS/{sub(/.* =/, "instance:"); sub(/,/, "\nclass:"); print} - /^WM_NAME/{sub(/.* =/, "title:"); print}'\''' + /^WM_NAME/{sub(/.* =/, "title:"); print} + /^WM_WINDOW_ROLE/{sub(/.* =/, "role:"); print}'\''' alias -g ...='../..' -- cgit 1.4.1 From 72aa9219773cb0717c4f27a28056c4fef5ce2e6a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 29 Jul 2013 14:08:53 +0100 Subject: Emacs: add eval-and-replace and bind to C-c e --- emacs/init.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 43a1314b..26defe92 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -972,6 +972,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 -- cgit 1.4.1 From b17e1928f120ba559929754a26e77b0c04d0aeb9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 29 Jul 2013 14:10:02 +0100 Subject: Emacs: improve configuration of common-lisp mode --- emacs/init.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 26defe92..1278c556 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -907,10 +907,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 -- cgit 1.4.1 From 1ba96a0584267853ff15e255bfae7afb39bceb7c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 29 Jul 2013 15:42:44 +0100 Subject: zsh: check for gem directory and add bin folder to path if found --- zsh/zshrc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zsh/zshrc b/zsh/zshrc index c017029f..3bf6e3b9 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -10,6 +10,13 @@ then $defpath ~/bin ) + if [[ -d ~/.gem/ruby ]] + then + path=( + $path + ~/.gem/ruby/*/bin + ) + fi fi if [[ ! -d ~/.zsh/cache ]] -- cgit 1.4.1