diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2023-03-06 17:11:31 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2023-03-09 09:50:20 -0700 |
commit | 4994d2cb149e69b6f67cf5ff3d62bd4a04b574e1 (patch) | |
tree | 6435a6ff07dbcd5440cc4d74262f70bd0874e6b5 | |
parent | 5336ab9665375a80ea136c5464b5e5a98ce379b5 (diff) | |
download | dotfiles-4994d2cb149e69b6f67cf5ff3d62bd4a04b574e1.tar.gz |
add Lisp's cwd & hostname to slime-repl header-line-format
-rw-r--r-- | .emacs.d/init.el | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el index abce0f2e..fd2468de 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -4410,7 +4410,27 @@ that the user is expecting that it might pop up." (apply orig-fun args)))) (setq spw/last-slime-async-eval-command-frame nil)) +(defun spw/slime-repl-header-line (&optional pwd) + (with-current-buffer (slime-connection-output-buffer) + (let* ((pwd (abbreviate-file-name + (string-remove-suffix + "/" (or pwd (slime-eval '(swank:default-directory)))))) + (conn (slime-connection)) + (host (car (process-contact conn)))) + (setq header-line-format + (format "%s@%s:%s Port: %s Pid: %s" + (slime-lisp-implementation-type) + (if (string= "localhost" host) system-name host) + (propertize pwd 'face 'bold) + (slime-connection-port conn) (slime-pid)))))) +(advice-add 'slime-repl-insert-banner :before #'spw/slime-repl-header-line) +(advice-add 'slime-set-default-directory :after #'spw/slime-repl-header-line) +(with-eval-after-load 'slime-repl + (add-hook 'slime-change-directory-hooks #'spw/slime-repl-header-line)) + (with-eval-after-load 'slime + (setq slime-contribs (remq 'slime-banner slime-contribs)) + (defvar spw/last-command-was-slime-async-eval nil) (defvar spw/last-slime-async-eval-command-frame nil) |