Skip to main content
updated links
Source Link
Gangula
  • 429
  • 2
  • 13

How to evaluate the expressions or functions in a code-block before tangling a source code block?

  • I generate my init.el file using org-babel-tangle
    AND
  • I'm using chemacs2chemacs2 - which allows using multiple configurations parallely. Chemacs2 uses a special file called .emacs-profiles.el where we store location and environment properties of each of the configurations as mentioned below.

But the .emacs-profiles.el file cannot have any functions since it doesn't understand how to process them as mentioned here & here.

So, I'm looking for a way to evaluate the functions and replace the code content with the result. According to the documentation, we can use org-babel-pre-tangle-hook for this, but I'm very new to elisp and I'm not sure how to write the hook.

Please note that I have a working configuration with chemacs that handles multiple configurations like spacemacs, doom emacs... But the .emacs-profiles.el config is specific to my current windows PC - since it mentions C:\\Users\\<username> in the file path. So I cannot directly use the same .emcas-profiles.el config in another system as is without updating the <username>. That's the reason I'm looking for this approach.


Below is the source code block that I want to be evaluated:

( ("default" . ((user-emacs-directory . "~/emacs-configs/my-config") (env . ( ("HOME" . (concat (getenv "APPDATA") "\\AG-Emacs"))) )))) ) 

I want this to be evaluated and tangled like this:

( ("default" . ((user-emacs-directory . "~/emacs-configs/my-config") (env . ( ("HOME" . "C:\\Users\\<username>\\AppData\\Roaming\\AG-Emacs") )))) ) 

Useful/Similar resources I found:

How to evaluate the expressions or functions in a code-block before tangling a source code block?

  • I generate my init.el file using org-babel-tangle
    AND
  • I'm using chemacs2 - which allows using multiple configurations parallely. Chemacs2 uses a special file called .emacs-profiles.el where we store location and environment properties of each of the configurations as mentioned below.

But the .emacs-profiles.el file cannot have any functions since it doesn't understand how to process them as mentioned here & here.

So, I'm looking for a way to evaluate the functions and replace the code content with the result. According to the documentation, we can use org-babel-pre-tangle-hook for this, but I'm very new to elisp and I'm not sure how to write the hook.

Please note that I have a working configuration with chemacs that handles multiple configurations like spacemacs, doom emacs... But the .emacs-profiles.el config is specific to my current windows PC - since it mentions C:\\Users\\<username> in the file path. So I cannot directly use the same .emcas-profiles.el config in another system as is without updating the <username>. That's the reason I'm looking for this approach.


Below is the source code block that I want to be evaluated:

( ("default" . ((user-emacs-directory . "~/emacs-configs/my-config") (env . ( ("HOME" . (concat (getenv "APPDATA") "\\AG-Emacs"))) )))) ) 

I want this to be evaluated and tangled like this:

( ("default" . ((user-emacs-directory . "~/emacs-configs/my-config") (env . ( ("HOME" . "C:\\Users\\<username>\\AppData\\Roaming\\AG-Emacs") )))) ) 

Useful/Similar resources I found:

How to evaluate the expressions or functions in a code-block before tangling a source code block?

  • I generate my init.el file using org-babel-tangle
    AND
  • I'm using chemacs2 - which allows using multiple configurations parallely. Chemacs2 uses a special file called .emacs-profiles.el where we store location and environment properties of each of the configurations as mentioned below.

But the .emacs-profiles.el file cannot have any functions since it doesn't understand how to process them as mentioned here & here.

So, I'm looking for a way to evaluate the functions and replace the code content with the result. According to the documentation, we can use org-babel-pre-tangle-hook for this, but I'm very new to elisp and I'm not sure how to write the hook.

Please note that I have a working configuration with chemacs that handles multiple configurations like spacemacs, doom emacs... But the .emacs-profiles.el config is specific to my current windows PC - since it mentions C:\\Users\\<username> in the file path. So I cannot directly use the same .emcas-profiles.el config in another system as is without updating the <username>. That's the reason I'm looking for this approach.


Below is the source code block that I want to be evaluated:

( ("default" . ((user-emacs-directory . "~/emacs-configs/my-config") (env . ( ("HOME" . (concat (getenv "APPDATA") "\\AG-Emacs"))) )))) ) 

I want this to be evaluated and tangled like this:

( ("default" . ((user-emacs-directory . "~/emacs-configs/my-config") (env . ( ("HOME" . "C:\\Users\\<username>\\AppData\\Roaming\\AG-Emacs") )))) ) 

Useful/Similar resources I found:

