branch: elpa/emacsql
commit 01f3d3eb2b05f4c50ce9f30f3f561c865fd5ba95
Author: Jonas Bernoulli <jo...@bernoul.li>
Commit: Jonas Bernoulli <jo...@bernoul.li>

    Fallback to buffer-file-name when load-file-name is nil
    
    Without this loading the library by evaluating the buffer would fail.
---
 emacsql.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/emacsql.el b/emacsql.el
index bc8f07f5e5..1919b5c963 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -82,7 +82,8 @@
   "Maximum number of seconds to wait before bailing out on a SQL command.
 If nil, wait forever.")
 
-(defvar emacsql-data-root (file-name-directory load-file-name)
+(defvar emacsql-data-root
+  (file-name-directory (or load-file-name buffer-file-name))
   "Directory where EmacSQL is installed.")
 
 (defclass emacsql-connection ()

Reply via email to