1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
It is hard to put into words how much Emacs encroaches on my life.
There are [[https://en.wikiquote.org/wiki/Emacs][very poetic quotes]] out there, e.g.
#+attr_html: :cite https://en.wikiquote.org/wiki/Emacs
#+begin_quote
Emacs outshines all other editing software in approximately the same
way that the noonday sun does the stars. It is not just bigger and
brighter; it simply makes everything else vanish.
#+end_quote
— Neal Stephenson, {{{cite(In the Beginning… was the Command Line)}}}
Perhaps if I put enough miscellaneous trivia into this file, it will
eventually grow into something that can justify this level of
hyperbole.
* Conventions
** =RET= vs =C-j=
:PROPERTIES:
:CUSTOM_ID: convention/electric-indent
:END:
By default, Emacs turns on ~electric-indent-mode~, which, among other
effects, sets down a convention that works across most modes:
- =RET= is the "DWIM" binding that opens a new line at the "correct"
indentation level;
- =C-j= is the simple binding that literally just inserts a newline.
My (completely post-hoc) mnemonics for this is that =RET= is either
- =C-m=: I rarely want to insert an actual /carriage return/; if I do
though, I can quote-insert it with =C-q C-m=, like other control
characters,
- the =<retrun>= function key: it stands to reason that a "function
key" would do something "smart".
While =C-j= is "literally byte 10, aka the newline character", i.e. a
character that I will indeed write as-is in my files.
(Pay no mind to ~lisp-interaction-mode~ aka =*scratch*= breaking this
convention by binding =C-j= to ~eval-print-last-sexp~; we wouldn't want
things to become /too/ consistent now would we 😀)
* Third-party packages
** Magit
A bit unfair to lump Magit in "third-parties" given its popularity,
and its fruitful secret life as "tarsius's personal Elisp mad lab".
Some may call it "NIH syndrom", but I personally thank Jonas for
pushing the boundaries of what Emacs can do, from UX (transient,
magit-section) to DevEx (cond-let, llama).
*** blame
- =b= drills down recursively into the current chunk's history. I
used to
1. blame,
2. land on an "uninteresting" commit (cleanup, refactoring),
3. =SPC= to get the revision buffer,
4. scroll to the relevant hunk,
5. =RET= on the corresponding removed line,
6. go to 1,
until I finally found the "interesting" commit; turns out =b=
automates all of this.
*** diff buffers
- =RET= vs =C-j=: I like that they follow what I think of as [[#convention/electric-indent]["the
electric-indent convention"]], i.e. "=RET= does something smart; =C-j=
stays dumb"
- =RET= visits DWIM read-only blobs:
- added or context line? current revision
- removed line? parent revision
- =C-j= visits the current worktree file
|