additional details
Source Link
Gangula
  • 429
  • 2
  • 13

How to evaluate the expressions or functions in a code-block before tangling a source code block?

  • I generate my init.el file using org-babel-tangle
    AND
  • I'm using chemacs2 - which allows using multiple configurations parallely. Chemacs2 uses a special file called .emacs-profiles.el where we store location and environment properties of each of the configurations as mentioned below.

But the .emacs-profiles.el file cannot have any functions since it doesn't understand how to process them as mentioned here & here.

So, I'm looking for a way to evaluate the functions and replace the code content with the result. According to the documentation, we can use org-babel-pre-tangle-hook for this, but I'm very new to elisp and I'm not sure how to write the hook.

Please note that I have a working configuration with chemacs that handles multiple configurations like spacemacs, doom emacs... But the .emacs-profiles.el config is specific to my current windows PC - since it mentions C:\\Users\\<username> in the file path. So I cannot directly use the same .emcas-profiles.el config in another system as is without updating the <username>. That's the reason I'm looking for this approach.


Below is the source code block that I want to be evaluated:

( ("default" . ((user-emacs-directory . "~/emacs-configs/my-config") (env . ( ("HOME" . (concat (getenv "APPDATA") "\\AG-Emacs"))) )))) ) 

I want this to be evaluated and tangled like this:

( ("default" . ((user-emacs-directory . "~/emacs-configs/my-config") (env . ( ("HOME" . "C:\\Users\\<username>\\AppData\\Roaming\\AG-Emacs") )))) ) 

Useful/Similar resources I found:

How to evaluate the expressions or functions in a code-block before tangling a source code block?

  • I generate my init.el file using org-babel-tangle
    AND
  • I'm using chemacs2 - which allows using multiple configurations parallely. Chemacs2 uses a special file called .emacs-profiles.el where we store location and environment properties of each of the configurations as mentioned below.

But the .emacs-profiles.el file cannot have any functions since it doesn't understand how to process them as mentioned here & here.

So, I'm looking for a way to evaluate the functions and replace the code content with the result. According to the documentation, we can use org-babel-pre-tangle-hook for this, but I'm very new to elisp and I'm not sure how to write the hook.

Please note that I have a working configuration with chemacs that handles multiple configurations like spacemacs, doom emacs... But the .emacs-profiles.el config is specific to my current windows PC - since it mentions C:\\Users\\<username> in the file path. So I cannot directly use the same .emcas-profiles.el config in another system as is without updating the <username>. That's the reason I'm looking for this approach.


Below is the source code block that I want to be evaluated:

( ("default" . ((user-emacs-directory . "~/emacs-configs/my-config") (env . ( ("HOME" . (concat (getenv "APPDATA") "\\AG-Emacs"))) )))) ) 

I want this to be evaluated and tangled like this:

( ("default" . ((user-emacs-directory . "~/emacs-configs/my-config") (env . ( ("HOME" . "C:\\Users\\<username>\\AppData\\Roaming\\AG-Emacs") )))) ) 

How to evaluate the expressions or functions in a code-block before tangling a source code block?

  • I generate my init.el file using org-babel-tangle
    AND
  • I'm using chemacs2 - which allows using multiple configurations parallely. Chemacs2 uses a special file called .emacs-profiles.el where we store location and environment properties of each of the configurations as mentioned below.

But the .emacs-profiles.el file cannot have any functions since it doesn't understand how to process them as mentioned here & here.

So, I'm looking for a way to evaluate the functions and replace the code content with the result. According to the documentation, we can use org-babel-pre-tangle-hook for this, but I'm very new to elisp and I'm not sure how to write the hook.

Please note that I have a working configuration with chemacs that handles multiple configurations like spacemacs, doom emacs... But the .emacs-profiles.el config is specific to my current windows PC - since it mentions C:\\Users\\<username> in the file path. So I cannot directly use the same .emcas-profiles.el config in another system as is without updating the <username>. That's the reason I'm looking for this approach.


Below is the source code block that I want to be evaluated:

( ("default" . ((user-emacs-directory . "~/emacs-configs/my-config") (env . ( ("HOME" . (concat (getenv "APPDATA") "\\AG-Emacs"))) )))) ) 

I want this to be evaluated and tangled like this:

( ("default" . ((user-emacs-directory . "~/emacs-configs/my-config") (env . ( ("HOME" . "C:\\Users\\<username>\\AppData\\Roaming\\AG-Emacs") )))) ) 

Useful/Similar resources I found:

updated links
Source Link
Gangula
  • 429
  • 2
  • 13

