
Emacs Wizardry, one command at a time | run by @_wilfredh
Joined April 2009
- Tweets167
- Following5
- Followers3.9K
- Likes5
Fun fact about the minibuffer: you can click it when it's inactive! This opens the *Messages* buffer.
(Especially handy if you want to read messages that recently appeared in the minibuffer.)
Have you ever created a great keyboard macro, but wanted to add a few more keystrokes at the end?
`C-u F3` will run the keyboard macro, and start recording any additional keystrokes until you press F4!
gnu.org/software/emacs/manua…
default-indent-new-line: inserts a newline, but indents and adds a comment prefix!
Before:
// foo|
After:
// foo
// |
Super valuable for editing doc comments, and bound to M-j in the default config :)
Ⓔ Command of the Day retweeted
Uh this emacs region undo thing is kinda blowing my mind. I had no idea!
Do you have two buffers visible where you want to scroll both of them at once? scroll-all-mode allows you to move the same amount in every visible buffer!
Want to highlight a single piece of text ('region') persistently in Emacs? Secondary Selection is what you need! emacswiki.org/emacs/Secondar…
This highlights a region of text and persists regardless of point or active region.
M-x rot13-region
Applies ROT13 transformation to the selected text!
(I've only had cause to use this once, but I was delighted Emacs had it!)
10
Did you know that you can trigger actions inside Emacs from other applications?
org-mode allows you to define URLs like org-protocol://do-thing-in-emacs?key=value
orgmode.org/manual/Protocols…
Another tip for string-edit: you can combine it with other major modes!
For example, elisp-docstring-mode has custom highlighting for elisp docstrings: github.com/Fuco1/elisp-docst…
Command of the day: string-edit-at-point.
This is super handy for editing the contents of strings: you can write " or newlines without worrying about escapes!
M-x google-this, part of github.com/Malabarba/emacs-g…
Perfect for quickly search for information about APIs or errors that you can see inside Emacs!
Just select the text and run the command.
Pressing e in a *Backtrace* buffer (bound to debugger-eval-expression) will let you evaluate local variables in that stack frame! Super useful when debugging.
Made a typo liek tihs?
C-t (bound to transpose-chars) will switch the characters either side of point (the cursor)!
M-x github-clone
This awesome command will clone a github repo from any URL format you can imagine.
It can even automatically fork the repo for you, so you're all ready to send pull requests!
The package is at github.com/dgtized/github-cl… and available on MELPA.
Also in @magit_emacs 2.13, C-c M-g (bound to magit-file-popup) has gained several new commands!
I particularly like the ability to view next/previous blob, which lets you move between historical changes to a file!
Want to know all the commits that affected a function?
@magit_emacs as of version 2.13 provides M-x magit-log-trace-definition for this!
For any language that git log understands, it will show you all the relevant commits.
Want to run a raw git command inside of @magit_emacs?
! ! (which is magit-git-command-topdir) inside a magit buffer.
This is really useful if you have custom git aliases, or if you want to use globbing (e.g. 'git rm -r old-dir*').
toggle-debug-on-error and toggle-debug-on-quit are fantastic tools, but it's easy to leave them active by accident.
mode-line-debug-mode makes this state obvious!
It's a simple mode that adds ? to the mode line if either of these debug modes are active.
github.com/tarsius/mode-line…
















