If like me you are constantly bouncing about between different places within a file, or even between multiple buffers then you should save a lot of time by using Registers.
Registers are a handy little tool that enable you to save a snippet of information for the length of your session. This snippet of information can be either text, numbers, rectangles and even window configurations.
For the benefit of this tip, however, we’ll be saving a position within the register. It is so simple, it is actually quite silly.
When you are at a position you want to save, simply enter:
C-x r <space> q
This will save your current location into the register “q”. You can replace “q” with any single character. For some reason I always use “q”, “w”, “e”, “r” etc. but you can use whatever you want.
To remember this command, you simply need to think about saving a space in a register called q.
Jumping back to the position saved in the register is just as simple
C-x r j q
You are jumping to register q
Once you have the hang of it, it’s pretty effortless.
As my aversion to all things rodent orientated increases and my use of Emacs grows so too does my use of org-mode.
Org-Mode probably doesn’t need any introduction. It can be used for pretty much any sort of organising you require, from sketching out blog posts (this article was drafted in Org-Mode before being published to Wordpress) to a full productivity and GTD suite.
The Emacs tip this week isn’t about highlighting all the useful features Org-Mode has to offer, but instead it is more of a “How-to-Learn” rather than a “How-To”.
In my daily Emacs activities I open a lot of files. However, during the week I am normally opening the same files as I’m generally working on the same stuff. Emacs’s Recent Files (recentf) feature generates a list of my recently used files and allows me to display that list so I can quickly open any of them.
To enable recentf mode, add the following into your Emacs init file (which you are version controlling right?)
If you use Tramp a lot you may want to disable the auto-cleanup command for Recentf. This is simply because every now an then, if enabled, the auto-cleanup feature scans a list of your recent files, and tries to stat them to see if they should remain in the list. Obviously, if it tries to stat any remote files this may cause your system to temporarily hang.
;; recentf stuff(require 'recentf)(setq recentf-auto-cleanup 'never);; disable before we start recentf!(recentf-mode 1)(setq recentf-max-menu-items 25)(global-set-key "\C-x\ \C-r" 'recentf-open-files)
Now use Emacs for a bit to generate a list of your recently used files. Next time you open Emacs, simply hit C-x C-r and you’ll be greeted with a list of your recently used files.
This first tip is something that I’m seeing more and more people do, especially with the excellent Emacs Starter Kit aiming to get Emacs newbies up and running quickly:
Version control your emacs.d directory.
This technique is especially useful if you have a number of development machines that you work from (desktop, laptop, remote server). This is the reason why I started to version control my .emacs.d directory. Whilst my configuration is still very basic (for now) I find it invaluable.
Whilst it is useful to version control your configuration file, a happy side effect of the increasing prevalence of services like GitHub is that you can see other Emacs users’ setups. It is great to look at these, borrow some ideas and lean some new techniques. After some Googling, I’ve quickly compiled the list below from GitHub, which is by no means exhaustive:
As regular readers of my poor, infrequently updated blog may know my editor of choice is the wondrously magnificent Emacs. One of the reasons I like Emacs is because there is so much more to learn. I can easily imagine that one could spend every day for a whole year learning a new technique, mode or snippet within Emacs and still not come close to learning all there is to know about it.
Sadly, I’m not dedicated enough to learn a new tip every day.
However, I am going to try and learn one a week. My aim is to pick up a new Emacs top tip, use it for a week and post about it here on my blog. This should hopefully increase my knowledge of Emacs and server as a repository of this information.
So, tune in every Monday for my Emacs Tip of the Week!
For those that can’t wait, there are loads of great places for all things Emacs out there. Check out:
The past few months I have spent most of my time head down, working on a number of projects. In work, I spend most my time in Emacs, which has been my editor of choice for just over a year. Over the past year, my knowledge of Emacs, and my associated productivity is improving all the time. However, the Emacs universe is so vast there is no possible way to know everything, or every little command (or even every “big” command).
My tactic recently has been to try and learn one new useful tip each day, whether it is switching to ibuffer instead of the normal buffer mode, or trying to use M-^ (delete-indentation) more. Whilst trawling through the Emacs Wiki or a list of command references may be a good way to find some useful stuff, a better way is to let someone else do all the hard work for you!
So here are three blogs that I have found great for general Emacs related tips and tricks:
As I’ve now been using Emacs for quite a long time, I have picked up a few tips along the way. One thing I’ve been doing more and more is using the shell within Emacs. (For more details see here and here.)
Some of my most used shell commands are using SVN, such as add, revert etc. However, I couldn’t find anywhere to just add/revert the current file I am working on. Fortunately there is Stack Overflow! Someone with a very similar issue to me has had a couple of good answers, which I have “borrowed” and now adding files to my SVN repository is really easy.