Tass Iliopoulos

Ubuntu, Dvorak and Problems With Meta Key

Today, on my new Ubuntu installation, I noticed while using Emacs that the ALT (meta) key was doing funny things. When set to the Dvorak keyboard layout, holding the ALT key would effectively switch to QWERTY. Holding Control would not have this effect.

This only happened in Emacs, presumably because it takes keyboard input at a lower level than other applications. For example, ALT+F in any other application would still bring down the File menu.

So, it was like OSX’s Dvorak-Qwerty ⌘ mode, but for the ALT key and only for Emacs.

The fix?

First, I removed the QWERTY layout - the issue went away.

After closing the layout settings and re-opening, I could then re-add the English (US) layout as the second layout.

Holding ALT will now type the correct key when in Dvorak mode. However, the QWERTY layout is now switching to Dvorak on ALT.

The real fix?

I don’t know, yet.

TypeScript and Visual Studio

Lately I’ve made some changes in how I organise TypeScript files in my web projects.

For any code I’ve written, I don’t commit the generated .js files into source control - just the .ts files. I have a couple of tools around to finish the job:

  • When I hit ‘save’ on a ts file, the excellent Web Essentials will create a .js file. Great for on-the-fly changes.
  • When I hit ‘build’, a pre-build step runs and compiles all .ts files.
  • When I commit the .ts to source control, the build server will generate all the .js files, ready to deploy.

There are benefits to keeping the .js files out of source control

There are no js files to be left out-of-date

It’s easy to forget to commit both the ts and matching js files.

There are less conflicts to deal with

A conflict will almost always appear in both the ts and js files. Why double the amount of work resolving them?

Version mismatches

Anyone running an old or modified version of the typescript compiler won’t break things for anyone else.

There are also pitfalls

It’s not obvious if someone is running an old TS version

This could result in code working on some developers machines but not others. Will something like this be possible in the future?

1
2
3
#if tsversion < 0_8_0_1
 don't build!
#endif

Web Essentials for Visual Studio is overly persistent

Every resulting js file is added to your project. This is great when you’re committing your js files together with your project. When you don’t want these committed, it’s quite annoying.

Update: There is now an option in Web Essentials which controls whether the generated files are added to the project. Success!

This is the best way to work by far

The pitfalls are, overall, very minor and I’m quite happy with this project structure.