↓ Skip to Content Start of content

Exploring my Emacs packages - company-mode

What is company-mode?

Project homepage : https://github.com/company-mode/company-mode

company-mode adds auto-completion to the current buffer in Emacs. It's similar to ac-mode and supports some more modern features, such as lsp (language server protocol).

It works well out of the box, but with some additional packages and per-language configuration it can really shine.

Example packages for web development

Adds completion for web-mode, and can be used with HTML and HTM templates, although I prefer using emmet-mode for creating elements.
JavaScript completion. Requires flow to be installed.
Auto-completion for Ruby which uses a Ruby REPL to get code information. Requires the file (or project in Rails) to be reloaded when code changes.
Adds auto-completion for common PHP extensions, as well as user defined classes and functions. It also supports annotations and type hints. It requires a special tags file to be created in order to get the most out of it, and this file should be regenerated when code changes.

Using lsp


lsp is a common protocol for language servers. lsp-mode is a package that allows Emacs to communicate with lsp servers, and it supports a bunch of different languages.

Using lsp requires some extra setup as each language has its own server implementation which may need to be installed and configured. However, once it's up and running it's a fairly smooth experience.

company-lsp integrates with lsp-mode and allows company-mode to use information from running lsp servers.

Although it takes a while to configure, using lsp removes the need to regenerate tag files or reload projects when code changes.

This post is part of the "Exploring my Emacs packages" series.

Groundhog Day Resolutions - September 2019

August's GHD goals went much better than July. I'm still way behind on my 2019 goals, but I made a slight dent which has helped with motivation.

August's Primary Goals

1. Keep on running

I picked up a couple of injuries playing soccer (including a nice scar) so I decided to play it safe a few times. I still managed to run more miles than any previous month, and I tried a couple of trail runs that were way, way steeper than I expected.

2. Use a schedule every week

I've been planning my days since setting this goal. I haven't always stuck to it, but so far it's kept me fairly focused.

3. Complete at least one secondary goal

I migrated this site to a new server, set up automated builds and added functionality for scheduling posts. Everything is configured via ansible which is something I wanted to learn.

4. Write a chapter of my book

Although I didn't write as much as I wanted, I did manage to complete a chapter. I'll probably edit it again in the future, but for now I'm happy with some progress.

August's Secondary Goals

1. Read another book

I read "The Life-Changing Magic of Tidying Up" by Marie Kondo. It's quite a breezy read considering it's about tidying up, and a lot of it reminded me of the GTD process, such as performing an initial inbox sweep and making sure things have a specific place.

2. Plan a diet and recovery plan for the half marathon

The short version: Eat carbs for a few days before the race. Avoid fat and fiber the night before to reduce the risk of stomach ache.

Primary Goals for September

1. Run a half marathon

My half marathon is scheduled for the first week of October so it fits into September's goals.

To say I'm nervous is an understatement.

2. Complete two secondary goals

There are a couple of projects I've been working on that just need a little push to be complete.

3. Write two chapters of my book

At this point the only thing that is going to get this book done is work. I have my chapter plan and notes, now it's just time to make it readable.

Secondary Goals for September

1. Write at least 3 blog posts

I've slipped out of the habit of writing regularly as the year has gone on. I'd like to get back in a rhythm and publish at least 3 posts in September.

Thoughts on August

One lesson I really tried to take from "The Motivation Hacker" was the use of success spirals. The idea is to complete lots of very small actions to build motivation.

Rather than trying to get all of my goals done in the first week (or the last week like I normally do) I tried to break them into small steps that I could do every day. This strategy worked really well for writing (which is normally something I dread).

Scheduling tasks also helped enormously, although I wasn't as disciplined with times as I should have been.

I'm still way behind on my goals, but I'm hoping once The Run is out of the way I'll have more time (and energy) to focus on them.

Groundhog Day Resolutions - August 2019

July was probably the most disappointing month I've had doing GHD so far. Nothing really went as planned and I was nowhere near as productive as I wanted to be. Outside of running I didn't make a dent on any of my primary or secondary goals for the year. 2019 is nearly 2/3rds complete and I'm way, way behind where I wanted to be.

July's Primary Goals

1. Run a total of 35 miles

I fell a couple of miles short on this, but I'm still counting it as a success considering I ran more miles in July than any month ever. I also swam and did some light yoga once a week.

