Emacs copy and paste

Today I got sick of not being able to sanely copy and paste between Acrobat Reader and Emacs under Linux (Debian Etch + Gnome). The “automatic-copy” from selecting does not happen when in Acrobat, and the “Ctrl+V” version of paste doesn’t work in Emacs. This means it’s impossible to copy something from Acrobat and paste it in Emacs. My (pathetic) work-around is generally to paste into a draft email in Mozilla Thunderbird since it plays nicely with both types of copy-and-paste. Well, there’s a solution:

Add this to your .emacs:
(setq x-select-enable-clipboard t)

I take it back this doesn’t work consistently either. I hate computers.


Sed (seder’s) grab bag

Today I discovered a very handy collection of sed scripts. I can attest that remccoms3.sed does in fact remove comments from C / C++ (and assembly if you use C-style comments). I used it like this:

cat asm.S | ~/remcoms3.sed | grep -v "^\s*$" | wc -l

to get a count of the number of lines in an assembly program that are not comments or whitespace.

Solar battery chargers

I’m going on a long bike trip (multiple days + camping in between) and I want to charge my GPS device and cell phone using some kind of solar device. I started looking around and found quite a few:

  • Solio has a classic, hybrid, and magnesium edition.
  • Soldius only seems to offer the Soldius 1, but it does not include an integrated battery.
  • Megasol supposedly makes the Solar Energy Pocket Power (SEPP) but their website doesn’t support English.
  • 21st Century Goods has an entire category for solar products.

Libraries with Ocaml

I’ve been trying to learn a little more about Ocaml, since functional programming is so frequently marketed as solving a lot of today’s bad programming practices that lead to vulnerabilities and security problems.

I’ve been going through the Ocaml Tutorial but the instructions for building grtest1.ml were insufficient:

$ ocamlc grtest1.ml -o grtest1
Error while linking grtest1.cmo: Reference to undefined global `Graphics'

I needed to specify the name of the library I’m using:

$ ocamlc graphics.cma grtest1.ml -o grtest1

which on my Mac OS X system comes from /usr/local/lib/ocaml/.

Bulleted lists in text files with Emacs

I often use emacs to keep notes, etc. in plain text files. One
of the formats I frequently use is the equivalent of a bulleted
list. I like to use the “auto-fill-mode” (Meta-q) to format
things nicely. However, my “bullets” (often, hyphens) sometimes
get misinterpreted. One failure mode is where they get treated
like any other character and folded into the paragraph. Another
is that emacs recognizes them as a “prefix” for a paragraph,
applying a bullet to the front of every line, even if one
bulleted item is long enough to wrap onto multiple lines.

Now, I haven’t figured out how to specify which behavior I want
with a command, but I found an explanation of what’s happening here.
Essentially, the first bulleted item needs to be multi-line to
teach emacs that bulleted items can sometimes be multi-line.