countvajhula / mindstream

Start writing (or coding), stay focused, don't worry.
Other
31 stars 3 forks source link

Working in nested paths does not iterate #25

Open countvajhula opened 3 months ago

countvajhula commented 3 months ago

We currently add the default-directory of the buffer to mindstream-active-sessions when a session is started. Then, when save-buffer is called, we check to see if default-directory is an active session before committing in Git.

In multi-file / full repo settings: when we are in nested folders, or if the initial buffer we were in when we entered the session was in a nested folder, working at a different level of nesting in the same repo does not create any commits because the above logic doesn't detect the buffer as being in a valid session.

That is, the session is identified by a specific directory path rather than by a repo base path.

This can be fixed by:

  1. Adding not default-directory but instead the containing Git repo base directory (how to determine this?) to the list of active sessions when a session is begun.
  2. Likewise, considering a buffer to be in an active session if the containing git repo base path (if any) is in active sessions.

This would also be implicitly addressed if we eliminate global state and rely on branch name prefix of mindstream- (or another similar approach) to determine whether a buffer is in an active session (i.e. #24 ).

countvajhula commented 2 months ago

Note that as of #28 , this issue only affects saved sessions and not anonymous sessions, as the latter now avoid relying on the session registry ("global state").