1
0
dox/docs/md/emacs.md
2019-02-01 18:11:05 -08:00

339 lines
12 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(TAB to open bullets)
emacs org mode
==============
README
------
The purpose of this guide is to provide a minimalist onboarding for the
use or emacs org mode specifically for anarchy planet projex and dox.
There are three basic things that are useful about org mode:
1. It is PLAINTEXT ALL THE WAY BABY!
2. bullets are collapsible which makes it really easy to organize shit
and move it around collapsible items rule!
3. TODO items have a lot of functionality (e.g. agenda)
The longer-term goal is to convert ap/projex pads to org mode. see
*org-pandoc* for more info.
### emacs keyboard shortcuts
Written as, e.g., C-x C-f, which means CTRL-c CTRL-f (in succession) M-x
means META-x. the META key is (usually) ALT
<https://orgmode.org/orgcard.pdf> is a decent cheatsheet!
### Headings
Place a \* in front of some text: you've got a heading! Place \*\* in
front of some text: you've got a sub-heading! Headings are COLLAPSIBLE:
with cursor over a heading, hit TAB Headings can be moved around easily
- M-&lt;enter&gt; to add new heading
- M-&lt;left&gt; or M-&lt;right&gt; to promote / demote heading
### TODOs
Make a heading followed by the word TODO: you've got a todo item!
1. DONE demo emacs org mode
2. DONE enable line wrap as default
3. TODO re-write projex in org mode style
projex~demo~.org is the test run of this.
- C-c C-t to cycle through todo-done
- You can add more options by adding \#+TODO: TODO ONHOLD | DONE
to the top of the page (requires restart)
### advanced
1. links
- link structure: \[ \[link\]\[desc\] \] (but without the spaces)
- [file](test.org) C-c C-o to open at point this creates a split
buffer. C-x o to switch between split buffers, C-x 1 to return
the buffer to a single one.
2. agenda mode
<https://orgmode.org/worg/org-tutorials/orgtutorial_dto.html> is a
good tut.
notes
-----
### useful things overview
So there are two basic things that are useful about org mode:
1. bullets are collapsible which makes it really easy to organize shit
and move it around collapsible items rule!
2. TODO items have a lot of functionality
The goal is to take projex~demo~.org (another file in this directory)
and format it into org mode. The **reason** is that then we can export
it using pandoc with clean html (which we can add a loittle styling etc)
.. . once we have a format established, we can loosely require people to
add to pads in that format so that chhanges can be git pushed and
incorportated into the html. You can see an example of what the raw html
looks like here: <https://irc.anarchyplanet.org/dox/org.html>
(I think it's a good strategy to hit enter like this when we're done
typing :) )
### Switching between emacs 'buffers' (where different documents are open in the same emacs instance)
- to open projex~demo~.org: C-x C-f and then start typing proj and
then TAB (for autocomplete)
- use C-x &lt;left&gt; and use C-x &lt;right&gt; to switch
between buffers.
### making bullets
So, I guess my first question is about how I make the bullets?
1. like this
1. this is a sub-level
Ok I'll give that a shot
So to "attach" the bullet to the text under it, do I just add
asterisks to the text?
like this:
2. Bullet
This is the text under it!
Damn that's east's easy :)
yeah! and, you can do it with all kinds of list items, and it's also
especially useful when you have long passages of text that you can
just hide by pressing TAB.
Perfect :) So, I might try to just "bullet" this conversation. So I
think what I did there makes sense in terms of how I organized that?
YEAH! One more thing:
to make new bullets you can do ALT-enter (ALT is known as M ,
so M-&lt;enter&gt;)
3. bullet1
4. bullet 3
5. bullet 2
6. bullet 4
and then, to change the order, you can use M-&lt;up&gt; and
M-&lt;down&gt; ... to promote you can use M-&lt;left&gt; and
M-&lt;right&gt; (but this gets more complicated when you have
sub-trees, so we'll worry about that layter beucause that's what I'm
having problems with re; my keybindings)
Note for noobs: You have to have the cursor under the bullet tomove
your text, not the text itself.
Edit this guide: <https://irc.anarchyplanet.org/pad/p/dox-emacs>
### code syntax highlighting and evaluation
emacs provides support for lots of languages and you can start an
interpreter and run code with C-c C-c (evaluate buffer)
You can also do code blocks and tangle / weave for literate programming.
My friend always used indent region and it was impressingly fast
### org-pandoc
The **reason** to use org-mode is to provide a minimal amount of
functionality for organizing documents in plaintext that then can be
exported using pandoc with clean html (which we can add a little styling
etc) .. . once we have a format established, we can loosely require
people to add to pads in that format so that chhanges can be git pushed
and incorportated into the html. You can see an example of what the raw
html looks like here: <https://irc.anarchyplanet.org/dox/org.html>
### using org mode for IRC
how can i restart and save session? (keep buffers)
there's M-x revert-buffer or you can turn auto-revert-mode on so it will
reload every time the file changes. I've never used the second... rarely
the first, I always just close :P so i don't need to save it? it
members? no, you would have to save it. I always just do C-x C-c (closes
all buffers) and save them all. I blieve if you try to revert-buffer it
will prompt you to save. Do i do this after restarting or before? C-c
C-s saves all buffers, C-c C-c exits.
M-x package-install circe &lt;enter&gt; M-x circe &lt;enter&gt; Can i
set a socks proxy? I am not sure... I don't understand all that v. well.
last year i read an article/list post how outdated emacs' networking is
and RMS agreed. i think the thread went viral ..
could be!
<https://stackoverflow.com/questions/19699294/make-emacs-access-to-https-over-socks-proxy>
I was just gonna paste this :P
how do i get into config mode?
do you mean the customize emacs thing?
to set socks-noproxy or socks-server. the config file ..
the config file is at \~/.emacs you can also change \~/.emacs.d/init.el
Thanks, i changed my mind and prefer to keep my sanity!
re: tor: we should use it for w3m tho, yah?
sure, always. :) does emacs mind if we take aways some sycalls from it?
essential keys
==============
C-x 1 to return buffer to 1 window C-g to cancel a command C-h a to
search for commands tiling window: C-x \[1..3\] C-k cut C-y paste show
only headlines: navigate to first heading and do C-c C-k *emacs goodies*
[marking](http://oremacs.com/worf/README.html)
execute scripts / commands
==========================
<https://www.gnu.org/software/emacs/manual/html_node/emacs/Shell.html>
install packages
================
[list
packages](https://www.gnu.org/software/emacs/manual/html_node/emacs/Packages.html#Packages)
M-x list-packages C-h P (describe-package [install
package](https://www.gnu.org/software/emacs/manual/html_node/emacs/Package-Installation.html#Package-Installation)
M-x package-refresh-contents M-x package-install
emax & git
==========
<https://www.emacswiki.org/emacs/Git> &gt; Emacs comes with a generic
version control front end called VersionControl or VC. It supports Git
and many other version control system (vcs). This is a good choice if
you use other vcs besides Git or have no desire to use features unique
to Git. C-x v = vc-diff -- diff with other revisions
<https://www.emacswiki.org/emacs/VersionControl#VC>
Magit
-----
an Emacs mode for Git
[intro](https://masteringemacs.org/article/introduction-magit-emacs-mode-git)
### Installation
[install with
melpa](https://magit.vc/manual/magit/Installing-from-Melpa.html#Installing-from-Melpa)
M-x package-refresh-contents M-x package-install RET magit RET
1. debian stable (stretch)
requires emacs-25 fro debian testing
([buster](https://www.debian.org/releases/testing/)). To install it
needs to upgrade libc (core system library) which could break
packages. (Looked through [open emacs
bugs](https://bugs.debian.org/cgi-bin/pkgreport.cgi?dist=unstable;package=emacs)
and couldn't find anything grave.) Easiert is to build it from
source (see below)
### Usage
[cheatsheet](https://github.com/magit/magit/wiki/Cheatsheet)
[manual](https://magit.vc/manual/magit/) Start: M-x magit-status Quit: q
Help: ?
1. Staging and Unstaging Items
&gt; The key take away is that you can stage “items” not just the
whole file, but the hunks in a diff, for selective staging. The
killer feature here is how it displays this information, using its
“levels” system. Magit lets you expand and collapse staged and
unstaged files with TAB. For more granular control, you can use M-1
through to M-4 for all the files; and 1 to 4 for the selected
one. &gt; Level 1 hides everything in a category (say, “staged”
files); Level 2 expands to show just the filenames in a category
(this is the default); Level 3 will show the git hunk headers; and
Level 4 will show all the diff hunks. I use Levels 2 and 4 the most,
but if youre using TAB Magit will pretty much “do what you
want.” &gt; n and p will move between the next and previous section
(such as a hunk); M-n and M-p move between sibling sections, such as
between each file in level 4, or between each section (like staged
or unstaged). You can use + and - to enlarge or shrink each hunk and
0 to reset to the default. You can also type H to refine the hunk
for additional diff highlighting. Pressing RET will go to the file
where the change is made. It works on both hunks and files. &gt; To
stage or unstage you can type s or u to stage/unstage the item &gt;
If you use the region to select a portion of a hunk and then press
stage/unstage then Magit will automatically stage or unstage just
that selected region! Thats extremely useful for fine-grained
control when a diff hunk itself is not good enough. k discard hunks
and files (revert to HEAD) and delete untracked files from your
filesystem
2. Commiting
c commit menu You can extend (e) the current commit HEAD is pointing
to You can amend (a) the commit message You can reword (r) it, if
you dont like the commit message and you can both fixup (f) and
squash (s) against the current commit. If you have previously
markewd a commit with . this commit will be used instead. &gt; if
you forgot to commit some stuff that belongs to the commit you just
did use extend. If you want to amend the commit message as well,
use amend.
3. Log menu
j l l short log l h git reflog . will mark the commit for use with
commands like commit fixup and commit squash (c f and c s) x will
reset your head to the selected commit v will revert the commit d
will diff between the selected commit and your working tree a will
apply the selected commits changes to to your working tree A will
cherry pick the commit on top of your working tree E will
interactively rebase from HEAD to the selected commit. Very useful
if you want to rewrite history C-w will copy the commit hash to the
kill ring SPC will show the full commit message &gt; the mark
command will persist even if you close the log window. Its a
powerful tool but its easy to forget youve marked something. &gt;
If you navigate up/down the log with M-n and M-p magit will
automatically show the commit in a separate window.
IDEA How to turn IDEA into a recognized keyword?
================================================
\^\^\^ like this; also it can be done globally, that's a choice to be
made.
Install from source
===================
[download](https://mirrors.kernel.org/gnu/emacs/) wget
<https://mirrors.kernel.org/gnu/emacs/emacs-26.1.tar.xz>{,.sig} gpg
--recv-key D405AA2C862C54F17EEE6BE0E8BCD7866AFCF978 gpg --verify
emacs-26.1.tar.xz.sig Primary key fingerprint: 28D3 BED8 51FD F3AB 57FE
F93C 2335 87A4 7C20 7910 Subkey fingerprint: D405 AA2C 862C 54F1 7EEE
6BE0 E8BC D786 6AFC F978 tar xf emacs-26.1.tar.xz cd emacs-26.1/ \#
version may differ ofc ./autogen.sh ./configure --with-jpeg=no
--with-gif=no --with-tiff=no --with-gnutls=no
make