From 6e5a6113af29dcc2380e6884fb49ed0e4fcbe16d Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Mon, 24 Nov 2014 20:50:25 +0100 Subject: allow disabling of buffer sessions. in sample.teco_ini, disable sessions automatically when files are given. this allows you to use sciteco in a Git repository to edit a specific file, without changing the buffer session. Also useful if SciTECO is used as the GIT_EDITOR without thrashing the repository's session every time a commit message is edited. --- lib/session.tes | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/session.tes') diff --git a/lib/session.tes b/lib/session.tes index 99dce52..9b924bc 100644 --- a/lib/session.tes +++ b/lib/session.tes @@ -1,16 +1,18 @@ ! Macros for saving and loading buffer sessions ! ! Path of the session profile. - Change this to save/load a custom profile ! + Change this to save/load a custom profile. + If empty, no session will be saved. ! EU[session.path]Q[$SCITECOCONFIG]/.teco_session ! Save current session to the file specified by "session.path" ! @[session.save]{ + :Q[session.path]"= Oend ' Q*U.[curbuf] EJ< %.bEB ESGETFIRSTVISIBLELINEU.[fvline] ESGETXOFFSETU.[xoff] .U.[dot] :@EU.[session]{EBQ* \.[fvline]ESSETFIRSTVISIBLELINE \.[xoff]ESSETXOFFSET \.[dot]:J^M} - EQ* Z"= -1U.u ' + :Q*"= -1U.u ' > ! We always start with an unnamed file in the ring, so we may have to remove it: ! Q.u"F :@EU.[session]{EB -EF^M} ' @@ -18,11 +20,12 @@ EU[session.path]Q[$SCITECOCONFIG]/.teco_session E%.[session]Q[session.path] Q.[curbuf]EB -} +!end!} ! Load session specified by "session.path" ! @[session.load]{ EJ<-EF> + ! now we have only one unnamed buffer ! EQ.x ENQ[session.path] Z"= 1EB -- cgit v1.2.3