
In this video, we'll work on a practical example of writing Emacs Lisp to read and write contents of buffers! We continue the work on our dotfiles management package, now called "dotcrafter.el", to add the ability to extract all tangled configuration paths from our Org Mode files and then write out those paths to the '.gitignore' file of the dotfiles repository.
We cover the following topics:
- 0:00 Intro
- 0:38 Why learn about buffers?
- 2:15 What will we learn?
- 5:12 What is a buffer?
- 7:01 Getting the "current" buffer
- 8:02 Getting a buffer by name
- 9:41 Changing the current buffer
- 10:37 Changing the current buffer safely!
- 13:55 Working with file buffers
- 17:36 Example: Getting the buffers for our configuration Org files
- 20:38 Loading a file into a buffer
- 22:27 Example: Getting or creating the Org file buffer
- 24:44 What's the point?
- 28:21 Moving the point
- 32:45 Preserving the point
- 33:41 Examining buffer text
- 36:26 The Thing (thing-at-point)
- 39:45 Searching for text
- 43:24 Example: Finding Org code block output paths
- 50:02 Inserting text
- 52:00 Example: Updating the .gitignore file
- 57:31 Deleting text
- 58:31 Saving a buffer
- 59:09 Example: Cleaning up and saving the .gitignore file
- 1:00:35 What's next?
- 1:01:50 Sponsors and outro
The package code from this episode can be found here:
https://github.com/daviwil/dotcrafter.el/blob/8d507eda31e08a789c38a5d729866eb4cda6abaf/dotcrafter.el
The show notes can be found here: https://github.com/daviwil/emacs-from-scratch/blob/master/show-notes/Emacs-Lisp-05.org
My Emacs configuration: https://github.com/daviwil/dotfiles/blob/master/Emacs.org
If you enjoy this series, please consider becoming a sponsor on GitHub or Patreon:
- https://github.com/sponsors/daviwil
- https://patreon.com/SystemCrafters
You can also leave a tip via PayPal: https://paypal.me/daviwil
Follow me on Twitter for more Emacs content!
https://twitter.com/SystemCrafters
Chat with the System Crafters community on Discord: https://discord.gg/yVD8Gx6
Intro music: Coriolis Effect by logos feat. stefsax, licensed CC-BY
http://ccmixter.org/files/mseq/26296
...
https://www.youtube.com/watch?v=J7d2LmivyyM