branch: elpa/scad-mode
commit 0382a7699d84f5d96182d8dee742931ee976455d
Merge: 2dc2457650 38e715440b
Author: Daniel Mendler <m...@daniel-mendler.de>
Commit: GitHub <nore...@github.com>

    Merge pull request #8 from LoganBarnett/fix-local-encludes-with-env-var
    
    set OPENSCADPATH to fix relative includes in preview
---
 scad-mode.el | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/scad-mode.el b/scad-mode.el
index 4add48cd92..3c8ab21e3f 100644
--- a/scad-mode.el
+++ b/scad-mode.el
@@ -311,6 +311,14 @@ Options are .stl, .off, .amf, .3mf, .csg, .dxf, .svg, 
.pdf, .png,
         (save-restriction
           (widen)
           (write-region (point-min) (point-max) infile nil 'nomsg)))
+      ;; A means of setting an environment variable for the purposes of
+      ;; `make-process' can't be found or isn't documented.  Setting the
+      ;; environment variable within Emacs causes the process to inherit the
+      ;; environment variable, which is the only known means of passing the
+      ;; variable.
+      ;; Setting the OPENSCADPATH to the current directory allows openscad to
+      ;; pick up other local files with `include <file.scad>'.
+      (setenv "OPENSCADPATH" default-directory)
       (setq scad--preview-proc
             (make-process
              :noquery t
@@ -450,6 +458,14 @@ Options are .stl, .off, .amf, .3mf, .csg, .dxf, .svg, 
.pdf, .png,
     (save-restriction
       (widen)
       (write-region (point-min) (point-max) infile nil 'nomsg))
+    ;; A means of setting an environment variable for the purposes of
+    ;; `make-process' can't be found or isn't documented.  Setting the
+    ;; environment variable within Emacs causes the process to inherit the
+    ;; environment variable, which is the only known means of passing the
+    ;; variable.
+    ;; Setting the OPENSCADPATH to the current directory allows openscad to 
pick
+    ;; up other local files with `include <file.scad>'.
+    (setenv "OPENSCADPATH" default-directory)
     (setq
      scad--flymake-proc
      (make-process

Reply via email to