No video

Want To Rewrite Your Configs In Org-Mode? It's Easy!

  Рет қаралды 25,601

DistroTube

DistroTube

Күн бұрын

One of the killer features of Emacs is Org-Mode, which is a kind of markdown that makes creating outlines, tables, source code blocks, and tables of content really easy. Often, when people discover Org-Mode, they start wanting to rewrite all of their configs as literate configs in Org.
ERRATA:
I mentioned in the video that this would work on any config file written in an actual programming language. That 's not actually the case. 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.
NOTE:
I did all of this on a live stream earlier today but the stream had some buffering issues. I thought this topic was too important not to go back and re-record. I have removed the earlier live stream.
REFERENCED:
► gitlab.com/dwt... - DT's README.org
► www.gnu.org/so... - GNU Emacs
► github.com/hli... - Doom Emacs
► orgmode.org/ - Org Mode Documentation
WANT TO SUPPORT THE CHANNEL?
💰 Patreon: / distrotube
💳 Paypal: www.paypal.com...
🛍️ Amazon: amzn.to/2RotFFi
👕 Teespring: teespring.com/...
SOCIAL PLATFORMS:
🗨️ Mastodon: mastodon.techn...
💬 IRC: irc://freenode #distrotube
👫 Reddit: / distrotube
📽️ LBRY: lbry.tv/$/invi...
DT ON THE WEB:
🕸️ Website: distrotube.com/
🐿️ Gopherhole: gopher://distro.tube
📁 GitLab: gitlab.com/dwt1
FREE AND OPEN SOURCE SOFTWARE THAT I USE:
🌐 Brave Browser - brave.com/dis872
📽️ Open Broadcaster Software: obsproject.com/
🎬 Kdenlive: kdenlive.org
🎨 GIMP: www.gimp.org/
🔊 Audacity: www.audacityte...
💻 VirtualBox: www.virtualbox...
Your support is very much appreciated. Thanks, guys!

