Files
hpr-knowledge-base/hpr_transcripts/hpr0852.txt

303 lines
28 KiB
Plaintext
Raw Normal View History

Episode: 852
Title: HPR0852: GNU Emacs 1
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr0852/hpr0852.mp3
Transcribed: 2025-10-08 03:34:00
---
Everyone, this is HackerPublic Radio. My name is Klattu, and this is the beginning of a mini-series
on EMAX, and before you press fast forward, don't worry, this is not a religious word.
I'm actually kind of both an EMAX and VIN user. I use EMAX for my creative and technical
writing, and I use documentation kinds of things, and then I use VIN really for conf files
or quick edits when I'm updating my index page on my little other podcasts website. I
use both. I can't get into the whole EMAX versus VIN ones better than the other. I'm
just not there. Maybe at some point in the future someone will make me a really good
offer, the EMAX liberation front or the VIN people's army will make some kind of offer
to me and sway me over to their side, and I'll use one or the other exclusively, but for
now I'm pretty good with both of them. I'm happy with both of them. I think they both
do different, they both feel different needs quite, quite well. I'm well aware that both
of them are powerful enough really to be expanded upon and really become really the
only editor one may ever need, but right now I'm fine with using both. Besides that,
I think that we all know that the real in any here are those little or text editors
like Nana or Pico or G-Edit, which claim to be real text editors when really they're
just trying to detract from the power and market share of EMAX and VIN. So watch out
for those. Anyway, my point is that I'm not selling you EMAX here. This is not a show
about why you must use EMAX, why it's so great, why it has a bad rap, but really it's such
a great application. I don't care about any of that stuff. I just am finding that like
any really good application, the further you, the more you use it and the further you
kind of like start to explore all of the different options, the more you find out that,
wow, it really lives up to its reputation as a robust platform. So here's what EMAX does
for me. It's got plugins galore. If you want, I don't know that they're called plugins,
like I say I'm not, I haven't really been indoctrinated into the whole EMAX fold and I don't
know the terminology. I call them plugins. They could be called modules, whatever. It's got a
lot of them. I don't know if you've heard, but yes, it's got a lot of stuff that you can
load into EMAX and they become little applications in and as of themselves. And it's very powerful.
So no matter what kind of text editing you are doing, you could probably imagine, you can probably
count on there being a module to help you do that thing. So whether you're programming in Ruby
or Python or C code, I imagine, or you're editing confiles, XML work like Docbook, whatever,
or even HTML, I use the XML mode for HTML. Or like I've mentioned on my show quite a bit,
even screenwriting. There's just all kinds of modules that you can load up. And of course,
it's customizable enough that you can just assign them to a certain key binding and it can be like
F1 or F4 or whatever you want. So they're very, very easy to get to. EMAX has accessible programming
language that it uses called Lisp. And I believe that the variant that EMAX specifically uses is
called ELisp. And I don't know anything about Lisp or ELisp. I don't know why it exists or who
came up with it. I know it's pretty old. It's actually pretty easy. Well, I shouldn't say easy.
It's accessible, meaning that even if you're just a new like me, non-programmer, don't know what
you're doing. If you open up a couple of ELisp plugins that you use, or you open up even a very
complex .emax file, which is a config file for EMAX, you look at it and you honestly, you start
to get a feel for what they're doing. You start catching on to little conventions that, you know,
if you hang around enough, you start to really kind of get into it and you start to make up some
of your own. You save it. You try it out. It doesn't work. You go back, you do it again, and it
kind of works. You finesse it. And finally, you've got little stanzas of ELisp that you've written
and is working, you know. So I don't know if that's really programming. I don't know what that
would be called, but it is very, I guess, hackable. And I'm telling you, it's very hackable from,
this is coming from me. Clat 2, not a programmer. And even I, little old me, was able to take
the screenwriting plugin that changed my life and let me write screenplays in EMAX
on any platform that EMAX would run on, which is basically everything, any processor, you know,
in EOS, whatever. I was able to take that plugin and actually patch it and add functionality to it.
And that's not normal. So, so there's obviously something going on with this little Lisp or EOS
thing that someone who doesn't know anything about programming can actually figure out. So,
that's exciting. It's also accessible to blind people. And I've done a, I think, a whole episode
on this and and I've written an article on it. I don't, I think it was about to be published and
then it wasn't published, but, you know, it's out there anyway. And it's, there's this whole
interface called EMAX speak, which is an E speak based interface that will read lines
on it within EMAX. And since EMAX has so many plugins in theory, you could really,
if you're blind, you could launch EMAX. You could even launch it upon login. And you'd have a
fully spoken text based spoken interface that you can use at any time. And especially since,
I mean, like I say, if you have any kind of propensity toward coding, you, you might even be able
to really kind of tweak your environment to exactly how you want it simply because it is so
accessible for, for everyone. There's endless customization. Like I say, it's very accessible,
programming environment, but it's also just, it's, it's, there's so much you can do with it.
Everything is customizable. It's, it's really, it strikes me as something a lot like KDE,
for instance, where if I want to put Mac keyboard bindings on KDE, it takes me one moment to load
my little config file and bang, I've got that. If I want to make it look completely different,
I can take away menu bars, I can move panels, I can do whatever I want to.
So easily on, for instance, KDE, so that it works exactly how I want it, same deal with EMAX.
You can just go into the dot EMAX file, your main configuration, and totally change everything
around, change the keyboard bindings. If you don't like the whole control X, control Y, control X,
control S, you know, all the control X control, you, you can change it. You can actually just tell
EMAX to do a global set key and change the bindings. So you don't have to settle for whatever
people are handing you, which is one of those oft sighted reasons for using Linux in the first
place, right? People say, well, I really like Linux because I can customize it exactly for me,
and the same truly applies to EMAX. It does teach you bash tricks ever since I started using EMAX
on a fairly regular basis. My bash navigation has become a lot more efficient. I've gotten around
in bash so much smoother, just from knowing all the EMAX key bindings. Now, again, I'm not trying
to sell you on EMAX or anything. I'm simply telling you this. You're free to use, for instance,
the Z shell and put in your VIM key bindings. And you too will be more efficient in your shell,
in your terminal emulator. So the end result is the same, and that equals you getting better at
what you do all day anyway. But I'm just saying, if you prefer, if you're using bash, if you know
bash, you're comfortable in bash, and you are curious about EMAX, then learning the two
in tandem actually really work well. Did I mention that there were plugins available? I think I did,
but I should probably just mention that again. There are a lot of plugins for EMAX. And, of course,
last but not least, there's even a text editor. Yes, I threw in that old joke. Okay, so some words
of warnings because EMAX is very famous entity. And so there are some things that we should talk
about, kind of clear the air, get a common understanding here. So first of all, yes, run EMAX in a GUI.
Believe me, I used to think, because see, my introduction to EMAX was on MacOS 10. And MacOS 10
ships with a slightly older version of EMAX, and you access it through the terminal, and you'll
see on all these Mac rumor sites and Mac forums that there are these cool little hacks in the
terminal. And what you do is you go in and you type in the word EMAX, and then once that launches,
then you type in, I forget how they get you there, but it would be something like Meta X,
the word Tetris. And then you can play Tetris in the terminal. And it's so cool. And people are like,
oh, this is great. I don't know what this EMAX thing is, but there's Tetris. And it's in the
terminal. So I must be really a power user now. When I found out about EMAX, which, of course,
was actually because of Tetris, I realized that this must be a really cool application, and I
started reading up on it, and I kind of found the GPL through that. Basically, it all went downhill
from there. No more Mac. But yes, in my mind, EMAX was like this cool terminal thing. And when I
heard that there was a GUI out for it, I just thought, well, that's just crazy. That's ridiculous.
No one wants a GUI. And so I tried to teach myself EMAX in the terminal. And let me tell you, it was
just with the tutorial, no less, the EMAX tutorial. And it was the most miserable experience of my
life, I think. It was just, it was hard. They kept telling me not to use arrow keys, and I felt bad,
because I wanted to use the arrow keys, so I was using control F and B and N and P, and they were
all over the keyboard. It was horrible. It felt terrible. Do not do that. Don't do that to yourself.
The non-X version of EMAX is so much easier to run after you run the X version of the Zorg
version of EMAX. I'm not saying X EMAX. X EMAX is a different project, but there is X. And you should
run X. And you should run EMAX in X. Do yourself that favor. You get the mouse, you get a friendly
little menu, you get a scroll bar on the side. It will make you happy. You will like it.
So that's probably how it's already installed on your distro. Like if you get EMAX from your
repository, it's going to come down with X, but don't be like me and always launch it with the
no X flag or whatever it was. It's just not worth it, trust me. You can learn it in Zorg,
and then in the X graphic environment, and then you can SSH into a box somewhere and start using
it without X, and it'll be great, because you won't need the menus by then. But at first,
just don't do it to yourself. And for the record, one of the smartest,
unix guys that I know swears by EMAX, and yes, he runs it in X. So don't fear the GUI. In this case,
don't be a key binding snob. Again, I was trying to do the EMAX tutorial. They kept telling me
don't use the arrow keys. I was learning Control F and B and P and N and all these other commands,
and it was just terrible. It was a horrible way to navigate on a daily basis. The arrow keys are a
wonderful invention. No one should have her have a keyboard without arrow keys. And I was trying
to avoid them for a long while, and I just ended up with me not using EMAX at all. That was the
end result. Rather than going into EMAX and using it, I would avoid it because I knew that I
couldn't use the arrow keys or something stupid like that. So I finally realized that I have not
been at a keyboard without arrows in a very, very long time, at least not regularly. Admittedly,
there have been those times. And they're not computer keyboards. They'll be cell phone or Nokia,
handset, things where you're in this hacked together terminal on a rooted device, and they don't
have arrow keys. They didn't allow for that. So that's when you just kind of pull back from the old
memory banks, the fact that Control F is for, Control B is back, Control P is previous line, Control
N is next line, and that's all you have to do. That's enough. You've heard it from me once. You
will probably remember it the next time you happen to find yourself in front of a keyboard without
arrow keys using EMAX or BASH. Like I said, you can actually benefit a lot from these EMAX
tips in BASH. But my point is, don't worry about having to play by rules and having this fear
that, oh, what if I'm in front of someone else's computer, and they've got a standard install of EMAX,
then what will I do? Because I won't know the key bindings. Yes, you will. Don't worry about it.
It's not that complex. Customize. That's why we use this OS, and you'll be using this text editor
for the same reason. So, yeah, feel free. Customize it. Make it exactly how you want it. You will enjoy it a
lot more. And finally, don't be exclusive. Like I've said, I use both EMAX and VIM, and sometimes Kate,
you know, I mean, it's just whatever you want to use. Don't think that you have to get into the
whole cliche of, I'm a VIM user or I'm an EMAX user only or whatever. It doesn't matter. EMAX
is a program. VIM is a program. They don't actually care what you use. They're not aware of your
feelings. Use whatever you want to in that moment. If you're doing a quick edit to something and
you want to use VIM, go for it. If you want to do something a little bit more complex or something
with a plugin that you know you love, and you want to use EMAX, do that too. As funny as the
the little cliche is, a little in joke about VIM versus EMAX, I think in real life people don't
actually care. So you shouldn't either, really. So we should get started then. So if you haven't
installed EMAX yet, or if it doesn't come pre-installed, and a lot of times it doesn't come pre-installed,
because it is a big program. It's a very, very large program. And with just cause, I mean,
if it was just a text editor at 75 megabytes, admittedly I would look at it maybe with a little
bit of trepidation or suspicion, but it's so much more. So install EMAX from your distribution,
or if you are not on Linux at the moment, you can of course get it for OS 10 from EMAX for OS X.com.
I think it is. It's a nice little Coco GUI that you can use, and it'll still work exactly like
normal EMAX. It's really, really great. And on Windows, they have a Windows binary on the EMAX site.
You can download it. I don't really know how to install it, or how to even run it, but it's a
binary. So you can launch it however you launch it on Windows, and it will open in some fashion.
And again, it'll be exactly like EMAX that I'm talking about on Linux with the couple of
exceptions, like I don't know where you would put the .emax file on Windows, for instance,
but on OS X it'll be exactly the same. All the paths and everything will be basically the same.
So yeah, it will run on anything, believe me. It's fantastic. I've got power PC boxes all over
the place, and happily all of them run EMAX, and I can write a screenplay at a moments notice on
any computer. So it's really nice, which is actually more than you can say for any other screen
playwriting solution out there. But I digress. So let's get started. So launch EMAX.
And the first thing you should see is a splash screen. And somewhere on that splash screen,
there will be a little check box that says, don't show this next time. If I were you,
personally, I would check that box because the splash screen starts to get annoying after a while.
But whatever you want, but if you check that, then next time you launch it, it won't give you this
splash screen. Here are the must-know key bindings. Control X, hit Control X, and then Control F.
That finds a file. What is finding a file? Well, it means it's going to open a file that already
exists, or it will establish a new file that does not yet exist. Now, if you hit Control X and then
Control F, you'll notice that, well, in the GUI version, no, it's actually the same in both.
You'll notice that your cursor kind of disappears sort of. And if you look down at the bottom of
your EMAX window, there's this little strip down at the bottom. And it's asking you to find a file.
So that's just where you can text into what file you want to open. This little strip at the bottom
is called the Mini Buffer. And that's a term that you're going to want to remember. I'm going to
try to use it fairly frequently. And I'll also call it the little strip at the bottom so that we
keep remembering that we're talking about the little strip at the bottom. But that's the Mini Buffer.
And that's kind of the interactive mode of the functions of EMAX. So anytime you're in EMAX and
you're doing something, you're executing some kind of command that's then going to need another
argument from you. It drops you down into the Mini Buffer. The great thing about EMAX is,
one of the many great things is that there are no pop-up windows. I mean, obviously this is
fairly common for textual, terminal kind of based editors. There really can't be pop-up windows
exactly. I mean, there can be links uses it or e-links one of those two. But it's not really the same
paradigm anyway. But EMAX doesn't do that. They give you little, what are called buffers,
little frames within your window to respond within. On the other hand, if you want the GUI,
you want the pop-up boxes and the dialog boxes, which is fine. Like I say, you don't have to
be exclusive here and say that, well, I'm going to use EMAX and I'm not going to use any pop-up
windows dialog boxes or for noobs. It's not necessarily true, or you might be setting this up
for a noob. Either way, if you feel like that right now, then go to the file menu and you can
choose either visit a new file, which will, if you select it, it will bring up a dialog box,
just like a normal GNOME, probably XFCE, that kind of GTK dialog box, and you can create a new
file. You can name the file whatever you want to, or you can visit or rather open file,
and that will let you grab a file that already exists, and it will open it up in your main screen,
in your main buffer, not the mini buffer, in the big buffer. And so that's opening a new file,
or establishing a new file, either way. So if you do that, and you just type some random
stuff into it, doesn't really matter what you write, but just give yourself some text to play
around with. There you go. Now, the next thing you would probably want to do is save it,
and that's Control-X, Control-S, for save. So already, you're probably getting the idea,
okay, so these commands are largely based around Control-X. You would be right. A lot of the commands
in EMAX, the preset commands that EMAX pushes over onto us are Control-X, or they're Control-X,
and then some other thing. So it's a little bit like VIM, where you hit the Escape key,
and then something. This is kind of like, okay, we're going to hit Control-X to get into a
into a mode, we're into an executing something mode, and then we hit another keyboard shortcut,
or another key, and it does something. So kind of good to remember that, and like I say,
everything's customizable, as you'll see, but we'll stick with this for now. Control-X, Control-C,
will close EMAX. Now, if you haven't saved your document yet, it will ask you, are you sure,
you want to save? Now, like I said, normally in EMAX, it won't ask you in a pop-up window. I've
seen the pop-up window come up, and that is if you go to the menu and select Quit, for instance,
then yes, a graphical pop-up window will pop up, and you can choose whether you want to save it,
or save all the buffers, or whatever. And we'll talk more about buffers, don't panic.
But in, if you're just doing it with the Control-X, Control-C, then down in the mini-buffer,
that little strip down at the bottom, it asks you, hey, or it tells you, hey, this buffer that
you've got here isn't saved yet, you've made some changes, are you sure you want to quit?
So you can say yes, and you want to save that yes, or no, I don't want to save it continue.
So just read it, respond, it will do what you ask it to. It's very nice like that.
Okay, what if you accidentally hit a key, like accidentally Control-X, and actually you didn't want
to do anything, you don't have anything to do, you don't want to save it, you don't want to
open a new file, you don't want to close, what do you do? Well, you hit Control-G. Control-G
is the panic button. I don't know why it's Control-G, I always think of it as Gnu, like you have to
call on Gnu to help you or something, I don't really know, but Control-G, that's like the panic button.
If you ever do anything, and it's trying to get you into some other mode, or force you to give it
a command, just hit Control-G a bunch of times, and it'll get out of that mode, and you're just
being normal sort of text editing mode again. Okay, so those are the must-know key bindings,
the ones that you've just absolutely, you've got to know about them. It is very powerful EMAX,
because it has a built-in Gnu screen. I don't know if you know of Gnu screen, if you're
a frequent terminal user, I'll bet you do know about Gnu screen. Gnu screen is this
thing in the terminal that will launch invisible terminals on top of each other, and you can
switch back and forth. So you have one terminal window open, and you might do a top on one,
and then you can launch a new screen, and it just kind of overlays a new terminal over top,
and you could do, I don't know, tail or demessage pipe tail dash F. Now you're looking at your
little kernel message log interactively or continuously, and then you could do a new screen,
and you'd have that open, and then you could go into a cont file and edit some stuff.
You're using screen. Well, in EMAX, it's very, very similar to that concept. So you've got one
window, right? You've got an EMAX window, and it's open. Well, right now we're sitting in this
file, this Foo.TXT file that we started, but you could open a new file and call it bar.TXT,
and then you'd be in that file. Where did Foo.TXT go? Don't worry, it's still open. It's just
in this little invisible stack of windows that you've got inside of your EMAX window.
So let's play around with that a little bit, and then we'll call it a day for this episode.
But this is a cool feature, and I want to kind of get you familiar with this concept before we
call it done. So buffers. Like I said, Control-X Control-F will open a file, right? So if you
are without a file, do a Control-X Control-F to find a file, and you can create a new file,
for instance, Foo.TXT. So this creates a new buffer, and the buffer is by default named
whatever the file that it contains is named. So right now, if you've just typed in Control-X,
Control-F, and then gave it the name of tilde slash Foo.TXT, or tilde slash documents slash Foo.TXT,
whatever you're naming the thing, then your buffer is called Foo.TXT. And inside of that buffer,
that buffer is an unsaved document without anything in it yet called Foo.TXT. So type some stuff
into it. Just, again, just kind of give yourself something to play around with.
Some text. Okay. And then Control-X Control-F. Now we're going to open a new file. So find a new
file, maybe tilde slash bar.TXT. And now we've got another buffer called bar.TXT. How do I know
this? Well, because I'm staring at a blank screen again. So we'll type in some more stuff. Now,
we'll identify this for ourselves. I'm just going to type bar, bar, bar, bar, bar. So now I know
this is bar.TXT. It's very readily apparent. Okay. So now we know because we did it that we have
two buffers open. The question is how to get between them. It's actually really easy. Control-X,
and then the letter B, as in buffer. So when you do that, look down at your mini buffer. That little
strip down at the bottom. It says switch to buffer. And mine says default messages. That's because
I'm not really doing everything that I'm saying I'm doing. But yours should, I think, say default
food.TXT. So you can hit return to switch over to food.TXT or you can hit the up arrow. And you'll
scroll through all of the different buffers that are actually open. You probably didn't even realize
they're open. There's a scratch. There's messages. And in mine, of course, there's a food.TXT.
And then hpr underscore emax, which is my little, the notes that I'm doing to keep me on track for
this. And then there's a blank one. And there's a dot emax. So there's all kinds of things open
right now. And if I just scroll up or down with my arrows, then they scroll through those buffers and
get me into one or the other. So I can switch back and forth. Essentially, I mean, if you think
of it, it's kind of like two windows on a desktop. If you do an alt tab, then you're switching back
and forth between those two windows. That's what you're doing here. Control X and then B. And you're
switching back and forth between your open documents. You can also, if you are a little bit overwhelmed by
so much scrolling, is just, instead of hitting up or down or enter in your little buffer dialog box,
just hit the question mark. And you'll see a new frame slide in from the side. And it has a list
of each different buffer that is available to you. And you can with your mouse. Yes, I know.
Using a mouse in emax, it's phenomenal. Now there are other ways to do this, but I'm going to,
we're going to use the mouse right now because I'm sure you're probably starting to get
pretty nervous with all this stuff going on. So we'll just click on the buffer that we want to
go into. And sure enough, it opens that buffer for us. Pretty impressive. So yes, there is a mouse
and you can use it to some degree. So that's buffers. That's the general idea of buffers. You should
try to play around with those buffers. That concept over the next week or so or whatever. Play around
with the keyboard shortcut. Control X, Control X, Control F for file, Control X, Control F for save,
Control X, Control C to close, and then Control X B to switch to a buffer. And you can always kill a
buffer too. If you get tired of looking at the same buffer all the time and you're annoyed with it,
you can Control X B to the one that you want to get rid of. Let's say the scratch, and then Control X
K to kill it. And it says kill buffer, default scratch. That's the one I'm in right now. I'll hit
return and now it's gone. It's no longer in my list of buffers. So that's kind of nice.
And remember, Control G is the old, good old panic button. It's really important to remember,
because you'll be using it a lot. Trust me. So that's it. I mean, that's the beginning of EMAX.
And already we've seen some pretty cool features like these buffers that keep getting automatically
created. When you open a new document, we've seen a new frame slide in from the side. It created
a slide that popped in. But you know, the new frame with this list that we could even click on with
our mouse, modern technology at its finest. So yeah, this is, this is very exciting. I can tell you're
you're excited for more, but I'm going to, I'm going to cut you off. I'm going to call it quits
for your own good. We will resume our EMAX lessons in another episode. For now, just practice the
commands and the keyboard shortcuts that I've given you. And then we'll do more in part two of EMAX
from Newbed to Pro. You have been listening to Hacker Public Radio. Our Hacker Public Radio does
are we are a community podcast network that releases shows every weekday Monday through Friday.
Today's show, like all our shows, was contributed by a HBR listener by yourself. If you ever consider
recording a podcast, then visit our website to find out how easy it really is. Hacker Public Radio
was founded by the digital dot pound and the infonomicum computer cloud. HBR is funded by the
binary revolution at binref.com. All binref projects are crowd-responsive by linear pages. From shared
hosting to custom private clouds, go to lunarpages.com for all your hosting needs. Unless otherwise
stasis, today's show is released on the creative commons, attribution, share a line, read