Open jgarte opened 2 years ago
jgart @.***> anaandika:
Hi Bonface,
Ola ola o/.
How do you deploy your emacs dotfiles to a new machine?
For me, I just need a base install of Emacs and git installed somewhere. On a new machine, I do a git pull of my configs in my org file which contains all my configs. Thereafter, I open that file and simply run "org-babel-tangle"; a command that is bound to "C-c C-v C-t".
Note that all my configs are in an org file with a header that looks like:
--8<---------------cut here---------------start------------->8---
--8<---------------cut here---------------end--------------->8---
The most important bit there is the =:mkdirp yes=. This makes sure that that if a dir doesn't exist, GNU Emacs will create it for you.
Is there a way to call emacs from the command line with the tangle command?
emacs --tangle init.org > ~/.emacs
or something like that ;()
There is a better way of doing this. Say you have this org file, "myfile.org" that looks like:
--8<---------------cut here---------------start------------->8--- Test tangling
(defvar user-home-directory (concat (expand-file-name "~") "/"))
Another tangle:
(defvar user-home-directory (concat (expand-file-name "~") "/"))
--8<---------------cut here---------------end--------------->8---
and you want to tangle it from the CLI. I propose you have an emacs scriptfile, "test.el" (use a better name) that looks like:
--8<---------------cut here---------------start------------->8---
;; The subdirectory ~/.emacs.d is to be added to the top-level elisp ;; file search.
;; Org-Mode, Org-Babel, and the tangle library are required, if we are ;; to proceed further. (require 'org-install) (require 'org) (require 'ob-tangle) ;; Load the main configuration and setup file. (require 'ob-emacs-lisp)
(org-babel-tangle-file "/tmp/myfile.org")
--8<---------------cut here---------------end--------------->8---
Now you just run that from your CLI (ensure it's executable):
: ./test.el
So a simple recipe for tangling from your CLI would be to:
I you found this useful.
PS: I got useful information of tangling from the CLI here: https://emacs-orgmode.gnu.narkive.com/NaB7zkJz/o-emacs-shell-script-to-tangle-org-babel-at-the-command-line
-- Bonface M. K. D4F09EB110177E03C28E2FE1F5BBAE1E0392253F (hkp://keys.gnupg.net) Free Software Activist Humble GNU Emacs User | Bearer of scheme-y parens Curator: https://upbookclub.com | Twitter: @MunyokiKilyungi
Hi Bonface,
How do you deploy your emacs dotfiles to a new machine?
Is there a way to call emacs from the command line with the tangle command?
emacs --tangle init.org > ~/.emacs
or something like that ;()