From 1d562af8927d932bc3329de3b06c94a966047238 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 30 Jan 2023 17:33:06 -0600 Subject: Add a bunch of stuff Forgot I had to `git add -f' these! --- bash/emacs.bash | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 bash/emacs.bash (limited to 'bash/emacs.bash') diff --git a/bash/emacs.bash b/bash/emacs.bash new file mode 100644 index 0000000..188c64f --- /dev/null +++ b/bash/emacs.bash @@ -0,0 +1,29 @@ +# Shell-side configuration for Emacs-based shells + +setup_vterm() { + ## https://github.com/akermu/emacs-libvterm#shell-side-configuration + ## Make sure this is the last file loaded by ~/.bashrc! + + # Load the requisite code from the vterm install directory + if [[ "$INSIDE_EMACS" = 'vterm' ]] \ + && [[ -n ${EMACS_VTERM_PATH} ]] \ + && [[ -f ${EMACS_VTERM_PATH}/etc/emacs-vterm-bash.sh ]]; then + source ${EMACS_VTERM_PATH}/etc/emacs-vterm-bash.sh + fi + + # Extra commands for `vterm-eval-cmds' + find_file() { vterm_cmd find-file "$(realpath "${@:-.}")"; } + say() { vterm_cmd message "%s" "$*"; } +} + +setup_emacs_shell() { + export PAGER=cat + export PS1='\w \$ ' +} + +# CONSIDER: Could this go in ~/.profile ? +case "$INSIDE_EMACS" in + '') ;; # not inside emacs + vterm) setup_vterm ;; + *) setup_emacs_shell ;; +esac -- cgit 1.4.1-21-gabe81