jj-open-shell opens a new xterm in the directory of my current buffer
[emacs.git] / .emacs.d / elisp / local / ganneff.el
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