Archive for November, 2008

Emacs — ispell — No word lists (Ubuntu)

November 16, 2008

In Ubuntu, if you get:

Error: No word lists can be found for the language “en_US”.

when trying to start ispell (e.g., M-x ispell-buffer) from Emacs, then you need to install the aspell-en package:

sudo apt-get install aspell-en

Emacs — Using rectangles

November 12, 2008

In Emacs, you can not only select by lines, but also by columns. If you select by columns, the selection is called a rectangle. You can use rectangles with the following shortcuts:

  • C-@ or C-Space — start selection (as usual)
  • M-x delete-rectangle or C-x r d — delete the rectangle delimited by the start selection and the current cursor position
  • M-x kill-rectangle or C-x r k — then you can use — M-x yank-rectangle or C-x r y
  • M-x clear-rectangle or C-x r c — replace the contents of the rectangle with spaces
  • M-x open-rectangle or C-x r o — insert spaces in the area and push the original contents to the right

C/C++ — Insert sequential values into container

November 7, 2008

To insert sequential values into a container, you could use the iota function available in ext/numeric header. For example:

#include <ext/numeric>
#include <vector>

std::vector<int> v(5);
__gnu_cxx::iota(v.begin(), v.end(), 0);

v will contain {0, 1, 2, 3, 4}.

For more information see sgi documentation