Пікірлер: 67
@robertdavis9948
@robertdavis9948 4 жыл бұрын
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 "
@nicolasmorazotti8684
@nicolasmorazotti8684 4 жыл бұрын
I've used emacs for about 8 years, org-mode for 4 years and didn't know about the :toc:
@TheFakeVIP
@TheFakeVIP 4 жыл бұрын
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.
@AndersJackson
@AndersJackson 4 жыл бұрын
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.
@robertdavis9948
@robertdavis9948 4 жыл бұрын
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.
@DistroTube
@DistroTube 4 жыл бұрын
Good to know! Thanks!
@auroradraco9974
@auroradraco9974 4 жыл бұрын
This is honestly great, org mode really is a killer feature.
@bibleculture
@bibleculture 3 жыл бұрын
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.
@markmake2252
@markmake2252 2 жыл бұрын
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!
@kubo407
@kubo407 4 жыл бұрын
This is incredibly useful! I'm definitely going to start making more use of org-mode.
@AndersJackson
@AndersJackson 4 жыл бұрын
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.
@tomaso0
@tomaso0 4 жыл бұрын
0:07 The org language is a form of markup language, but not related to markdown in any way apart from that
@semilin
@semilin 4 жыл бұрын
I think he meant to say markup
@driden1987
@driden1987 4 жыл бұрын
Was about to make this comment myself, thanks @tomaslib
@HenriqueNewsted
@HenriqueNewsted 4 жыл бұрын
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!
@Archwyrm
@Archwyrm 4 жыл бұрын
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!
@kristiannordin7765
@kristiannordin7765 2 жыл бұрын
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!
@alan_core
@alan_core 4 жыл бұрын
Thanks for the hard work Derek, stay safe
@aleksandrpetrosyan1140
@aleksandrpetrosyan1140 4 жыл бұрын
You can tangle anything you like. So you can do i3, and SpectrWM confirms in Org.
@DistroTube
@DistroTube 4 жыл бұрын
Nice!
@aleksandrpetrosyan1140
@aleksandrpetrosyan1140 4 жыл бұрын
@@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
@aleksandrpetrosyan1140
@aleksandrpetrosyan1140 4 жыл бұрын
@@DistroTube I would also recommend github.com/mtekman/org-tanglesync.el
@DeshierArchitecte
@DeshierArchitecte 3 жыл бұрын
What do you specify as the language in the code block then? Just plain text?
@aleksandrpetrosyan1140
@aleksandrpetrosyan1140 3 жыл бұрын
@@DeshierArchitecte See my other replies.
@JeffChien13
@JeffChien13 2 жыл бұрын
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.
@kaiocesar8578
@kaiocesar8578 4 жыл бұрын
I don't see why it will only work with programming languages scripts
@DistroTube
@DistroTube 4 жыл бұрын
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.
@Phydoux2112
@Phydoux2112 4 жыл бұрын
Wow! This is some cool stuff! Time for me to get serious about Emacs!
@hayopapayo1717
@hayopapayo1717 4 жыл бұрын
nice, could not watch live stream, was searching for the recordings and couldnt find it ^^
@mohammedalbatati5529
@mohammedalbatati5529 2 жыл бұрын
Thanks alot DT I started changing all my README files to org mode It looks much better
@patrykgronkiewicz924
@patrykgronkiewicz924 4 жыл бұрын
4:50 you could do ggyG instead of ggVGy
@puntsiluntsi7864
@puntsiluntsi7864 4 жыл бұрын
Or even better, do :%y
@DeshierArchitecte
@DeshierArchitecte 3 жыл бұрын
@@puntsiluntsi7864 even better, M-x butterfly.
@dantebarbieri
@dantebarbieri 4 жыл бұрын
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?
@dantebarbieri
@dantebarbieri 4 жыл бұрын
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!
@DistroTube
@DistroTube 4 жыл бұрын
Glad you got it working. And thanks for posting the solution here. Others will definitely need it! :D
@TDOLLA
@TDOLLA 6 ай бұрын
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
@FrederickCai
@FrederickCai 4 жыл бұрын
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`.
@cornelisdejong1523
@cornelisdejong1523 3 жыл бұрын
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!}.
@AnzanHoshinRoshi
@AnzanHoshinRoshi 4 жыл бұрын
Thank you, Derek.
@rohscx
@rohscx 2 жыл бұрын
Good stuff DT
@otavioschwanck6668
@otavioschwanck6668 4 жыл бұрын
Tip: You can go to dired mode with SPC . and selecting a folder instead a file. You can use SPC . to create files too.
@digitalife8719
@digitalife8719 9 ай бұрын
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.
@jeremyottley4141
@jeremyottley4141 4 жыл бұрын
Hey DT? What aspects made you choose Doom Emacs over Prelude or Spacemacs?
@bobkoss280
@bobkoss280 2 жыл бұрын
Excellent!
@techforfreedom6023
@techforfreedom6023 4 жыл бұрын
Hey DT put video about Elisp tutorials. Emacs users want that. good luck.
@uuu12343
@uuu12343 2 жыл бұрын
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?
@yiannifunataoldotcom
@yiannifunataoldotcom 3 жыл бұрын
Thank you! I really liked that
@DarkNoys
@DarkNoys 4 жыл бұрын
it's awesome !!
@brunogama9346
@brunogama9346 4 жыл бұрын
Where did you buy that awesome mug?
@jr_Linux
@jr_Linux Жыл бұрын
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,
@iqwrjwqioprwjriopqrjpqowir
@iqwrjwqioprwjriopqrjpqowir 4 жыл бұрын
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 "
@BalajiA
@BalajiA 4 жыл бұрын
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?
@bandithedoge
@bandithedoge 3 жыл бұрын
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
@ste_ph_en9018
@ste_ph_en9018 3 жыл бұрын
you missed an opportunity to show off magit the second best package in emacs!
@bandithedoge
@bandithedoge 3 жыл бұрын
he already did
@leviticus8930
@leviticus8930 4 жыл бұрын
I blame Comcast and Pulseaudio
@zweitlander874
@zweitlander874 4 жыл бұрын
:)
@mortezabehboodian5758
@mortezabehboodian5758 4 жыл бұрын
i came for i3 :|
@kaiocesar8578
@kaiocesar8578 4 жыл бұрын
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
@DistroTube
@DistroTube 4 жыл бұрын
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.
@semilin
@semilin 4 жыл бұрын
Last
@MichaelMantion
@MichaelMantion 3 жыл бұрын
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.
@usrname1105
@usrname1105 4 жыл бұрын
FiRsT
@usrname1105
@usrname1105 4 жыл бұрын
Damn bro that’s crazy, but I don’t remember anyone asking.
What Are The Benefits Of Emacs Over Vim?
29:44
DistroTube
Рет қаралды 174 М.
Boost Productivity With Emacs, Org Mode and Org Agenda
34:24
DistroTube
Рет қаралды 90 М.
Violet Beauregarde Doll🫐
00:58
PIRANKA
Рет қаралды 32 МЛН
Before VS during the CONCERT 🔥 "Aliby" | Andra Gogan
00:13
Andra Gogan
Рет қаралды 10 МЛН
小丑把天使丢游泳池里#short #angel #clown
00:15
Super Beauty team
Рет қаралды 47 МЛН
Three HUGE Mistakes New Emacs Users Make
13:28
DistroTube
Рет қаралды 94 М.
Doom Emacs For Noobs
25:40
DistroTube
Рет қаралды 139 М.
The Magit Git Client Is The "Killer Feature" In Emacs
9:41
DistroTube
Рет қаралды 53 М.
Turn Emacs Into A Window Manager With EXWM
17:26
DistroTube
Рет қаралды 51 М.
Rewrite Your Scripts In LISP - with Roswell
21:23
Gavin Freeborn
Рет қаралды 21 М.
The Different Shells Available In Emacs
17:21
DistroTube
Рет қаралды 26 М.
Doom Emacs On Day One (Learn These Things FIRST!)
35:10
DistroTube
Рет қаралды 169 М.
Interview with an Emacs Enthusiast in 2023 [Colorized]
8:50
Programmers are also human
Рет қаралды 1,2 МЛН
Bookmarks, Buffers and Windows in Doom Emacs
16:32
DistroTube
Рет қаралды 29 М.
Setting Up The Mu4e Email Client In Doom Emacs
23:35
DistroTube
Рет қаралды 23 М.
Violet Beauregarde Doll🫐
00:58
PIRANKA
Рет қаралды 32 МЛН