By default Emacs has some pretty annoying audio notifications for
certain events (e.g. trying to move past the end of a buffer). You’ve
got two options to get rid of them. Option 1 is to replace them with visual
notifications (the Emacs frame will flash):
This doesn’t work well on OS X and is just as annoying (if not even
more), so I’d suggest going with option 2 instead - disable those
(setq ring-bell-function 'ignore)
At last - some peace and quiet!
One of the things I hate the most while programming, is having to
manually adjust the indentation of some code, after I’ve moved or
renamed something in it. While it’s pretty easy to do such re-indent
operations using commands like
crux-with-region-or-buffer (you remember,
crux, right?), there’s an even more
efficient way to tackle the issue at hand. Enter
aggressive-indent-mode’s name is a bit of a misnomer - it should
probably have been named
auto-indent-mode, as this is what it
does. When you edit your code it will adjust the indentation
automatically. It’s easier to show this than to explain it.
Here’s one example showing
agressive-indent-mode enabled in
And another example using
Provided you’ve installed the mode, enabling it for particular major modes is a piece of cake:
(add-hook 'emacs-lisp-mode-hook #'aggressive-indent-mode)
(add-hook 'clojure-mode-hook #'aggressive-indent-mode)
(add-hook 'ruby-mode-hook #'aggressive-indent-mode)
If you want to enable it in all major modes you can do this as well:
Note that this is not going to work well with modes like
haml-mode where the proper indentation can’t be reliably
global-aggressive-indent-mode is enabled it will
not affect major modes listed in
For more info - head over to the
If you ever need to show the keybinding for a particular command to
the users of your package (e.g. you’re adding some tips
functionality), you should avoid resisting the urge to write something like
(message "Press <C-c p p> to switch between projects.")
Why is this a bad idea? Because you might change the keybinding of the
command in question (e.g.
projectile-switch-project, but you might
forget to update messages like this. Is there a better way?
substitute-command-keys to the rescue:
(message (substitute-command-keys "Press <\\[projectile-switch-project]> to switch between projects"))
This will produce exactly the same message as before and you’re
guaranteed the keybinding will always be in sync with the command.
P.S. If you want to check interactively the keybinding of some command use
C-h f (
an example -
C-h f RET projectile-switch-project RET will produce this:
projectile-switch-project is an interactive compiled Lisp function.
It is bound to C-c p p, s-p p, <menu-bar> <tools> <Projectile> <Switch
(projectile-switch-project &optional ARG1)
You can also check which command is bound to some key with
By default in Emacs the
Tab key does only indentation. If some major
mode provides completion of some form, you normally have to trigger it
M-Tab. In most window managers, however, this keybinding is used to
switch between open windows, which makes it a bit hard to use out of the box.
There’s a simple trick to augment the default
Tab behavior. Just put
this in your Emacs config:
(setq tab-always-indent 'complete)
Now, when you press
Tab one time it will indent and if you press it
again you’ll get completion candidates. If the indentation at point is
already correct you’ll get the completion candidates right away. As an
added bonus - you don’t really need
Simple and neat! One really has to wonder why this isn’t the default
For the longest time Prelude
included the function
prelude-goto-symbol (bound to
It basically allowed you to jump to any definition in the current source file
imenu behind the curtains.
Recently I’ve found an even better option - the package
imenu-anywhere. It works in a pretty similar
manner but gives you the ability to jump to any definition in any currently open buffer.
That’s quite handy and it greatly reduces the need to use something like
As an added bonus -
imenu-anywhere features helm integration.
This is a very handy package and I encourage you to give it a go!
P.S. Prelude users should simply upgrade to the latest version of
Prelude (it already uses it).