My Emacs Workflow - As a Software Engineer and Student
Summary
TLDRThe video script details a developer's transition from Vim to Emacs, exploring the efficiency of Emacs for daily tasks. It covers the use of Emacs's client-server architecture for quick startups, window management, and split screens. The script addresses command line workflows, showcasing how to run and manage commands within Emacs, including using 'popper' for terminal emulation. It also discusses note-taking integration, using 'org-protocol' for capturing ideas and code snippets. The video further delves into compiling code with Emacs, utilizing 'compile' command customizations, and leveraging 'lsp-mode' for coding assistance. Lastly, it touches on using Emacs for communication, like managing Matrix and Discord servers through 'eminent', and concludes with a call for viewer engagement and support.
Takeaways
- π§ The speaker transitioned from Vim to Emacs and shares their workflow to address common questions about adapting to Emacs.
- π₯οΈ Emacs' client-server architecture allows for quick restarts and shared buffers between windows, aiding in efficient window management.
- ποΈ The speaker heavily utilizes splits in Emacs for multitasking and integrates this with their window manager for a seamless experience.
- π» The command line workflow in Emacs can be similar to using a terminal, with the added benefit of asynchronous command execution and buffer sharing.
- π Popper, a plugin/package, is used to manage multiple terminal-like buffers that can pop up and be hidden with a key binding.
- π For programming, Emacs can replace the need for multiple terminal windows with its built-in terminal emulation and shell functionality.
- π The 'with-editor' package allows external applications like Git to open and edit commit messages within Emacs buffers.
- π Note-taking in Emacs is enhanced by the ability to capture thoughts and ideas directly within the editor and link them to specific lines of code.
- π The Org protocol and related tools enable capturing information from outside Emacs, like web pages, and integrating it into notes.
- π§ Emacs' compile command simplifies the process of compiling code with customizable commands and environment variable settings.
- βοΈ LSP mode provides code hinting and snippets in Emacs, enhancing the coding experience, while the speaker prefers Temple for template management.
Q & A
What is the main topic of the video script?
-The main topic of the video script is the presenter's workflow with Emacs, a text editor, and how they transitioned from using Vim, addressing common concerns and sharing their personal Emacs setup and usage.
How does the presenter utilize Emacs' client-server architecture?
-The presenter uses Emacs' client-server architecture by starting Emacs with the server enabled, allowing for quicker subsequent opens and shared buffers between windows, which aids in efficient window management.
What is the significance of using 'popper' in the presenter's workflow?
-Popper is a plugin that allows the presenter to have terminal-like buffers that act like pop-ups, which can be hidden and popped back up with a key binding, facilitating the management of multiple buffers for one-off commands.
How does the presenter handle running simple commands within Emacs?
-The presenter can run simple commands within Emacs using the 'alt shift and the & symbol' to execute an asynchronous command in a buffer, providing a dumb terminal experience with additional Emacs functionalities.
What is the presenter's approach to using a terminal within Emacs?
-The presenter can use 'vterm' for a fully functional terminal within Emacs or rely on a shell with Emacs key bindings for simpler terminal needs, allowing for completion and history searches without leaving the editor.
How does the 'with-editor' package assist the presenter in their workflow?
-The 'with-editor' package allows the presenter to edit messages of commands like 'git commit' within Emacs, providing a seamless integration with the text editor for tasks that would typically require an external text editor.
What is the presenter's method for capturing thoughts or ideas during their work?
-The presenter uses a capture interface in Emacs, triggered by a key binding, to quickly jot down thoughts or ideas, which are then stored in a designated notes file, allowing for easy retrieval and reference.
How does the presenter integrate note-taking with their code?
-The presenter can link notes to specific lines of code, enabling them to jump back to the exact location in the code where the note was made, facilitating a tight integration between thought process and code development.
What is the 'org-protocol' and how does the presenter use it?
-The 'org-protocol' is a method that allows the presenter to capture information from outside of Emacs, such as highlighted text, and add it to their notes within Emacs, enhancing the integration with other tools.
How does the presenter handle compiling code within Emacs?
-The presenter uses the 'compile' command in Emacs, which can be customized for different file types or specific projects, and even set environment variables for tasks like resolving version conflicts in programming languages.
What is the presenter's preference for code snippets and why?
-The presenter prefers using 'temple' for code snippets over 'yasnippet' due to personal preference for the way 'temple' handles templates, despite the need to pre-define snippets in 'temple'.
How does the presenter manage their communication across different platforms like Discord and Matrix?
-The presenter uses 'eminent' to manage Matrix servers and mentions using Discord for school-related servers, highlighting the flexibility of using different platforms and the presenter's preference for staying connected.
Outlines
π Emacs Workflow Introduction
The speaker discusses their transition from Vim to Emacs and addresses common questions about daily workflow efficiency. They highlight the flexibility of Emacs, emphasizing that there are countless ways to customize it. The speaker shares their personal Emacs setup, including server-client architecture for quick startups and efficient window management with split screens. They also touch on the integration of command line operations within Emacs, showcasing how to run asynchronous commands and utilize popper for pop-up terminals, which aids in buffer management.
π§ Enhancing Command Line Experience in Emacs
This paragraph delves into the command line workflow within Emacs, especially for those accustomed to using the terminal extensively. The speaker demonstrates how to execute simple commands directly in Emacs and how to utilize packages like 'popper' for enhanced terminal functionality. They also mention the use of 'vterm' for a full terminal experience and discuss shell integration for tasks that require a consistent terminal session. The speaker shares tips on using environment variables to handle version conflicts and the use of 'with-editor' for text editor integration in command-line tools.
π Note-Taking and Documentation in Emacs
The speaker describes their note-taking process in Emacs, which includes capturing thoughts and ideas directly within the editor. They use the 'org-mode' for note organization and demonstrate how to capture and link notes to specific lines of code. The speaker also explains how to integrate Emacs with other tools for capturing content from outside the editor, using the 'org-protocol'. Furthermore, they discuss the use of 'org-mode' for documenting project progress and sharing updates with colleagues via HTML exports, highlighting the efficiency of Emacs in both coding and documentation tasks.
π οΈ Code Compilation and Development Tools in Emacs
The speaker addresses the concerns around code compilation in Emacs, explaining the use of the 'compile' command for different programming languages and how to set environment variables for specific compilation tasks. They also discuss the use of 'lsp-mode' for code hinting and 'temple' for code snippets, comparing these with other alternatives like 'eglot' and 'yasnippet'. The speaker shares their preferences and setup for Lisp editing with 'sly' and mentions their communication tools, 'eminent' for Matrix and 'element' for Discord, showcasing the versatility of Emacs in development and communication.
Mindmap
Keywords
π‘Emacs
π‘Vim
π‘Client-Server Architecture
π‘Splits
π‘Asynchronous Command
π‘Popper
π‘Vterm
π‘Shell
π‘LSP Mode
π‘Note-Taking
π‘Compile Command
π‘Org-Protocol
π‘Matrix
Highlights
Transition from Vim to Emacs and the resulting workflow questions.
Introduction to personal Emacs workflow with various tools and functions.
Utilization of Emacs's client-server architecture for quick session restarts.
Integration of Emacs with window manager for efficient buffer sharing.
Exploration of command line workflow in Emacs using async shell commands.
Use of popper package for pop-up terminal functionality in Emacs.
Comparison between Emacs integrated terminal and traditional terminal usage.
Demonstration of using shell in Emacs for programming tasks and session management.
Explanation of environment variable setup for consistent terminal sessions.
Discussion on capturing thoughts and ideas within Emacs for better integration with work.
Use of org-protocol for capturing information from outside of Emacs.
Application of the rubber ducky principle for problem-solving within Emacs.
Documentation of project progress using Emacs and sending updates via email.
Compiling code in Emacs using the compile command and custom configurations.
Setting environment variables within Emacs for specific programming language versions.
Use of LSP mode for code hinting and the transition from eglot to lsp-mode.
Employment of temple for code snippets in Emacs as an alternative to yasnippet.
Integration of Emacs with Discord and Matrix using eminent and emint.
Acknowledgment of Patreon and GitHub Sponsors for their support.
Transcripts
so when i first switched to emacs from
vim i got a lot of questions asking me
how i get my day-to-day workflow done a
lot of people say questions like i'm not
able to compile code i don't really know
a good workflow or
using the command line is just what i
know and i don't know how i could switch
away from it and a lot of questions and
statements like that that kind of made
me interested in talking a bit about my
workflow with emacs so i decided to make
this video just introducing you guys to
some of the concepts some of the tools
some of the functions that i use day to
day with emacs to try and give you guys
a better idea of kind of what a possible
workflow is there are literally
millions of ways that you can use emacs
this is just how i personally use it
anyways without any more delays let's
get into it
[Music]
so first off when i start up emacs i
have the actual server startup as well
so that way i can actually take
advantage of emacs's client server
architecture once i open emacs once i
can basically open them again
very quickly
faster than a lot of terminals can open
up because of that i can also have share
buffers between my windows that takes up
a lot of my window management i also use
splits pretty heavily so just like this
i can switch back and forth between
splits and i actually have that
integrated into my window manager i'll
post my configuration for that down in
the description if you guys are
interested now probably the biggest
thing for people coming from vim to
emacs is the question of how does my
command line work flow go
i'm really used to using the command
line i'm used to opening up a ton of
terminals and just running a command in
those then putting them off to the side
and ignoring them for a bit now luckily
the workflow actually doesn't change too
much if you're just running like simple
commands you can actually do a ton of
that just from emacs without any real
thought a good example of one that i run
all the time is updating my distribution
now for me all i would do is i would do
alt shift and the and symbol and this
allows me to run an asynchronous command
now i could do yay dash s-y-y-u enter
and it will run the command just down
here if i wanted it to maybe be a bit
bigger i can make it a bit larger i can
just simply hit enter and it will run my
update and everything which is pretty
helpful it's also worth noting that this
gives you a dumb terminal so you do get
access to a bit of extra functionality
good example of this is being able to
move around just like you would any
other buffer um without having to enter
some special mode and you can also just
type stuff and it will treat it like
normal obviously since this is running
an update that's not really going to do
too much for me now the nice thing about
this is that since i use this plugin or
package popper it basically allows me to
have this kind of act like a pop-up
terminal so a good example is i could do
just one key binding hide it pop it back
up and i can have multiple of these if i
wanted to and i use that for managing a
lot of my buffers that i kind of just
want to use for a quick little one-off
command or something like that now when
i really need a terminal often i will
just open up a terminal but sometimes
i'm not as much of a fan of this
workflow but i know a lot of people are
you could use v term and you get a fully
functional terminal and you could do i
don't know vim there you go and you can
run neovim inside of emacs if you really
wanted to do that but uh not really
necessary for most people and it's
actually pretty surprisingly fast about
as fast as you would expect any
integrated terminal in a text editor to
be now usually when it comes to normal
programming a lot of stuff that i end up
doing is running a command maybe i want
to have like a session for example if
i'm working on a node project sort of
stuff blah blah um but sometimes that
just is how it is that's how jobs work
uh and so sometimes you have to work
with node and sometimes you want to use
nvm and have a consistent terminal
session going and then what i tend to
use is i tend to use a shell so i'll run
the command shell and this will give me
a simple
um kind of like a simple dumbed-down
shell it still gives me the same key
bindings i'm used to in emacs if i did
ls i could kind of jump around just like
normal and it allows me to get the same
completion so if i want to do cat
tm and i could just hit alt slash and i
could get completion so tmp dot c alt
tab and that will try and complete it i
also obviously have a completion coming
from corfu which is my completion engine
basically what i use for code completion
but you can also kind of like copy stuff
around too if you wanted to and you get
like history backward searches i don't
really know what uh commands i ran
recently apparently i ran reboot
somewhere recently now probably the big
fear that a lot of people have with
using something like this is if they
called something like man and then
normally you would get
an interface with less but you can
actually basically add an environment
variable to tell it to use cat instead
of less and then as a result it gives
you a nice little way to avoid having
less because unfortunately less doesn't
really work in shell you'd have to use v
term to have that full terminal
functionality but who really needs less
when you have your entire text editor to
be able to do this obviously this is a
in my opinion better option than using
less it opens about as fast and
everything like that so not much reason
to use less in my mind and also there's
already a man command in emacs but this
was just a simple example now something
worth noting is that there is a cage out
there called with editor i believe it's
called which basically it's used in
magic which is a get client for emacs so
by default your alt uh your old amber
and symbol i won't actually call this it
will run async shell command but i have
it bound to with editor async shell
command
so that way i can do something like git
commit
and then hit enter
uh yeah let's open that in a new buffer
and it will actually let me edit this in
emacs so updated
templates
i guess
there we go
so as you can see it actually works
pretty well and you get a nice little
way to kind of integrate well with the
text editor when you run a command this
can be done with pretty much anything
that calls your text editor
right now on to note taking so a lot of
times when i am programming or really
getting any of my work done a lot of
times i'll have a thought or an idea and
i want to
capture that in a note now what i used
to do is i would use like the notes app
on my phone but that's not very helpful
because then you kind of lose a lot of
functionality you don't have access to
it on your computer you can't jump from
that to a line of code that's
kind of crazy i've never really heard of
people doing that um with a lot of their
note-taking but that's how i like to do
a lot of my stuff so say for example i'm
editing my configuration and i think of
a pretty clever idea and i would run the
command or the key binding control cc to
get a capture interface and this will
give me a bunch of options um so let's
just do
c for cool thing
and then this line was pretty cool
and then ctrl c ctrl c and that will
store that in my notes under this file
right here and if i just do control u
ctrl c c
and then do c to cool it will actually
take us to it and this
so this is the
little part that we added and we can
actually do ctrl c ctrl o to kind of
jump to that line in the code and it
will take us to the exact line that we
took that note at um and you can expand
this pretty far in fact i have that set
up with cute browser
as well as recently i set that up with
mixed and just for reference you can
actually take this a little farther so
while right now i'm just able to do
capturing from within emacs i can
actually do capturing from outside of
emacs so let's highlight this text and i
have this set up myself and you can do
ctrl c ctrl c and it will actually give
you a little prompt so let's do to do
this time hit enter and then it will
actually capture it and takes the text
that we had highlighted and allows me to
give it a name
and then i can go ahead and save that
and it's added to my notes just like
that very easy to integrate with other
tools i'm using something called the org
protocol you can kind of integrate this
into
more normal browsers as well there might
be something like that out for a similar
program using a plug-in this is actually
relatively straightforward with emacs
now while this may seem really simple i
actually do this quite a lot especially
when i want to kind of think through a
problem a lot of times
what you'll end up doing when you're
working on a big project is you'll have
a question for somebody
and before i actually ask them the
question what i try to do is ask it
myself so i'll write down as much
information as i can so a good idea
would be to
capture and then it would be knowledge
it's okay and i would type in a thing
a bit of a description about what's
going wrong and i would write out word
for word what my problem is as if i was
going to tell it to someone and then
this actually allows me to
come up with the solution myself it's
what's known as a rubber ducky principle
a lot of programmers and people in the
world use this to help them come up with
solutions to problems now something i
tend to do a lot as well is i'll be
working on this project i'll be
documenting everything that's happening
so project
so yeah i've got all these topics and i
can actually go ahead and send these off
as an email really easily doing org lime
subtree html eye so that way i could
actually have this in a whole buffer but
i guess in this case i could do this
with the whole buffer but we'll just do
this with the subtree hit enter and then
i hit p for my personal and i can
actually get this turned into html and
send this as a message to somebody um
this is really useful i used this a
bunch
at my previous job i actually sent this
a couple times to co-workers so they had
an idea of what i was working on now
next up is compiling code compiling code
is something that a lot of people have
issues with for quite a while and
probably the best way to get started
with it is actually pretty
straightforward what i'll do is i can go
ahead and compile it using the compile
command and so when i enter that it will
give you an option to enter in what the
command you want to use to compile is by
default it uses make but you can
pre-configure this for different file
types in addition you can also have uh
really clever tricks which i like to do
for example if i go to my
dwm
config.h at the very top here i actually
have this command right here and so this
little section at the top actually does
uh makes this that way when i do
compile
and enter it will actually enter this
command up here um and i use this for a
lot of config files where you need to
like run a command after you've changed
the config
so i can just to control x control m and
it will compile my program so there we
go and so it's updated my dwm
installation which is pretty cool a good
example of what i was talking about was
doing the dot x resources
right here i have a little command and
so if i did compile it will actually
give me the command so if i changed it
and run the compile command it would
actually update my x resources which is
a pretty useful
another thing the compile command offers
is a way to set environment variables
this was super useful when i had to work
with java and i had a version conflict
between my language server and the
actual code base
instead of having to go through a lot of
the headache of trying to get the
language server to work with a different
version of java i know it's possible i
just haven't really put in the time to
figure out how to do it
this gave me a way to basically just
whenever i wanted to compile change the
version of java i was using which is
super helpful now as you guys may have
noticed um when i went to that c file um
i got a lot of code hinting and this is
all done using lsp mode
up until very recently i was using eglot
but recently i've just started using lsp
mode
just due to like a few uh annoyances
probably the biggest one with snippets
while i know a lot of people like to use
yeah snippet i actually use uh temple
temple template it's just temple i guess
um but basically how they would work is
it's basically a way to do templates and
so you could like type in a command or
sorry like a like you do if and then alt
tab and that will give me a nice little
snippet here and i have to pre-define
these i know this is one of the losses
of not using yeah snippet but i
personally prefer
this current setup maybe i'll do a video
on this in the future but it's not
really i won't go too far into it for
this video but i could just have a
little like i
equals equals
10.
now obviously i'm getting
coding errors just because of that but
there we go so i could
move things around if i wanted to
kind of just wanted to show off my
current setup um obviously right now i
don't have this project configured
properly but yeah
and as well obviously as you guys know i
use uh sly i use sly for my actual lisp
editing so this one too you guys kind of
know that workflow so i won't really
bore you guys with it now while i do use
discord as my main server i actually do
also use uh element not quite as often
just because there's a few discord
servers for school and stuff like that
that i you know frequent every once in a
while and try to stay in touch with but
basically i what i like to use is
eminent
and emint basically allows me to just
one sec let me log in really quick sorry
about that just didn't want to show off
my password but emmett gives me a way to
kind of view a lot of my matrix servers
um
so basically a good example would be
let's go to my my general chat if i hit
enter it gives me all of the most recent
messages and i can scroll upward and get
earlier messages
and so this is nice when i want to use a
matrix channel and i do often use my
matrix channel when
sometimes since i have like a matrix
bridge set up um it's really nice just
because i can access the
discord server and for those of the
people that are on matrix they don't
have to worry about
um
me not seeing their messages because
sometimes there can be a bit of a delay
hey guys sorry for the sudden change of
scenery i was recording that really late
at night if you couldn't tell by the
fact that i was borderline whispering um
so i decided to cut off the video there
hopefully you guys don't mind and i'll
be sure to come back to the topic in the
future if anything were to change where
i go i would just like to give a big
shout out to connor g and russell willis
for supporting me on patreon and finally
platinus carr and tallguy janks for
supporting me on github sponsors if you
guys want to support the channel i'd
really appreciate it and you guys can go
ahead and find my get up sponsors and
patreon if you guys are to pick between
the two i'd prefer github sponsors just
because it uh throws more of the money
my way and it doesn't just pocket the
rest of it but anyways i really
appreciate you guys watching the video
let me know if you have any questions or
you want me to go in depth into any of
these topics because i did talk about a
lot of different tools and features in
emacs so be sure to let me know anyways
guys thanks for watching and i'll see
you next time
[Music]
5.0 / 5 (0 votes)