How to evaluate the expressions or functions in a code-block before tangling a source code block?

  • I generate my init.el file using org-babel-tangle
    AND
  • I'm using chemacs2 - which allows using multiple configurations parallely. Chemacs2 uses a special file called .emacs-profiles.el where we store location and environment properties of each of the configurations as mentioned below.

But the .emacs-profiles.el file cannot have any functions since it doesn't understand how to process them as mentioned here & here.

So, I'm looking for a way to evaluate the functions and replace the code content with the result. According to the documentationdocumentation, we can use org-babel-tangle-body-hookorg-babel-pre-tangle-hook for this, but I'm very new to elisp and I'm not sure how to write the hook.

Please note that I have a working configuration with chemacs that handles multiple configurations like spacemacs, doom emacs... But the .emacs-profiles.el config is specific to my current windows PC - since it mentions C:\\Users\\<username> in the file path. So I cannot directly use the same .emcas-profiles.el config in another system as is without updating the <username>. That's the reason I'm looking for this approach.


Below is the source code block that I want to be evaluated:

( ("default" . ((user-emacs-directory . "~/emacs-configs/my-config") (env . ( ("HOME" . (concat (getenv "APPDATA") "\\AG-Emacs"))) )))) ) 

I want this to be evaluated and tangled like this:

( ("default" . ((user-emacs-directory . "~/emacs-configs/my-config") (env . ( ("HOME" . "C:\\Users\\<username>\\AppData\\Roaming\\AG-Emacs") )))) ) 

How to evaluate the expressions or functions in a code-block before tangling a source code block?

  • I generate my init.el file using org-babel-tangle
    AND
  • I'm using chemacs2 - which allows using multiple configurations parallely. Chemacs2 uses a special file called .emacs-profiles.el where we store location and environment properties of each of the configurations as mentioned below.

But the .emacs-profiles.el file cannot have any functions since it doesn't understand how to process them as mentioned here & here.

So, I'm looking for a way to evaluate the functions and replace the code content with the result. According to the documentation, we can use org-babel-tangle-body-hook for this, but I'm very new to elisp and I'm not sure how to write the hook.

Please note that I have a working configuration with chemacs that handles multiple configurations like spacemacs, doom emacs... But the .emacs-profiles.el config is specific to my current windows PC - since it mentions C:\\Users\\<username> in the file path. So I cannot directly use the same .emcas-profiles.el config in another system as is without updating the <username>. That's the reason I'm looking for this approach.


Below is the source code block that I want to be evaluated:

( ("default" . ((user-emacs-directory . "~/emacs-configs/my-config") (env . ( ("HOME" . (concat (getenv "APPDATA") "\\AG-Emacs"))) )))) ) 

I want this to be evaluated and tangled like this:

( ("default" . ((user-emacs-directory . "~/emacs-configs/my-config") (env . ( ("HOME" . "C:\\Users\\<username>\\AppData\\Roaming\\AG-Emacs") )))) ) 

How to evaluate the expressions or functions in a code-block before tangling a source code block?

  • I generate my init.el file using org-babel-tangle
    AND
  • I'm using chemacs2 - which allows using multiple configurations parallely. Chemacs2 uses a special file called .emacs-profiles.el where we store location and environment properties of each of the configurations as mentioned below.

But the .emacs-profiles.el file cannot have any functions since it doesn't understand how to process them as mentioned here & here.

So, I'm looking for a way to evaluate the functions and replace the code content with the result. According to the documentation, we can use org-babel-pre-tangle-hook for this, but I'm very new to elisp and I'm not sure how to write the hook.

Please note that I have a working configuration with chemacs that handles multiple configurations like spacemacs, doom emacs... But the .emacs-profiles.el config is specific to my current windows PC - since it mentions C:\\Users\\<username> in the file path. So I cannot directly use the same .emcas-profiles.el config in another system as is without updating the <username>. That's the reason I'm looking for this approach.


Below is the source code block that I want to be evaluated:

( ("default" . ((user-emacs-directory . "~/emacs-configs/my-config") (env . ( ("HOME" . (concat (getenv "APPDATA") "\\AG-Emacs"))) )))) ) 

I want this to be evaluated and tangled like this:

( ("default" . ((user-emacs-directory . "~/emacs-configs/my-config") (env . ( ("HOME" . "C:\\Users\\<username>\\AppData\\Roaming\\AG-Emacs") )))) ) 
updated links
Source Link
Gangula
  • 429
  • 2
  • 13
Loading
addition
Source Link
Gangula
  • 429
  • 2
  • 13
Loading
Source Link
Gangula
  • 429
  • 2
  • 13
Loading