Adding session support.

This commit is contained in:
2022-06-05 23:28:06 -04:00
parent 7d3a9d8636
commit b3157c76a8
3 changed files with 31 additions and 1 deletions

21
tcshrc
View File

@ -52,12 +52,26 @@ if( $?CSHENV_HISTORY_SIZE ) then
set history=${CSHENV_HISTORY_SIZE}
endif
# this safe_source alias is incredibly delicate. It drives the whole
if( $?CSHENV_DEBUG ) echo "Setting up optional sourcing mechanism."
# This safe_source alias is incredibly delicate. It drives the whole
# optional sourcing mechanism -- DO NOT MESS WITH IT!
alias safe_source 'eval "if ( -f \!:1 ) then \\
source \!:1 \\
endif"'
if( $?CSHENV_DEBUG ) echo "Setting up optional session sourcing mechanism."
# These reload_session and `__load_session` aliases ar incredibly delicate. They drives
# the whole optional session mechanism -- DO NOT MESS WITH IT LIGHTLY!
alias __load_session safe_source tcshrc.session.\$CSHENV_SESSION_PROFILE
if( $?CSHENV_DEBUG ) echo "Setting up optional session sourcing mechanism wrapper."
alias reload_session 'eval "if ( \$?CSHENV_SESSION_PROFILE ) then \\
__load_session \\
endif"'
if( $?CSHENV_DEBUG ) echo "Setting change session alias..."
alias change_session setenv CSHENV_SESSION_PROFILE \!:1\;__load_session
if( $?CSHENV_DEBUG ) then
echo "TCSH safe-source alias constructed..."
endif
@ -123,6 +137,11 @@ source ${CSHENV_DIR}/tcshrc.prompt
safe_source ${CSHENV_DIR}/tcshrc.user
if( $?CSHENV_DEBUG ) echo "Loading session, if one is set"
reload_session
if( $?CSHENV_DEBUG ) echo "Session loading done"
###########################
# vim: ft=tcsh
###########################

View File

@ -2,6 +2,16 @@
### Final Prompt Setting ###
############################
#if( $?CSHENV_DEBUG ) then
# echo "Loading prompt session information."
#endif
#if( $?CSHENV_SESSION_PROFILE ) then
# safe_source ${CSHENV_DIR}/tcshrc.session.prompt.${CSHENV_SESSION_PROFILE}
#endif
#if( $?CSHENV_DEBUG ) then
# echo "Loaded prompt session information."
#endif
if( $?CSHENV_DEBUG ) then
echo "Setting up dynamic colour loading..."
endif

1
tcshrc.session.default Normal file
View File

@ -0,0 +1 @@
source ${CSHENV_DIR}/tcshrc.prompt.colors