jj-open-shell opens a new xterm in the directory of my current buffer
authorJoerg Jaspert <joerg@ganneff.de>
Thu, 22 Aug 2013 14:12:02 +0000 (16:12 +0200)
committerJoerg Jaspert <joerg@ganneff.de>
Thu, 22 Aug 2013 14:12:02 +0000 (16:12 +0200)
.emacs.d/config/emacs.org
.emacs.d/elisp/local/ganneff.el

index 90675fe..1fbb7cc 100644 (file)
@@ -690,6 +690,12 @@ past EOL), no argument copies rest of line.
 (require 'misc)
 (global-set-key (kbd "H-y") 'copy-from-above-command)
 #+END_SRC
+
+Open a new X Terminal pointing to the directory of the current
+buffers path.
+#+BEGIN_SRC emacs-lisp tangle:yes
+(global-set-key (kbd "H-t") 'jj-open-shell)
+#+END_SRC
 **** ace-jump-mode
 [2013-04-28 So 11:26]
 
index b1eb54a..a28c112 100644 (file)
@@ -216,6 +216,18 @@ This functions should be added to the hooks of major modes for programming."
    nil '(("\\<\\(FIX\\(ME\\)?\\|TODO\\|OPTIMIZE\\|HACK\\|REFACTOR\\):"
           1 font-lock-warning-face t))))
 
+;;;###autoload
+(defun jj-open-shell ()
+  "Open a shell in the directory of the current buffer file"
+
+  (interactive)
+  (when buffer-file-name
+    (setenv "ZSTARTDIR" (file-truename buffer-file-name)))
+  (when dired-directory
+    (message dired-directory)
+    (setenv "ZSTARTDIR" (concat (file-truename dired-directory) "/dired")))
+  (start-process "yay" nil "/usr/bin/x-terminal-emulator"))
+
 (provide 'ganneff)
 
 ;;; ganneff.el ends here