Do not search for package on non existant source

This commit is contained in:
David Botton 2024-03-19 11:07:47 -04:00
parent 91ed486d8b
commit 434bb77077

View file

@ -244,13 +244,14 @@ var endRange = ~:*~A.session.doc.indexToPosition(endIndex);
(defun get-package-from-string (c)
"Determine the currect package based on src contained in string C"
(with-input-from-string (ins c)
(loop
(let ((form (read ins nil)))
(unless form (return "clog-user"))
(unless (consp form) (return "clog-user"))
(when (eq (car form) 'in-package)
(return (string-downcase (second form))))))))
(when (typep c 'string)
(with-input-from-string (ins c)
(loop
(let ((form (read ins nil)))
(unless form (return "clog-user"))
(unless (consp form) (return "clog-user"))
(when (eq (car form) 'in-package)
(return (string-downcase (second form)))))))))
;; Expand region