Running went ok, but the large increase in miles has left me tired and aching. Recovery has also been a challenge and it takes me nearly an hour to get from "run finished" to showered and ready to carry on with the day.

2. Finish the "Exploring my Emacs packages" series

I wrote three rough drafts but didn't edit or publish them.

3. Finish one other goal on my "Other Goals" list

I didn't release anything.

July's Secondary Goals

1. Read another book

I read "The Motivation Hacker" by Nick Winter.

2. Add a page for tracking my bodyweight workouts

I came up with a couple of designs for the page but didn't actually build it.

Primary Goals for August

1. Keep on running

Miles are going to increase for August as run day gets closer. My average pace is currently too slow for a 2:30 finish, but I'm hoping it will improve as things cool down.

2. Use a schedule every week

I've used weekly schedules before with mixed results. I'd like to see if using one for August improves how much I get done.

3. Complete at least one secondary goal

This didn't work out so well for July, but I need to try again if I want to make any kind of impact on my other goals list.

4. Write a chapter of my book

At this point I'm pretty comfortable with what I should be writing about. I need to actually get it done.

Secondary Goals for August

1. Read another book

I started reading "The Life-Changing Magic of Tidying Up" and I'd like to finish it this month.

2. Plan a diet and recovery plan for the half marathon

I'd like to have the following figured out before I run:

  1. What to eat in the days leading up to the event
  2. What to eat pre and post run
  3. What to drink before/during/after

I've tried a couple of sports drinks in the last few weeks, but some of them contain more sugar than a can of soda which seems a bit too much to me. A lot of people have recommended coconut water - I'm not keen on the taste, but I think it could be used as a base instead of water and sugar.

Thoughts on July

Half-marathon training has been challenging. Below is a chart of my miles-per-week for all of 2019.


It's been quite a jump from my regular schedule. I have to keep reminding myself that a year ago I couldn't even run 1/4 of a mile without stopping and now I'm running 4 miles in one go. It's not a huge distance, but it's a start.

Outside of actual running I've been trying to find information on recovery, either via stretches, diet or supplements. It takes time to find decent information, and there are a lot of "is said to improve" articles that don't really help.

One thing that has helped is wearing compression socks post-run (after showering). I bought a pair of 20-30mmHg socks which has reduced post-run aches in my calf muscles. It feels a bit like a gentle massage when walking around.

I read "The Motivation Hacker" which has some interesting techniques for increasing motivation. Some ideas I already know and use, but there were a few new ones. I'd like to read it again and start applying some of the ideas.

My GTD setup has also been on a bit of a wobble the last few weeks. A lot of tasks I've been working on haven't been added to the system and my next actions list has been somewhat ignored.

Even worse, I've gone back to old habits of scribbling urgent and tasks on note cards. I'm hoping that implementing short daily reviews and scheduling tasks will improve this. I might have to set up a Beeminder goal for creating schedules until it's all working.

Because of this I've built up a bit of a backlog. Some of the tasks on my next actions list have been there for over a month. I think part of the problem is that they're too big and should be broken into smaller tasks as part of a project.

Getting Things Done - Six months on

Getting back into "Getting Things Done" (GTD) is one of my secondary goals for 2019. So far I've managed to keep up my weekly reviews and keep my system (mostly) organized.

The last time I really used GTD successfully was during university. I wrote a retrospective in July of 2006 but things have changed a lot since then. I graduated, moved to the US and started working as a freelance software engineer.

A lot of what I wrote then still holds true, but there have been major changes to my daily routine. There are no fixed class schedules, no exams to revise for and no commutes to and from campus. Thankfully GTD can adapt to changes like these.

What's working

The two minute rule

During processing, any task that will take less than two minutes should be done there and then.

This is still one of my favourite things from GTD. It stops small tasks from ending up on a list and either being done too late or not at all.

It's particularly useful during weekly reviews. I usually complete half a dozen tasks during the review process alone. These tasks can range from "Email X about Project Y" to "File away letters from the bank".

Weekly reviews

Beeminder has been my friend here. I have a goal set up to make sure I complete a review every week, and I haven't derailed since I started it. I can't pretend I look forward to weekly reviews, but I'm not putting them off the way I used to.

