Spicy
This commit is contained in:
parent
3f51a0dd1e
commit
05090c4ad0
167
emacs.org
167
emacs.org
@ -1,41 +1,148 @@
|
|||||||
#+AUTHOR: Simponic
|
#+AUTHOR: Simponic
|
||||||
#+DESCRIPTION: An emacs presentation
|
#+DESCRIPTION: An emacs presentation
|
||||||
|
#+STARTUP: fold inlineimages
|
||||||
|
|
||||||
* What is Emacs
|
* XKCD
|
||||||
+ Emacs is a super extensible programmable "editor"
|
[[./images/real_programmers.png]]
|
||||||
- You can write documents, code, agendas, emails, etc.
|
* What is Emacs?
|
||||||
- Editor in quotes because it does much more than edit stuff
|
** Emacs history
|
||||||
+ Tetris is in Emacs by default
|
*** From the [[https://www.emacswiki.org/emacs/EmacsHistory][EmacsWiki]]:
|
||||||
+ Browse the web!
|
+ Emacs began at the Artificial Intelligence Laboratory at MIT. Beginning in 1972,
|
||||||
- I don't really know why you would though, but hey it's there
|
staff hacker CarlMikkelsen added display-editing capability to TECO, the text editor
|
||||||
+ It can even be your window manager with the package exwm
|
on the AI Lab’s IncompatibleTimeSharingSystem (ITS) “Display-editing” meant that the
|
||||||
+ Written in Elisp
|
screen display was updated as the user entered new commands; compare the behavior of
|
||||||
- A dialect of lisp written specifically for Emacs
|
"ed". In 1974, Richard Stallman added macro features to the TECO editor.
|
||||||
- All configurations are done in this language
|
+ In 1976, Stallman wrote the first Emacs (“Editor MACroS”), which organized these
|
||||||
+ Example:
|
macros into a single command set and added facilities for SelfDocumentation and to be
|
||||||
#+BEGIN_SRC emacs-lisp
|
extensible. TecoEmacs soon became the standard editor on ITS.
|
||||||
(split-window-below)
|
** Emacs is a super extensible "editor" that is written in ELisp
|
||||||
(split-window-right)
|
*** Why is editor in quotes?
|
||||||
|
**** Emacs does much more than edit text
|
||||||
|
- To show itself off, Emacs by default comes with a full game of
|
||||||
|
tetris!
|
||||||
|
+ Let me assert my nerd dominance by showing my tetris skills :)
|
||||||
|
#+BEGIN_SRC emacs-lisp :results silent
|
||||||
|
(tetris)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
- By default, Emacs does not have a way to go back a "window"
|
+ It even works in the terminal! Albeit kinda squished
|
||||||
+ Time to learn some Emacs Jargon!
|
- Besides being a great tool for when you're bored and your boss is looking
|
||||||
- Buffers
|
away, Emacs can also:
|
||||||
+ Buffers are kind of like tabs in a "regular" editor
|
1. Write emails with the mu4e package
|
||||||
- Windows
|
2. Write documents with Org Mode (more on this later)
|
||||||
+ These are where buffers can be drawn
|
3. Be your window manager with the exwm package
|
||||||
+ Like splitting in vim
|
* I've given this a try, but I'm gonna stick with dwm
|
||||||
- Frames
|
4. Browse the internet with eww!
|
||||||
+ These are Emacs instances
|
#+BEGIN_SRC emacs-lisp :results silent
|
||||||
+ What you would normally call a "window"
|
(eww "https://gnu.org")
|
||||||
- You really only need to know about buffers and windows
|
#+END_SRC
|
||||||
+ Let's look at some Elisp to do this for us!
|
I'm not entirely certain why one would do this, but hey it's there!
|
||||||
#+BEGIN_SRC emacs-lisp
|
*** Some Emacs Jargon
|
||||||
|
Before continuing, I want to define some terms that are common in emacs.
|
||||||
|
**** Weird key-binding notation?
|
||||||
|
* "C" is control
|
||||||
|
* "M" is alt/meta
|
||||||
|
* "S" is shift
|
||||||
|
* When there is a "-" between two keys that means press them together.
|
||||||
|
* When there is a space, seperate them
|
||||||
|
* "C-x C-f" means press control and x together, then control and f.
|
||||||
|
- Or hold down control, press x, then press f while still holding it down
|
||||||
|
**** What is a "buffer"?
|
||||||
|
* A buffer is like a "tab" in most editors. You can swap between them
|
||||||
|
with "C-x C-b"
|
||||||
|
**** What is a "window"?
|
||||||
|
* A window is where a buffer is drawn to. They are like the window splits
|
||||||
|
in Vim
|
||||||
|
* Cycle between windows with "C-x C-o"
|
||||||
|
* Close a window with "C-x 0"
|
||||||
|
**** What is a "frame"?
|
||||||
|
* A frame is a whole instance of emacs. These are what you'd regularly
|
||||||
|
refer as windows in normal computer discussions. You can move them around,
|
||||||
|
minimize them (if you're using a tiling window manager), close them, etc.
|
||||||
|
* Not very commonly used, though every once in a while you might come across
|
||||||
|
a post asking about them
|
||||||
|
**** Good-to-know keybindings
|
||||||
|
1. Quit emacs with "C-x C-c"
|
||||||
|
2. Find a file with "C-x C-f"
|
||||||
|
3. Save a file with "C-x C-s"
|
||||||
|
4. Accidentally pressed a different command and you have no idea what you're
|
||||||
|
looking at? "C-g" will probably get you out of it.
|
||||||
|
5. "C-x u" to undo your typing
|
||||||
|
6. "C-space" to select a region and "C-g" to stop selecting it
|
||||||
|
7. With a region selected, cut it with "C-w" (this is also known as "killing")
|
||||||
|
8. Paste with "C-y" (this is also known as "yanking")
|
||||||
|
9. Window/buffer keybindings described above
|
||||||
|
10. Movement keys
|
||||||
|
11. Searching for commands
|
||||||
|
+ "C-h a" to find the keybindings for a command, or to search for a command
|
||||||
|
+ "C-h k" to find the name of a function tied to a keybinding
|
||||||
|
** What is ELisp?
|
||||||
|
Elisp is a dialect of Lisp specifically written for Emacs. It makes it super
|
||||||
|
easy to configure Emacs if you know just a little bit of Lisp. Lovers of Erik's
|
||||||
|
scheme talk will feel right at home with ELisp! (everything is defined in terms
|
||||||
|
of elisp functions, even moving the cursor and entering text)
|
||||||
|
|
||||||
|
In fact, let's take a look at an example.
|
||||||
|
Here I will split this window into three sections:
|
||||||
|
#+BEGIN_SRC emacs-lisp :results silent
|
||||||
|
(split-window-right)
|
||||||
|
(split-window-below)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
To cycle through these windows, I press "C-x C-o".
|
||||||
|
As you can see, I cycle through in the order they were created.
|
||||||
|
|
||||||
|
* However, what if I wanted to go back a window?
|
||||||
|
- Emacs doesn't provide a keybinding for this by default, so let's make
|
||||||
|
it in Elisp ourselves!
|
||||||
|
#+BEGIN_SRC emacs-lisp :results silent
|
||||||
(defun go-back-window ()
|
(defun go-back-window ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(other-window -1))
|
(other-window -1))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
+ Now if we want to bind this function to a key we can!
|
- Let's add a key binding for this!
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp :results silent
|
||||||
(global-set-key (kbd "C-c u") 'go-back-window)
|
(global-set-key (kbd "C-c u") 'go-back-window)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
* Why is Emacs better than Vim?
|
||||||
|
** Org mode
|
||||||
|
Org mode is notorious for taking over programmer's lives. It's motto is
|
||||||
|
even "your life, in plain text". You can create calendars, make Latex
|
||||||
|
documents, make websites and blog posts with your own CSS, export to
|
||||||
|
Open Office formats, really anything you're creative enough to figure
|
||||||
|
out.
|
||||||
|
** Amazing package support
|
||||||
|
Yeah yeah, vim has packages too... but they're not as cool as Emacs :)
|
||||||
|
|
||||||
|
The emacs community is full of useful packages that are super easy to
|
||||||
|
install
|
||||||
|
*** MELPA
|
||||||
|
This resource makes it even easier to install user packages
|
||||||
|
*** SLIME
|
||||||
|
Get into a great Lisp interactive session!
|
||||||
|
*** Magit
|
||||||
|
Great for git interaction!
|
||||||
|
*** Company-mode
|
||||||
|
For completion
|
||||||
|
*** Undo-tree
|
||||||
|
For undoing your work
|
||||||
|
*** LSP-mode
|
||||||
|
For running language servers
|
||||||
|
|
||||||
|
* First steps in going forward with Emacs
|
||||||
|
** Are you a vim user converting from the dark side?
|
||||||
|
Check out [[https://github.com/hlissner/doom-emacs][Doom Emacs]] to get started on your journey!
|
||||||
|
** Want to learn ELisp?
|
||||||
|
Check out "Writing GNU Emacs Extensions". It's a really good O'Reilly book
|
||||||
|
that you can access for free through USU.
|
||||||
|
** Just want to get started with Emacs?
|
||||||
|
Dive right into emacs by installing it with whatever package manager you use.
|
||||||
|
Read the guide that is accessible on the default emacs start page! It will
|
||||||
|
teach you the basics. From there, just scrounge around the internet for
|
||||||
|
resources. There are plenty.
|
||||||
|
If you need a recommendation, you can start [[https://www.emacswiki.org/emacs/EmacsNewbie][at the emacs wiki.]]
|
||||||
|
* The compromise
|
||||||
|
** Can't decide which is better (it's emacs)? Good news! You don't have to!
|
||||||
|
Let's take a look at the "evil-mode" package. This is pretty much vim
|
||||||
|
emulation within emacs. It is the best vim emulator ever; whatever vim
|
||||||
|
can do, Evil Mode can do it too.
|
||||||
|
BIN
images/real_programmers.png
Normal file
BIN
images/real_programmers.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 82 KiB |
Loading…
Reference in New Issue
Block a user