From d3b010f8d391cf90e1e3710537a68115ef4b55eb Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Tue, 15 May 2012 14:34:37 +0200 Subject: emacs: add quick open shell function open-buffer-shell open an urxvt in the directory of the file in the current buffer --- emacs | 15 +++++++++++++++ emacs.elc | Bin 10792 -> 11153 bytes 2 files changed, 15 insertions(+) diff --git a/emacs b/emacs index 0533131..fc1afa7 100644 --- a/emacs +++ b/emacs @@ -419,3 +419,18 @@ If this is set during find-file, flyspell mode gets enabled automaticaly.") (call-process "wmctrl" nil nil nil "-i" "-R" (frame-parameter (or frame (selected-frame)) 'outer-window-id))) + +;; quick open shell +(defun dirname (file) + (replace-regexp-in-string "[^/]*$" "" file)) + +(defun open-buffer-shell () + (interactive) + (if buffer-file-name + (start-process-shell-command + "urxvt" + nil + (concat "DIR=" (dirname buffer-file-name) " urxvt")) + (message "Buffer does not contain a file."))) + +(global-set-key (kbd "") 'open-buffer-shell) diff --git a/emacs.elc b/emacs.elc index 748ff8a..0aa03be 100644 Binary files a/emacs.elc and b/emacs.elc differ -- cgit v1.2.3