Org mode is smart enough to wrap code block delimiters around selected text. Mark the block you want, then press "C-c ," and that will give you a nice menu. hit "s" to wrap the selected text in a source code block. I believe that "
Long time markdown user, but this is totally a reason to learn org-mode. You could definitely do this with a Pandoc filter for Markdown as well, and I might just try that, but whatever markup language, it's so cool you can do this, and it'll be so helpful to clean up my configs.
Thanks, you have shown peopel the light in Emacs. This is a great way of document your config files, and that without lots and lots of comments in the code. You could also generate HTML, PFD, LaTeX, LibreOffice and plain text files from the Org-mpde too, so it get even easier to read for someone that want to have a look at your code. Would also recommend that the links get properly converted into named linkes, just put [] around the link. There are also a shortcut to make a text with a link into a proper link. But, thanks for showing the magic of Emacs. And as usual, I learn some stuff from looking at your videos about Emacs. And I started to use it back about 1985.
Your videos inspired me a lot. I finally ditched macOS and Windows and I am using Arch Linux as my daily driver. This and all the other videos showing the wonders of Emacs and Org mode are also an added value to this switch. I found Emacs really intimidating at first, even by reading its tutorial and manual, let alone the Org-Mode-Bible-like manual... but your videos helped me to learn more and use this piece of software. I still have a lot to learn but I am already starting to use Emacs in my workflow. I wish you could also guide us into using Emacs as a mail client, or music player or anything else that it can do ! You are doing a great job indeed. There should be more people like you in this planet!
I needed this! Thanks. I'm starting to rewrite my spacemacs config files this way. Read a few reddit posts and blogs, but videos are much better for this type of content.
Thank you for this video. Been searching the web to make this work but didnt find a solution that made sense to me. After watching your video everything is working perfectly. Thank you!
This made me want to try emacs, and i've been a Vim user since i started on Linux (circa 2017). Thanks DT, if it weren't for you i would never know this. You are surely the best Linux youtuber out there!
The neat thing about Doom Emacs or vanilla Emacs with evil-mode is you can be a Vim user *and* an Emacs user. :) I've been using Vim since 2003 and am recently exploring all that Emacs has to offer like org-mode and customizing in Elisp!
It is great. Both for config files and also for programming. Tangeling was something Donald Knuth used that he called WEB programming, way back in time. But he didn't used Emacs for that. Org-mode wasn't invented yet. :-) I use it to generate my Emacs config and init.el. So yoou can tangel many different files and in many languages if you want to. There are even some people that write their PHd thesis in Emacs and tangle it into LaTeX, generating all data files etc. But of course you don't need to to do that if you don't want to. But in plain Emacs, C-c C-e l p generates PDF document from Org-mode file, and C-c C-e h h generates HTML document from the Org-mode file.
you have successfully made me switch from vim to emacs. also I found that tangle can work for any text content not just programming languages, all it needs is to call revert-buffer.
@@DistroTube specifically, you set the file name to the file name, o I.e. =:tangle .config/i3/config= As seen in orgmode.org/manual/Extracting-Source-Code.html
One thing kinda annoying me is, if you move to 5:28, you will see even you've wrapped the code in source code block, it won't highlight them until you move to `#+BEGIN_SRC`.
Actually, I was corrected on this by another commenter. Tangle will work on anything so it doesn't have to be a programming language, since we are not really evaluating the code with this. We are just writing what's in the SRC blocks to the file we specify.
I love this idea and want to rewrite my dotfiles in org mode, but for some files like bspwmrc which is a shell file that requires executable permissions, tangle removes the permissions. Is there a way to make the tangle output with the executable permission set?
Surprise surprise, the answer was in the documentation. orgmode.org/org.html#Working-with-Source-Code In short: There is a shebang property that sets the file executable and adds a shebang, there is a way to set it executable without the shebang property using `:tangle-mode (identity #o755)`. The Shebang property: `:shebang "#!/bin/bash"` To set multiple properties you need to either do it on one line: `#+PROPERTY: header-args :tangle bspwm :shebang "#!/bin/bash"` Or you must specify that you are appending to the property: ``` #+PROPERTY: header-args :tangle bspwm #+PROPERTY: header-args+ :shebang "#!/bin/bash" ``` Make sure that you reload whenever you change the property or tangle will not output correctly. I kept getting 0 blocks output until I reloaded with C-c C-c. Hope this helps somebody!
You might consider using the expand-region package {melpa} which facilitates selection. Besides legacy emacs includes mark-whole-buffer, which I've bound to C-a {naturally!}.
damnit… I JUST got to a point where I got a solid understanding of neovim and can customize it to my liking and understand the config and modular file structure. Now I want to go start on emacs
Short version of the tutorial. 1.Make your file like this: #+PROPERTY: header-args :tangle output_file.py * entry_1 #+BEGIN_SRC python print('hello') #+END_SRC * entry_2 #+BEGIN_SRC python print('world') #+END_SRC 2. Put the cursor in the #+PROERTY line. Refresh local setups with C-c C-c, 3. Then, M-x org-babel-tange ENTER, to execute command org-babel-tangle to output code in all code blocks into file output_file.py, in the same directory of current org file.
Question I assume this will require emacs to be installed as a dependency for all installs? Because doesn't this mean that the config files are in emacs-lisp language as opposed to the correct dotfile Syntax?
man DT makes this all seem easy, but god theres alot to learn, kinda makes me want to try this, but im not sure if im ready for that, "yes i have Doom installed, trying to mess with it and learn some some stuff,
Excellent. Thanks for this illustration. I'm looking to rewrite and generate my .spacemacs this way. f e d opens up the dotfile .spacemacs. How can I make it open the spacemacs.org instead?
hopefully you've found an answer in the 3 months since this comment was posted. in case you haven't, this spacemacs documentation page on binding keys might help: www.spacemacs.org/doc/DOCUMENTATION.html#binding-keys
Yea, I stand corrected on this working with i3 and spectrwm. This will work for any file regardless of whether it's in a programming language since we aren't actually going to evaluate any of this code.
2 minutes before he gets to it.... Sorry this is 2015, most people don't have time for this. That is why 96.3% of people watched your video and didn't bother to like or unlike it. You have a great voice, your nice to listen to, we all want to have a complete understanding. BUT start with the meat then explain it. Your video should be, This is Org mode in doom emacs, Her is a dot file. This is how you do it. THEN go and explain that you use doom and why "i use doom because It gives me Vi/VIM key controls and has a lot of customization I like. Then explain what org mode is and why and give more examples of how it works.
Org mode is smart enough to wrap code block delimiters around selected text. Mark the block you want, then press "C-c ," and that will give you a nice menu. hit "s" to wrap the selected text in a source code block. I believe that "
I've used emacs for about 8 years, org-mode for 4 years and didn't know about the :toc:
Long time markdown user, but this is totally a reason to learn org-mode. You could definitely do this with a Pandoc filter for Markdown as well, and I might just try that, but whatever markup language, it's so cool you can do this, and it'll be so helpful to clean up my configs.
Thanks, you have shown peopel the light in Emacs.
This is a great way of document your config files, and that without lots and lots of comments in the code.
You could also generate HTML, PFD, LaTeX, LibreOffice and plain text files from the Org-mpde too, so it get even easier to read for someone that want to have a look at your code.
Would also recommend that the links get properly converted into named linkes, just put [] around the link. There are also a shortcut to make a text with a link into a proper link.
But, thanks for showing the magic of Emacs. And as usual, I learn some stuff from looking at your videos about Emacs. And I started to use it back about 1985.
In vanilla emacs, :toc: doesn't work like it does in Doom. You'll need to install the toc-org package to get the same functionality.
Good to know! Thanks!
Your videos inspired me a lot. I finally ditched macOS and Windows and I am using Arch Linux as my daily driver. This and all the other videos showing the wonders of Emacs and Org mode are also an added value to this switch. I found Emacs really intimidating at first, even by reading its tutorial and manual, let alone the Org-Mode-Bible-like manual... but your videos helped me to learn more and use this piece of software. I still have a lot to learn but I am already starting to use Emacs in my workflow. I wish you could also guide us into using Emacs as a mail client, or music player or anything else that it can do ! You are doing a great job indeed. There should be more people like you in this planet!
I needed this! Thanks. I'm starting to rewrite my spacemacs config files this way. Read a few reddit posts and blogs, but videos are much better for this type of content.
0:07 The org language is a form of markup language, but not related to markdown in any way apart from that
I think he meant to say markup
Was about to make this comment myself, thanks @tomaslib
This is honestly great, org mode really is a killer feature.
Thank you for this video. Been searching the web to make this work but didnt find a solution that made sense to me.
After watching your video everything is working perfectly.
Thank you!
This made me want to try emacs, and i've been a Vim user since i started on Linux (circa 2017). Thanks DT, if it weren't for you i would never know this.
You are surely the best Linux youtuber out there!
The neat thing about Doom Emacs or vanilla Emacs with evil-mode is you can be a Vim user *and* an Emacs user. :)
I've been using Vim since 2003 and am recently exploring all that Emacs has to offer like org-mode and customizing in Elisp!
This is incredibly useful! I'm definitely going to start making more use of org-mode.
It is great. Both for config files and also for programming. Tangeling was something Donald Knuth used that he called WEB programming, way back in time. But he didn't used Emacs for that. Org-mode wasn't invented yet. :-)
I use it to generate my Emacs config and init.el. So yoou can tangel many different files and in many languages if you want to.
There are even some people that write their PHd thesis in Emacs and tangle it into LaTeX, generating all data files etc. But of course you don't need to to do that if you don't want to.
But in plain Emacs, C-c C-e l p generates PDF document from Org-mode file, and C-c C-e h h generates HTML document from the Org-mode file.
you have successfully made me switch from vim to emacs. also I found that tangle can work for any text content not just programming languages, all it needs is to call revert-buffer.
You can tangle anything you like. So you can do i3, and SpectrWM confirms in Org.
Nice!
@@DistroTube specifically, you set the file name to the file name, o
I.e.
=:tangle .config/i3/config=
As seen in orgmode.org/manual/Extracting-Source-Code.html
@@DistroTube I would also recommend github.com/mtekman/org-tanglesync.el
What do you specify as the language in the code block then? Just plain text?
@@DeshierArchitecte See my other replies.
Thanks for the hard work Derek, stay safe
One thing kinda annoying me is, if you move to 5:28, you will see even you've wrapped the code in source code block, it won't highlight them until you move to `#+BEGIN_SRC`.
I don't see why it will only work with programming languages scripts
Actually, I was corrected on this by another commenter. Tangle will work on anything so it doesn't have to be a programming language, since we are not really evaluating the code with this. We are just writing what's in the SRC blocks to the file we specify.
I love this idea and want to rewrite my dotfiles in org mode, but for some files like bspwmrc which is a shell file that requires executable permissions, tangle removes the permissions. Is there a way to make the tangle output with the executable permission set?
Surprise surprise, the answer was in the documentation. orgmode.org/org.html#Working-with-Source-Code
In short:
There is a shebang property that sets the file executable and adds a shebang, there is a way to set it executable without the shebang property using `:tangle-mode (identity #o755)`.
The Shebang property: `:shebang "#!/bin/bash"`
To set multiple properties you need to either do it on one line: `#+PROPERTY: header-args :tangle bspwm :shebang "#!/bin/bash"`
Or you must specify that you are appending to the property:
```
#+PROPERTY: header-args :tangle bspwm
#+PROPERTY: header-args+ :shebang "#!/bin/bash"
```
Make sure that you reload whenever you change the property or tangle will not output correctly. I kept getting 0 blocks output until I reloaded with C-c C-c. Hope this helps somebody!
Glad you got it working. And thanks for posting the solution here. Others will definitely need it! :D
You might consider using the expand-region package {melpa} which facilitates selection. Besides legacy emacs includes mark-whole-buffer, which I've bound to C-a {naturally!}.
damnit… I JUST got to a point where I got a solid understanding of neovim and can customize it to my liking and understand the config and modular file structure. Now I want to go start on emacs
Short version of the tutorial.
1.Make your file like this:
#+PROPERTY: header-args :tangle output_file.py
* entry_1
#+BEGIN_SRC python
print('hello')
#+END_SRC
* entry_2
#+BEGIN_SRC python
print('world')
#+END_SRC
2. Put the cursor in the #+PROERTY line. Refresh local setups with C-c C-c,
3. Then, M-x org-babel-tange ENTER, to execute command org-babel-tangle to output code in all code blocks into file output_file.py, in the same directory of current org file.
Wow! This is some cool stuff! Time for me to get serious about Emacs!
4:50 you could do ggyG instead of ggVGy
Or even better, do :%y
@@puntsiluntsi7864 even better, M-x butterfly.
Thanks alot DT
I started changing all my README files to org mode
It looks much better
Tip:
You can go to dired mode with SPC . and selecting a folder instead a file. You can use SPC . to create files too.
nice, could not watch live stream, was searching for the recordings and couldnt find it ^^
Hey DT? What aspects made you choose Doom Emacs over Prelude or Spacemacs?
Good stuff DT
Question
I assume this will require emacs to be installed as a dependency for all installs?
Because doesn't this mean that the config files are in emacs-lisp language as opposed to the correct dotfile Syntax?
Thank you, Derek.
Where did you buy that awesome mug?
Hey DT put video about Elisp tutorials. Emacs users want that. good luck.
man DT makes this all seem easy, but god theres alot to learn, kinda makes me want to try this, but im not sure if im ready for that, "yes i have Doom installed, trying to mess with it and learn some some stuff,
Excellent!
Excellent. Thanks for this illustration. I'm looking to rewrite and generate my .spacemacs this way.
f e d opens up the dotfile .spacemacs. How can I make it open the spacemacs.org instead?
hopefully you've found an answer in the 3 months since this comment was posted. in case you haven't, this spacemacs documentation page on binding keys might help: www.spacemacs.org/doc/DOCUMENTATION.html#binding-keys
Thank you! I really liked that
I support your videos about emacs, but you have to say the differences between emacs and doom emacs. Statements like "Press Y to yank this" or "
it's awesome !!
you missed an opportunity to show off magit the second best package in emacs!
he already did
I blame Comcast and Pulseaudio
:)
i came for i3 :|
You don't need to evaluate the sources just do C-c C-c in the first line then C-c C-v t to tangle
Yea, I stand corrected on this working with i3 and spectrwm. This will work for any file regardless of whether it's in a programming language since we aren't actually going to evaluate any of this code.
2 minutes before he gets to it.... Sorry this is 2015, most people don't have time for this. That is why 96.3% of people watched your video and didn't bother to like or unlike it.
You have a great voice, your nice to listen to, we all want to have a complete understanding. BUT start with the meat then explain it. Your video should be, This is Org mode in doom emacs, Her is a dot file. This is how you do it. THEN go and explain that you use doom and why "i use doom because It gives me Vi/VIM key controls and has a lot of customization I like. Then explain what org mode is and why and give more examples of how it works.
Last
FiRsT
Damn bro that’s crazy, but I don’t remember anyone asking.