The weekly review tool on FacileThings has also been a huge time saver. I had my own checklist for weekly reviews, but sometimes I wouldn't give items the time they really needed. The FacileThings review shows everything I need, when I need it.

Projects (kind of)

I've been taking the GTD approach to projects - i.e. if a task requires more than one action to complete, it's a project. It takes some getting used to, but it keeps project actions fairly manageable. Even though projects can end up being quite small, it's satisfying to get them organized and completed.

At the moment I have 48 active projects and have completed 24. I'm still working on getting some external projects into my system.

Getting stuff done

The biggest success by far is that I'm actually getting stuff done. There have been a number of small small projects I've wanted to complete for ages and just haven't got around to. Having them in a system where I can see and review them has stopped them from getting lost in my daily routine.

I've completed over 250 tasks since starting with FacileThings in April, which includes a vacation in June.

What's not working


I use tags to limit my tasks by area (e.g. work, personal and free-software), but location-based contexts (e.g. office or store) aren't really worth it for me. The only real time I use contexts is a whiteboard on the door for "things I need from the grocery store".


I really like how GTD simplifies projects to a "next action" level, but some things just don't fit into that kind of system.

For example:

I'm currently working on a large software project that is going to take over a year to complete. It needs to be split into milestones and tasks. Some tasks will depend on others and parts may need to be delegated as time goes on.

A pure GTD approach doesn't really cover everything that I need to manage.

Huge next actions list

Sometimes it feels like I just have an enormous list of stuff to get done and it can be a little overwhelming.

I think an additional "is this really something I want to do?" question during processing would be helpful here. It can always go on the "someday/maybe" list if I'm not 100% sure.

Getting stuck

It's easy for some items to get stuck. There are a couple of items on my list that have been there for over a month, but they're not really important or urgent enough to work on Right Now.

I'd like to find a better way to balance getting new stuff done vs keeping the list short.

Still not 100% "in"

There are still some external tasks I'm not tracking using my system. Some work tasks aren't tracked, and I have a couple of large projects that aren't on my projects list.



So far the best solution I've found is to treat the project plan as a project in itself and use a separate methodology to create it. It can then be put into my GTD system as reference material and stored on the list of projects. Tasks can be taken from the plan and put onto my next actions list if/when appropriate.

It's still not perfect, but I think it overcomes the issue with trying to fit all projects into the GTD mold.

Work and personal tasks

My work tasks come in via email, a ticketing system, instant messages and occasionally phone calls. But some of it is still slipping through the cracks.

I think because tasks that come in need to be converted before they go into my system, and I don't really like spending time doing that when work needs doing. This is especially true of tasks that are urgent.

I need to tighten this process up, so I need to get into the habit of treating my email inbox as an actual inbox and processing it accordingly.

Daily reviews

Daily reviews might be needed to really keep me on track. I'm not planning on anything too serious, probably just a quick process of my inbox and a check of my next actions to make sure nothing important got forgotten.


I'd like to start planning out my day in advance and schedule time to work on specific projects. I'd also like to schedule time each day to work on cleaning up smaller tasks on my next actions list.

Groundhog Day Resolutions - July 2019

I was on vacation for most of June, so I only set a single goal.

June's Primary Goal

1. Relax

The actual traveling part wasn't great, but the vacation was good.

Primary goals for July

I'm still easing back into my routine so I'm trying to keep things simple this month. However, the year is 50% is done and I need to start making good progress with goals if I want to get things done.

1. Run a total of 35 miles

The training for my half marathon starts on July 15th. I should be running a total of 35.5 miles between July 7th and August 8th according to the training plan.

Cross-training will be bodyweight exercises and swimming.

2. Finish the "Exploring my Emacs packages" series

I have three posts left to write.

3. Finish one other goal on my "Other Goals" list

It's hard to plan which one to work on without knowing how much energy and free time I'll have during the month. Most of them are at various stages of "done-ness", but I really, really don't want to finish the year with a bunch of half-finished projects on my plate.

Secondary goals for July

1. Read another book

I read "Hacking Life" on vacation and quite enjoyed it. As with my other goals, I need to make time to actually do them instead of just thinking about them.

2. Add a page for tracking my bodyweight workouts

I already record these using org-mode (when I actually do them), but I'd like a way to view progress over time.