When you use one of Emacs’ help commands, another window will open with the documentation. You can use C-M-v
and C-M-V
to scroll the other window down and up respectively to read the help, without having to switch to that window.
Month: November 2016
Cancel all timers calling some function
This is a bit of a niche post but I recently found I had accidentally started a bunch of duplicate timers all running the same function. I hadn’t recorded the timer objects for them so couldn’t use cancel-timer
to kill them. After a bit of searching I discovered the function cancel-function-timers
which will cancel all timers that call a particular function.
Not something you’ll be using every day, but might be useful one day!
A persistent scratch buffer
The *scratch*
buffer is useful for dumping temporary bits of text, or trying out bits of lisp code. By default the contents are not saved, but it can be handy to have the scratch buffer saved and restored when you start a new Emacs session. This is easy with the persistent-scratch package, just add the following to your emacs config file:
;; persistent-scratch (use-package persistent-scratch :config (persistent-scratch-setup-default))
Add the system clipboard to the Emacs kill-ring
This post was originally titled “Prevent Emacs wiping the system clipboard”, which was a rubbish description of what this tip actually covers, so I renamed it! Apologies if you see it twice in your RSS reader.
I wrote previously about adding mouse selections in Emacs to the system clipboard, and here is another tip to integrate the system clipboard more nicely with Emacs. This comes from the fantastic Emacs operating system set of configuration files, which are full of gems like this (thanks to Irreal for pointing me to EOS).
By default, if you copy something to the system clipboard (e.g. some text in firefox) and then copy or kill some text in Emacs, then the text from firefox is lost. If you set the option below in your emacs config file then copying or killing text in Emacs will add the system clipboard text to the kill-ring so that you can find it when you cycle through your clipboard history in Emacs.
;; Save whatever’s in the current (system) clipboard before ;; replacing it with the Emacs’ text. ;; https://github.com/dakrone/eos/blob/master/eos.org (setq save-interprogram-paste-before-kill t)