summaryrefslogblamecommitdiffstats
path: root/2022/info/eshell-after.md
blob: f7606994a9be626897b3f12145b8fd276b72541a (plain) (tree)
1
2
3
                                                                

 




















































































































































































































































                                                                                                                                                 
 
                                                                                                                                                                                                                               

 
                                            
<!-- Automatically generated by emacsconf-publish-after-page -->


<a name="eshell-mainVideo-transcript"></a>
# Transcript

[[!template new="1" text="""I have 10 minutes to talk you into""" start="00:00:00.000" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""giving Eshell a second chance.""" start="00:00:05.000" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Have the right perspective and expectation,""" start="00:00:07.880" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""and I think you’ll really enjoy it.""" start="00:00:10.120" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Just remember eshell is a shell,""" start="00:00:12.920" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""not a terminal emulator.""" start="00:00:15.680" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""I use both Eshell and vterm.""" start="00:00:17.840" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""I’m going to talk and type fast,""" start="00:00:20.280" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""as I have 10 reasons for you to try Eshell again.""" start="00:00:23.480" video="mainVideo-eshell" id="subtitle"]]
[[!template new="1" text="""1. It’s an Emacs REPL.""" start="00:00:29.000" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""I mean, check this out.""" start="00:00:32.600" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Let’s start up Eshell here.""" start="00:00:34.000" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Let’s just type a Lisp expression.""" start="00:00:37.000" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""It works.""" start="00:00:41.400" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""As a shell, the parens are kinda optional.""" start="00:00:43.920" video="mainVideo-eshell" id="subtitle"]]
[[!template new="1" text="""2. It’s also a shell.""" start="00:00:48.600" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""While eshell may look like a shell, like Bash""" start="00:00:52.520" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""you should view it as a REPL""" start="00:00:56.480" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""with parenthesis-less s-expressions.""" start="00:00:58.560" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""This makes sense, because a shell command with options,""" start="00:01:02.400" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""like this ls command,""" start="00:01:05.560" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""looks like an s-expression.""" start="00:01:08.000" video="mainVideo-eshell" id="subtitle"]]
[[!template new="1" text="""3. You can mix these two modes.""" start="00:01:10.120" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Shells can call subshells""" start="00:01:12.880" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""which return their output like a function call,""" start="00:01:14.960" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""like this Bash command.""" start="00:01:17.920" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""In this Eshell example,""" start="00:01:20.800" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""I use the output of a text file""" start="00:01:22.760" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""as command line arguments to ripgrep.""" start="00:01:24.640" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Notice how I use braces""" start="00:01:27.960" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""to state that it is a call to an eshell expression.""" start="00:01:29.640" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""We can mix Lisp-expressions and Shell-expressions.""" start="00:01:34.760" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Allow me a contrived example.""" start="00:01:40.040" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Notice I use good ol' setq to create a variable.""" start="00:01:45.600" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Yes, those are global Emacs variables available everywhere.""" start="00:01:50.080" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""In Eshell, the wildcard actually creates a list.""" start="00:01:54.920" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""This variable assignment doesn’t work as you might expect,""" start="00:01:59.600" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""as setq in Eshell is still setq,""" start="00:02:04.480" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""and it assigns variables in pairs.""" start="00:02:07.560" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""To make a list in Eshell, we use listify:""" start="00:02:10.320" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Without parens, Eshell is in “shell mode”,""" start="00:02:17.120" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""which means that words are strings,""" start="00:02:21.240" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""and variables need to be prefixed with dollar signs.""" start="00:02:23.800" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""A command can have both Eshell and Lisp expressions.""" start="00:02:26.880" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""As you can see here,""" start="00:02:32.400" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""I have a call to ripgrep,""" start="00:02:34.560" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""but part of it is an s-expression.""" start="00:02:37.120" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Remember the differences:""" start="00:02:40.320" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""With parens, eshell treats it as Lisp,""" start="00:02:42.240" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""like the last line in my example.""" start="00:02:46.160" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""With braces, eshell follows these shell-like rules:""" start="00:02:49.200" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""First, if it looks like a number, it's a number.""" start="00:02:53.920" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Otherwise, eshell converts it to a string""" start="00:02:57.160" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""(quotes, like a shell, groups words).""" start="00:02:59.440" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""What about this mix between functions and executables""" start="00:03:03.680" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""for the first word?""" start="00:03:07.520" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Functions that begin with eshell are called first.""" start="00:03:10.840" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Next in priority are executables on your $PATH,""" start="00:03:15.440" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""then matching Lisp functions.""" start="00:03:19.080" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""You can actually switch this order""" start="00:03:22.160" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""with the `eshell-prefer-lisp-functions' variable.""" start="00:03:23.941" video="mainVideo-eshell" id="subtitle"]]
[[!template new="1" text="""4. Emacs is actually better than shell.""" start="00:03:27.560" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""If the following works, why would you call""" start="00:03:31.760" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""expr or bc or dc, or any of those other calculators?""" start="00:03:35.200" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""You can just call a Lisp expression.""" start="00:03:40.040" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Why call less or more when you could call view-file?""" start="00:03:43.640" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Here, I’ve aliased less to view-file.""" start="00:03:48.000" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Load it up, and it shows up in an Emacs mode.""" start="00:03:52.840" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Just like with less, if you hit q,""" start="00:03:57.560" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""you go back to your Eshell terminal.""" start="00:04:01.520" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""I do have an improvement, though.""" start="00:04:05.760" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""The problem with view-file is""" start="00:04:08.440" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""it takes a single file as an argument.""" start="00:04:10.480" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""In a shell, we might want to view more than one.""" start="00:04:13.400" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""So let’s make a solution to that.""" start="00:04:15.720" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""This function will call the first function""" start="00:04:18.720" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""with the first argument,""" start="00:04:21.000" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""and the second function with each of the rest.""" start="00:04:22.160" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""This allows me to make a version of less""" start="00:04:26.680" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""that calls view-file on the first [argument] given,""" start="00:04:29.560" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""but open in another window for each additional file.""" start="00:04:33.160" video="mainVideo-eshell" id="subtitle"]]
[[!template new="1" text="""5. Better regular expressions.""" start="00:04:36.080" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Can’t remember regular expressions when calling""" start="00:04:41.240" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""grep or some other search function? Use the rx macro.""" start="00:04:44.800" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Here I call ripgrep again, but this time,""" start="00:04:48.640" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""I’m using a Lisp expression calling the rx macro""" start="00:04:55.920" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""to look for UUIDs in the files in my current directory.""" start="00:05:00.680" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""But I have another improvement for this.""" start="00:05:04.720" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""While the rx macro is freaking cool for Emacs Lisp,""" start="00:05:08.160" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""it doesn’t always translate to regular expressions""" start="00:05:13.480" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""accepted by most commands.""" start="00:05:15.920" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""The (I have no idea how to pronounce this) pcre2el project""" start="00:05:20.080" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""can convert from a Lisp regular expression""" start="00:05:25.200" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""to Perl-compatible regular expressions (PCRE)""" start="00:05:28.520" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""acceptable by most search commands.""" start="00:05:31.360" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""I’ve created a new macro here, prx,""" start="00:05:33.520" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""that translates the output of the rx macro.""" start="00:05:37.880" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""This allows me to type something much more readable,""" start="00:05:41.320" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""and probably easier to remember.""" start="00:05:46.520" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Certainly easier than this freaking regular expression.""" start="00:05:48.520" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""I’ve got an even better improvement.""" start="00:05:54.680" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""The rx macro with regular expression snippets""" start="00:05:59.440" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""can be assigned to key words""" start="00:06:03.560" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""that I can then take advantage of.""" start="00:06:05.760" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Now our command would be much simpler to type.""" start="00:06:08.680" video="mainVideo-eshell" id="subtitle"]]
[[!template new="1" text="""6. Loops are better with predicates.""" start="00:06:13.480" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Let’s say you want to remove the execute bit""" start="00:06:16.160" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""from files that have it.""" start="00:06:18.760" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""In a shell like bash, you need both a for loop and an if,""" start="00:06:20.480" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""as you can see in this example.""" start="00:06:24.400" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""With eshell, use a predicate to combine into a simple loop.""" start="00:06:26.600" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""The paren x after a file glob""" start="00:06:31.560" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""filters for only files marked as executable.""" start="00:06:34.360" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Now here is another improvement.""" start="00:06:36.880" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Since we often type loops to execute on one command,""" start="00:06:43.560" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""what about creating a function""" start="00:06:47.960" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""that can do this all in one go?""" start="00:06:49.520" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""This do function splits the arguments on that double colon,""" start="00:06:51.000" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""where the left side is a single statement to run,""" start="00:06:57.600" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""and the right side is a list of files.""" start="00:07:00.080" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""I have to append and flatten it""" start="00:07:02.600" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""in order for it to work.""" start="00:07:05.840" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""It loops through each file,""" start="00:07:07.640" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""creating an eshell command with the file appended.""" start="00:07:09.400" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""With this, I can remove the execute bit""" start="00:07:12.080" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""on all CSV files that have it.""" start="00:07:15.760" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""I see that my example wasn’t too good, as most commands""" start="00:07:20.760" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""like chmod accept multiple files, but you get the idea.""" start="00:07:24.320" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""In my final, larger form on my website,""" start="00:07:29.040" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""I don’t assume the command expression accepts""" start="00:07:33.160" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""a file as a final argument,""" start="00:07:35.280" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""as I can also replace underscores with the filename.""" start="00:07:36.720" video="mainVideo-eshell" id="subtitle"]]
[[!template new="1" text="""7. Output of last command.""" start="00:07:39.640" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Most shells have a special variable""" start="00:07:45.400" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""like $? for the exit code of the last command.""" start="00:07:48.800" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""While reading through the source code,""" start="00:07:52.840" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""I noticed that the $$ refers to""" start="00:07:55.920" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""the output of the last command.""" start="00:07:58.800" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""This seems pretty cool.""" start="00:08:00.600" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""However, Eshell returns true or nil""" start="00:08:05.800" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""when running external commands,""" start="00:08:10.760" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""so accessing the output from a call to ls""" start="00:08:12.720" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""doesn’t work as expected.""" start="00:08:15.880" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""But this is Emacs.""" start="00:08:19.480" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""We can fix that.""" start="00:08:21.120" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""After running any command, eshell sets these four variables.""" start="00:08:23.160" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""I can hook a function call after every Eshell command.""" start="00:08:28.120" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Using buffer-substring,""" start="00:08:33.520" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""I store the output into a global variable,""" start="00:08:36.760" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""and extend Eshell’s special variables list.""" start="00:08:39.280" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""In my Emacs configuration,""" start="00:08:43.600" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""I turned this variable into a ring,""" start="00:08:46.520" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""so while $$ works,""" start="00:08:48.480" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""so does array sub-scripting on that variable.""" start="00:08:51.440" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""This allows me to run a command""" start="00:08:54.400" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""and use the output from that command more than once.""" start="00:08:58.400" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""The code for this is a bit longer,""" start="00:09:02.280" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""so you’ll need to see my Emacs configuration for details.""" start="00:09:05.280" video="mainVideo-eshell" id="subtitle"]]
[[!template new="1" text="""8. Redirection back to Emacs.""" start="00:09:08.520" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Output of any command""" start="00:09:13.440" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""can go to kill-ring (or the clipboard).""" start="00:09:14.880" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Think of the implications.""" start="00:09:18.520" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""You don’t have to go into text selection mode.""" start="00:09:21.080" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Just grab the output.""" start="00:09:23.840" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""In fact, with our $$ improvement,""" start="00:09:26.240" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""we can always copy the output from the last command""" start="00:09:30.280" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""to the clipboard.""" start="00:09:33.240" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Better yet, let’s write the output""" start="00:09:34.080" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""to our engineering notebook.""" start="00:09:38.000" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Here’s my idea.""" start="00:09:39.400" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""First, create a capture template that takes a string,""" start="00:09:41.680" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""or if called interactively, the region,""" start="00:09:46.080" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""and that does an immediate-finish after inserting""" start="00:09:48.200" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""that string to the default notes file.""" start="00:09:51.880" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Next, create a wrapper function""" start="00:09:53.880" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""to call org-capture-string to run that template.""" start="00:09:57.680" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Finally, we add our new function to eshell-virtual-targets.""" start="00:10:01.560" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Let’s see this in action.""" start="00:10:07.640" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""I have a CSV file of user information.""" start="00:10:08.760" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""I can use grep and cut to extract some of that""" start="00:10:15.708" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""and write it out to this month’s engineering notebook.""" start="00:10:19.720" video="mainVideo-eshell" id="subtitle"]]
[[!template new="1" text="""9. Using Emacs buffers.""" start="00:10:26.880" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Why leave the results of eshell commands""" start="00:10:35.280" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""in the *eshell* buffer?""" start="00:10:39.160" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Send the output into a buffer where you can use it.""" start="00:10:40.280" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Here’s a call to ripgrep""" start="00:10:44.120" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""that searches for lines with email addresses""" start="00:10:48.000" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""using a complicated regular expression""" start="00:10:50.760" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""that I added to my prx macro.""" start="00:10:53.520" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""When I switch to this almost-grep buffer,""" start="00:10:56.080" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""I can turn on grep-mode.""" start="00:11:01.080" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Now I can jump around as if I just called grep directly.""" start="00:11:03.320" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Perhaps I’m proficient with my prx macro""" start="00:11:09.040" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""to filter out entries,""" start="00:11:14.760" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""but not good with shell commands""" start="00:11:16.640" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""that I can use in pipes to extract just one…""" start="00:11:19.280" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""the address column, for instance?""" start="00:11:24.000" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Let’s just extract it,""" start="00:11:26.040" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""send it to a buffer called email-list,""" start="00:11:28.960" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""and now I can use Emacs commands that I know and love""" start="00:11:33.280" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""to edit the data directly.""" start="00:11:38.480" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""We currently have an over-sight""" start="00:11:39.800" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""that the Eshell’s built-in cat command""" start="00:11:55.800" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""doesn’t pipe buffer contents as standard in.""" start="00:11:58.840" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""So I created a bcat, a buffer cat, function to do this.""" start="00:12:02.720" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""So this command works""" start="00:12:07.920" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""to grab my email addresses I just extracted""" start="00:12:09.880" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""and send them to another program.""" start="00:12:14.600" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""If you’re interested, I have a more elaborate""" start="00:12:16.320" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""and yet simpler workflow surrounding sending data""" start="00:12:20.960" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""back and forth from Eshell to Emacs buffers.""" start="00:12:25.760" video="mainVideo-eshell" id="subtitle"]]
[[!template new="1" text="""10. Did I mention that you can cd to remote systems?""" start="00:12:28.400" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""This command uses SSH to jump to my host, goblin,""" start="00:12:35.680" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""start a root session, and jump to the etc directory.""" start="00:12:39.880" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Remember that Tramp can be finicky""" start="00:12:44.040" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""if you start blinging your remote hosts with oh-my-zshell,""" start="00:12:47.720" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""and funky prompts and things like that,""" start="00:12:52.840" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""so your mileage may vary.""" start="00:12:57.791" video="mainVideo-eshell" id="subtitle"]]
[[!template new="1" text="""In summary: Use eshell if you want""" start="00:12:59.360" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""a quick way to run commands and Emacs functions as a REPL,""" start="00:13:03.960" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""or to run an OS program but process the output with Emacs.""" start="00:13:07.320" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Keep in mind that Eshell has two types of subshells,""" start="00:13:11.480" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""and you can mix and match during a command call.""" start="00:13:15.920" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""The rx macro is really cool.""" start="00:13:19.600" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Eshell loops are better with filters and predicates …""" start="00:13:22.640" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""if you can remember them.""" start="00:13:26.600" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Take advantage of Emacs buffers""" start="00:13:28.240" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""to really enhance your shell experience.""" start="00:13:30.960" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""You’ve now seen that just like Emacs,""" start="00:13:32.880" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""I’ve crafted Eshell to be my own shell creation,""" start="00:13:36.040" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""tailored to my workflow.""" start="00:13:39.520" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""So, steal my spells, cast your own magic,""" start="00:13:41.040" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""but feel free to share your incantations back to me.""" start="00:13:44.800" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""I’ve gone over my time allotment, so we’ll have to""" start="00:13:48.760" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""continue this discussion on the intertubes.""" start="00:13:51.360" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Why yes, I have joined the birdless diaspora,""" start="00:13:53.680" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""so toot me over there.""" start="00:13:57.160" video="mainVideo-eshell" id="subtitle"]]
[[!template text="""Thanks.""" start="00:13:59.200" video="mainVideo-eshell" id="subtitle"]]



Captioner: howard

Questions or comments? Please e-mail [emacsconf-org-private@gnu.org](mailto:emacsconf-org-private@gnu.org?subject=Comment%20for%20EmacsConf%202022%20eshell%3A%20Top%2010%20reasons%20why%20you%20should%20be%20using%20Eshell)


<!-- End of emacsconf-publish-after-page -->