From 0d5f9e460586f3276242ca9cf6c7a51522a58fda Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Wed, 17 Feb 2016 06:03:29 -0800 Subject: [emacs] Rename a few functions and update bindings --- emacs.d/core/core-bindings.el | 4 ++-- emacs.d/core/core-defun.el | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/emacs.d/core/core-bindings.el b/emacs.d/core/core-bindings.el index 91fc32a..377b89c 100644 --- a/emacs.d/core/core-bindings.el +++ b/emacs.d/core/core-bindings.el @@ -4,8 +4,8 @@ (global-set-key (kbd "") 'toggle-frame-fullscreen) -(global-set-key (kbd "C-c C-d") 'fcuny-terminal) +(global-set-key (kbd "C-c s") 'fcuny/visit-term-buffer) -(global-set-key (kbd "s-N") 'switch-to-scratch) +(global-set-key (kbd "s-N") 'fcuny/switch-to-scratch) (provide 'core-bindings) diff --git a/emacs.d/core/core-defun.el b/emacs.d/core/core-defun.el index a2fb02f..5180e68 100644 --- a/emacs.d/core/core-defun.el +++ b/emacs.d/core/core-defun.el @@ -1,12 +1,4 @@ -(defun fcuny-terminal () - "Switch to terminal. Launch if nonexistent." - (interactive) - (if (get-buffer "*ansi-term*") - (switch-to-buffer "*ansi-term*") - (ansi-term "/bin/bash")) - (get-buffer-process "*ansi-term*")) - -(defun switch-to-scratch () +(defun fcuny/switch-to-scratch () "Switch to scratch, grab the region if it's active." (interactive) (let ((contents @@ -19,7 +11,7 @@ (goto-char (buffer-end 1)) (insert contents))))) -(defun rename-this-buffer-and-file () +(defun fcuny/rename-this-buffer-and-file () "Renames current buffer and file it is visiting." (interactive) (let ((name (buffer-name)) @@ -37,4 +29,14 @@ (set-buffer-modified-p nil) (message "File '%s' successfully renamed to '%s'" name (file-name-nondirectory new-name)))))))) +(defun fcuny/visit-term-buffer () + "Create or visit a terminal buffer." + (interactive) + (if (not (get-buffer "*ansi-term*")) + (progn + (split-window-sensibly (selected-window)) + (other-window 1) + (ansi-term (getenv "SHELL"))) + (switch-to-buffer-other-window "*ansi-term*"))) + (provide 'core-defun) -- cgit 1.4.1