From 5cd9fdc6a94b5459ee0bbe1f2bc6ca7d4c4f3613 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Sat, 14 Jan 2017 00:14:05 +0100 Subject: [PATCH] Open new terminal in current folder from emacs --- Xsession/.xprofile | 1 + emacs/.emacs.d/init.el | 10 ++++++++++ zsh/.zprofile | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Xsession/.xprofile b/Xsession/.xprofile index 3fc63a3..6e76431 100755 --- a/Xsession/.xprofile +++ b/Xsession/.xprofile @@ -2,3 +2,4 @@ setxkbmap us altgr-intl -option ctrl:nocaps #xmodmap ~/.Xmodmap #source ~/.xinitrc +export XTERMINAL='termite' diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 7aa8527..d06fd05 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -687,6 +687,7 @@ ) ) +(setq PREVSHELL (getenv "SHELL")) ;; Workaround for tramp (eval-after-load 'tramp '(setenv "SHELL" "/bin/bash")) (setq tramp-default-method "ssh") @@ -709,5 +710,14 @@ (setenv "PATH" (concat (getenv "PATH") ":" (getenv "HOME") "/.bin" ":" (getenv "HOME") "/.local/bin")) (setq exec-path (append exec-path (list (concat (getenv "HOME") "/.bin") (concat (getenv "HOME") ".local/bin") "/usr/bin"))) +;; Launch terminal + +(defun open-terminal () + (interactive) + (call-process (or (getenv "XTERMINAL") "xterm") nil 0 nil "-e" PREVSHELL)) +;; This does not work: (concat "echo -c 'cd " default-directory "'")) + +(global-set-key (kbd "C-c t") 'open-terminal) + (provide '.init) ;;; init.el ends here diff --git a/zsh/.zprofile b/zsh/.zprofile index fa84718..1c86c7f 100644 --- a/zsh/.zprofile +++ b/zsh/.zprofile @@ -18,7 +18,7 @@ fi # export EDITOR='vi' -export VISUAL="myemacs -t" +export VISUAL="myemacs -c" export ALTERNATE_EDITOR="" export PAGER='less'