From abb9ed327f766c82e0d5d5060afc6cf8a4c88fdc Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Fri, 17 Mar 2023 14:05:15 -0400 Subject: fix shell handling and C-t rebind --- emacs/.config/emacs-kj/init.el | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'emacs/.config') diff --git a/emacs/.config/emacs-kj/init.el b/emacs/.config/emacs-kj/init.el index c26b876..fc47bc5 100644 --- a/emacs/.config/emacs-kj/init.el +++ b/emacs/.config/emacs-kj/init.el @@ -115,21 +115,20 @@ (defun kj/shell-here () (interactive) - (shell (kj/shell-buffer-name))) - -(add-hook 'shell-mode-hook - (defun kj/kill-shell-buffer-on-exit () - (let* ((proc (get-buffer-process (current-buffer))) - (sentinel (process-sentinel proc))) - (set-process-sentinel - proc - `(lambda (proc signal) - (funcall ',sentinel proc signal) - (and (memq (process-status proc) '(exit signal)) - (buffer-live-p (process-buffer proc)) - (message "Shell died, killing buffer %s" - (process-buffer proc)) - (kill-buffer (process-buffer proc)))))))) + (let ((buffer + (shell (kj/shell-buffer-name)))) + (with-current-buffer buffer + (let* ((proc (get-buffer-process (current-buffer))) + (sentinel (process-sentinel proc))) + (set-process-sentinel + proc + `(lambda (proc signal) + (funcall ',sentinel proc signal) + (and (memq (process-status proc) '(exit signal)) + (buffer-live-p (process-buffer proc)) + (message "Shell died, killing buffer %s" + (process-buffer proc)) + (kill-buffer (process-buffer proc))))))))) (add-hook 'comint-output-filter-functions #'comint-osc-process-output) @@ -212,7 +211,9 @@ (savehist-mode)) ;; Rebind C-x? -(define-key key-translation-map "\C-t" "\C-x") +(global-set-key (kbd "C-t") 'ctrl-x-map) +(define-key global-map (kbd "C-t") ctl-x-map) +;; (define-key key-translation-map "\C-t" "\C-t") ;; (define-key key-translation-map "\C-x" "\C-t") (use-package marginalia -- cgit v1.2.3