PSF: Stabilizing workspace after crash. Valid kernel/skill fixes.
This commit is contained in:
19
projects/org-skill-context-manager/src/context-manager.lisp
Normal file
19
projects/org-skill-context-manager/src/context-manager.lisp
Normal file
@@ -0,0 +1,19 @@
|
||||
(defvar *context-stack* nil)
|
||||
|
||||
(defun context-push (new-context)
|
||||
"Push a new context (usually a path or a plist) onto the stack."
|
||||
(push new-context *context-stack*)
|
||||
(kernel-log "CONTEXT - Pushed: ~a" new-context))
|
||||
|
||||
(defun context-pop ()
|
||||
"Pop the top context from the stack."
|
||||
(let ((old (pop *context-stack*)))
|
||||
(kernel-log "CONTEXT - Popped: ~a" old)
|
||||
old))
|
||||
|
||||
(defun context-resolve-path (path)
|
||||
"Resolve PATH relative to the current context if it's a directory, otherwise return as is."
|
||||
(let ((current (car *context-stack*)))
|
||||
(if (and current (stringp current) (uiop:directory-pathname-p current))
|
||||
(merge-pathnames path current)
|
||||
path)))
|
||||
Reference in New Issue
Block a user