summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2012-05-15 14:34:37 +0200
committerAlexander Sulfrian <alexander@sulfrian.net>2012-05-15 14:34:37 +0200
commitd3b010f8d391cf90e1e3710537a68115ef4b55eb (patch)
tree3232fe5e7bf34d2795ed041899d254664759ec25
parent57bdb9166577ec76ef629a3202e295431c4795e9 (diff)
downloaddotfiles-d3b010f8d391cf90e1e3710537a68115ef4b55eb.tar.gz
dotfiles-d3b010f8d391cf90e1e3710537a68115ef4b55eb.tar.xz
dotfiles-d3b010f8d391cf90e1e3710537a68115ef4b55eb.zip
emacs: add quick open shell function
open-buffer-shell<f12> open an urxvt in the directory of the file in the current buffer
-rw-r--r--emacs15
-rw-r--r--emacs.elcbin10792 -> 11153 bytes
2 files changed, 15 insertions, 0 deletions
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 "<f12>") 'open-buffer-shell)
diff --git a/emacs.elc b/emacs.elc
index 748ff8a..0aa03be 100644
--- a/emacs.elc
+++ b/emacs.elc
Binary files differ