Start a new topic

BiwaScheme - Loading other files

I love the init.org customization configuration so much! And managed mine over

GitHub, 

https://github.com/jsntn/beorg-init.org


As the configuration file extends, I would like to move some of the sections from

init.org. Like I have a template (set! item-templates ...) with long notes, in

this case, I want a separate configuration file - item-templates.org with that,

and from the init.org, I can load it with the BiwaScheme 'load' function - (load

path), which I referred from https://www.biwascheme.org/doc/reference.html


I tried that on current beorg 3.20.2 (285), and it seems this load function of

BiwaScheme currently is not supported.


In this case, please allow me to ask if this can be supported in the future?


 

 

 


You should be able to use load, although beorg overrides the BiwaScheme version with its own. What I probably haven't documented is that you need to remove the file extension and provide the filename as a symbol (I can't remember why I coded it that way, it sounds very confusing as I write this!). The following should work:


(load 'item-templates)


Let me know how you get on!



Hi Matthew, thanks so much for your prompt reply!


This is really awesome! And it works like a charm.


I've also got some findings that - once the item-templates.org is loaded, the beorg will not recognize any of the other commands in the init.org after item-templates.org. If I put the ";" in front of the (load 'item-templates.org) and save, the other commands (after item-templates.org) work fine, and of course it does not load the item-templates.org. e.g.,

#+BEGIN_SRC scheme
  (load 'item-templates)
#+END_SRC

#+BEGIN_SRC scheme
  (set! sync-subfolders #t) ; <-- this will not be effective
#+END_SRC

I suppose this is because the `load' function looks for the file path, and if it finds it, it exits after applying the config (in item-templates.org) rather than continuing the rest of the config in init.org. Please kindly correct me if I'm wrong.


In this case, currently, I move my item-templates.org loading at the end of my init.org to fix this, like this,

#+BEGIN_SRC scheme
  (set! sync-subfolders #t)
#+END_SRC

#+BEGIN_SRC scheme
  (load 'item-templates) ; make this `load' at the end of init.org
#+END_SRC

 

 

 

 

 

 

 

 

 

 

 

 

 

In this regard, one thing that is not convenient for me is - I have two templates config, say one is item-templates-a.org, and the other one is item-templates-b.org.


Currently, I make my config like this,


init.org:

#+BEGIN_SRC scheme
  (set! sync-subfolders #t)
#+END_SRC

#+BEGIN_SRC scheme
  (load 'item-templates-a)
#+END_SRC

 

item-templates-a.org:

#+BEGIN_SRC scheme
  (set! item-templates
        ...)
#+END_SRC

#+BEGIN_SRC scheme
  (load 'item-templates-b)
#+END_SRC

 

item-templates-b.org:

#+BEGIN_SRC scheme
  (set! item-templates (append item-templates
                               ...)
#+END_SRC

 I will appreciate having your suggestion to improve this!

 

 

That's a good point, you're right in that beorg will discontinue executing the current script when load is used. I'll need to look at how this can be fixed.


1 person likes this

OK, that will be great! And thanks for the reply!


 

Login or Signup to post a comment