From 2a1419f623c510699dd5a8cf3c2dfb5ef9acf022 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 7 Jun 2014 22:43:46 -0400 Subject: Reorganize init-external.el --- lisp/init-external.el | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'lisp') diff --git a/lisp/init-external.el b/lisp/init-external.el index 43780c7..1c5a0bb 100644 --- a/lisp/init-external.el +++ b/lisp/init-external.el @@ -1,14 +1,14 @@ +(define-prefix-command 'external-map) +(global-set-key (kbd "C-c x") 'external-map) + +;;; Terminals + (defvar km/terminal "urxvt") (defun km/open-external-terminal () (interactive) (start-process "ext-term" nil km/terminal)) -(defadvice recompile (around restore-windows activate) - "Prevent recompiling from spawning new windows." - (save-window-excursion - ad-do-it)) - (defadvice shell-command (around shell-command-restore-windows activate) "Restore window configuraiton after shell-command. The hides the *Async Shell Command* buffer that is opened in the @@ -17,9 +17,6 @@ other window when an asynchronous command is run." ad-do-it (jump-to-register :before-shell-command)) -(define-prefix-command 'external-map) -(global-set-key (kbd "C-c x") 'external-map) - (defun km/zsh-ansi-term (&optional new-buffer) "Open an ansi-term buffer running ZSH. The buffer is named according to `default-directory'. If a buffer @@ -39,12 +36,6 @@ is non-nil, switch to the buffer." (setq buffer-name (km/zsh-ansi-term new-buffer))) (pop-to-buffer buffer-name))) -(defun km/display-compilation-other-window () - (interactive) - (-if-let (comp-buffer (get-buffer "*compilation*")) - (display-buffer comp-buffer) - (error "No compilation buffer"))) - (define-key external-map "a" 'km/zsh-ansi-term) ;; This overrides binding for `add-change-log-entry-other-window'. (define-key ctl-x-4-map "a" 'km/zsh-ansi-term-other-window) @@ -53,12 +44,24 @@ is non-nil, switch to the buffer." (define-key external-map "s" 'shell-command) (define-key external-map "S" 'shell) +(define-key external-map "w" 'woman) + +;;; Compilation + +(defadvice recompile (around restore-windows activate) + "Prevent recompiling from spawning new windows." + (save-window-excursion + ad-do-it)) + +(defun km/display-compilation-other-window () + (interactive) + (-if-let (comp-buffer (get-buffer "*compilation*")) + (display-buffer comp-buffer) + (error "No compilation buffer"))) + (define-key external-map "c" 'compile) (define-key external-map "g" 'recompile) (define-key external-map "o" 'km/display-compilation-other-window) - -(define-key external-map "w" 'woman) - ;; Give frequently-used recompile a shorter binding. (global-set-key (kbd "C-c g") 'recompile) -- cgit v1.2.3