Let’s just use Emacs presents a compelling case for Emacs as a writer’s tool — not a geek’s tool — a writer’s tool.
In the process he takes us through his history and frustration with Emacs to the modern day where tools like Org-Mode, elements of a modern UI, and darkroom-mode, plus (in my experience and in his) a more active development community, have made Emacs into a great writing environment.
Working on free software projects isn’t easy. Just because you’re giving away your work for anyone to use doesn’t mean that anyone is going to take it, no questions asked. Take my MediaWiki work as an example. I am being paid for the work, but it is freely licensed and I’m learning about the standards of quality that the community has formed around the code. Frankly, before becoming involved in such a serious PHP-based project, I didn’t have a very high opinion of PHP. Even Rasmus (creator of PHP) doesn’t seem to live in a pure php world and, as a result, thinks of systems where PHP is merely the web frontend instead of almost the entire system. So working with others who have been neck-deep in PHP for years, building one of the top-10 sites on the net entirely in PHP, and gaining intimate familiarity with the quirks of PHP, has been a wonderful experience. But MediaWiki isn’t the only free software project I’m involved in. I also contribute to Emacs occasionally. (For those not so familar with Emacs vs Vi, let’s just say this is like the social situation between Republicans and the Democrats or the Roman Catholics and Southern Baptists: You live next door to them, but you know they’re going to hell.) And it is my most recent commits to Emacs that have gained me noteriety. Yesterday, I was catching up on some blog reading (Planet Emacs, thankyouverymuch) and came across a nifty use of loccur.el. But it used defadvice instead of a hook (and hooks are better — no this is different than emacs vs vi, I swear). I looked at the code and thought, “Hey, I can make a tiny little contribution to Emacs here!” So I made a couple of small changes. Little did I know what a problem that was going to be. Óscar Fuentes used my commit message as an example of how not to write a commit message. This was not the first time I’ve been so honored. Three weeks ago, I made a mistake committing to the bzr repository for emacs and was again used as an example for the Emacs-devel community of how not to make a commit. There are two reasons I’m such a stellar example for the other Emacs developers. First, I’ve been using bzr for a couple of years while working on the iHRIS Suite. This experience (2 years more than most Emacs developers) naturally made me think I had things under control. So I didn’t bother reading over Bzr for Emacs Devs. Second, Emacs recently switched its source-control system (after much debate and some effort on speed the bzr side) from the ancient, worn, CVS to bzr. So people are still adapting their work flow. I just happened to make some commits that were particularly egregious and ended up being great examples of what people should avoid. So, yes, Free Software is a great thing, but that doesn’t mean the developers don’t take it seriously. And being reprimanded in public isn’t the most pleasent experience. But at least I can blog about it!
Emacs23 includes default keybindings for scaling fonts up or down:
C-x C-+ — scale the current buffer’s face/font up C-x C-+ — scale the current buffer’s face/font down
This is good as far as it goes, but I’d really like something a little easier. So I’ve added the following to my .emacs file:
(global-set-key [(control mouse-4)] (lambda () (interactive) (text-scale-increase 1))) (global-set-key [(control mouse-5)] (lambda () (interactive) (text-scale-decrease 1)))
Now, if I hold down the control key and scroll the mouse wheel, the font will get larger or smaller. Some other applications (e.g. Firefox) use “Control +” and “Control -” to do something similar along with “Control 0″ to return to the default size. You could set these keybindings in Emacs without losing too much (unless you’re used to C-- and C-0 as prefixes, in which case, you still have C-M-- and C-M-0):
(global-set-key [(control ?+)] (lambda () (interactive) (text-scale-increase 1))) (global-set-key [(control ?-)] (lambda () (interactive) (text-scale-decrease 1))) (global-set-key [(control ?0)] (lambda () (interactive) (text-scale-increase 0)))
None of this will permanently affect the size of the font, so for the next buffer you open or the next time you start Emacs, you’ll have the same size font you started with. If you want to change the default font size, use M-x customize-face RET default RET instead.
I’ve gotten some feedback on the mediawiki mode I’ve been working on. So I’m releasing a new version. Some highlights:
- Now works with HTTP Auth (I’ll write a seperate post on how Emacs handles credentials for HTTP Authentication).
- Introduced tab-completion of sites. If you have multiple MW sites set up that you work on, this makes switching between sites super-easy.
- Started working on making it more XEmacs compatible. As far as I can tell, XEmacs lacks the Unicode support that GNU Emacs has. The released version of XEmacs also lacks the POSIX character classes for regular expressions and ships with a very out-dated version of url.el. All these combine to make it very difficult. But do-able. I’m surprised there are still XEmacs users, but if it doesn’t cause me too much pain, I’ll help them out.
- Misc other clean up (including making the url.el wrappers much better).
Since emacs on Linux can use DBus calls now, I wrote a short notify.el as a demonstration to myself and to save myself from forking notify-send (because, uh, forking is bad) whenever someone mentions my nick in IRC. There is a delay built into it so that your “friends” on IRC can’t DDOS you with notifications. Oh, the really nifty thing about this is the function keywords-to-properties. elisp keywords (:example) allow you to fake named parameters in function calls. This is done a couple of different places in Emacs, the most visible being defcustom. But there isn’t any universal way that I could find to parse the keyword-value pairs into something usable. So I cribbed from defcustom and wrote something that I hope will be useful to others.
I seem to be spending an inordinate amount of time editting MediaWiki wikis, so I’ve had some time to put together a better MediaWiki mode for emacs. In the process, I wrote some code that many people (myself included) seem to think Emacs needs. HTTP POSTing in native elisp is too hard right now, so a http-post-simple.el was written. The original mediawiki.el required this library, but it wasn’t included. I refactored the dependency away and now I have some form parsing functions in elisp that I can contribute back to the Emacs core. Anyway, if you use Emacs and edit MediaWiki pages, check out mediawiki.el and let me know what you think. I’m especially interested in bug reports from anyone.
One of the never-ending subjects of Free Software is “Where are the Women?” While I see it as mostly a non-problem — that is, there are some obvious problems that need to be fixed with time, but no one is going to rectify them right now — I’m doing what I can to encourage my daughters and son in the field. In the meantime, The Decline of Women in Computer Science from 1940-1982 has some fascinating anecdotes:
Computing was unique, however, in the sense that the fledgling profession was still in its infancy and had no strong pre-war gender socialization. This fact must have helped the women in that the returning men lacked programming expertise, and clearly had no expectation of “returning” to a programming job. The lack of structure in the industry was also a boon to women programmers who wanted to continue working even after they became pregnant and had children. Most notably, “Computations, Inc., of Harvard, Massachusetts (outside Route 128), formed in 1958 by Elsie Shutt and several other programmer-mothers who worked part-time and largely at home on problems contracted out to them by their former employers, such as Minneapolis-Honeywell and Raytheon”. These women, widely known as the “Pregnant Programmers” were mentioned by speaker Richard H. Bolt at the M.I.T Symposium on American Women in Science and Engineering in 1964. Bolt, who was a lecturer in Political Science at M.I.T and also a former Associate Director of the National Science Foundation (NSF) from 1960-1963, also mentioned the following:
“I asked one of the unmarried women, a computer programmer in industry, if she thought a woman’s activities as a mother and homemaker would interfere with her opportunities in a career. ‘One good thing about programming,’ she said, ‘is that you can work part time.’”
I was thoroughly exhausted this morning and slept 2 hours past the time I was supposed to meet the others for breakfast. Ouch! I finished setting up the developer laptop and used bzr to download the source code for iHRIS Manage to the laptop. I’ll customize the software for the Ministry of Health using the laptop and then, if we’re able to hire a Rwandan to do in-country development, they’ll have everything ready to go with php-mode set up in emacs and (of course) a link to my PPA so they can get updates easily. Up till now, I’ve been pretty scared of the customizations they needed since I have to finish them up in the next few days. Once Vanessa started sending them to me, I was really relieved. Most of it does look pretty simple. “Add a field here, change a label there.” Speaking of in-country developers, I was pleasantly surprised to find out that dcm and Vanessa were able to find someone with LAMP experience. One can always hope. In the afternoon I met with the head of IT at the Ministry of Health and installed Ubuntu on the server for them. He doesn’t know much about Linux but seemed willing to learn. I’d like to have someone here that I can talk to if we have problems, so I’ve been trying to at least get him or one of his underlings comfortable with Linux. We walked back up the hill to the hotel and dcm soon crashed. I guess it was his turn to be worn out Overall, I’m really pleased with the way things are turning out. I came into this really scared, but I’m getting more confidence by the day. One thing I would like to see is more support for Rwanda in Linux and especially Ubuntu. When I’m setting up Ubuntu, “Rwanda” is not a choice for either the French or English language. And, despite lots of work being done on Linux translations to Kinyarwanda, where “Ubuntu” is actually a word native to the Language, I can’t choose that language as the default in the installer. This affects other areas of the installer, too. When it comes time to pick a timezone, I can’t. I have to tell the installer I’m in South Africa, which means that za.archive.ubuntu.com is picked for the Ubuntu mirror — a far better choice for the network connections I’ve used is still one of the U.S.-based mirrors. (I’m not the only one to think Linux distributions should be more aware of Rwanda, either.) Finally, it would be great if RwandaTel or some other organization took an interest in promoting Linux in Rwanda. They could set up a kernel.org mirror so that I could get my Linux fix faster!
(You may want to see my first post on my visit to Rwanda if you missed it.) Right now, I’m sitting in the Sentenary House, the home of the Capacity Project in Rwanda, upgrading a System 76 laptop with Ubuntu Gutsy. I hope to prepare this laptop for a Rwandan developer for the iHRIS project I’ve been working on. Of course, that’ll mean Emacs. I hope to spread the Church of Emacs to Rwanda. In my last post I kind of left you hanging on the Mille Colline. Yes, I had a coke there but I should tell you how disappointed I was that the movie showed a completely different building then the actual Hotel. I’m sure they had their reasons (they always do) but I really do expect movies to give me an accurate portrayal of places I’m extremely unlikely to visit. Just in case, you know, I visit. Also, we had a brush with fame. The hotel I’m staying in (the Kigali Serena) is where Tony Blair was staying. For a brief moment, we saw President Kagame rush in and then quickly back out. I had no time to request an autograph. Mostly because I didn’t recognize him. Dramatic difference between Kigali and the US: the number of gates and guards. It seems that every major intersection has one or two men in uniform carrying AK-47s. Almost every building and home has at least a guard and, unless it is right on the road, a fenced in courtyard with razor wire or shards of glass atop the walls. I remember similar gates and glass-topped walls in Haïti, but the guards are an unsettling addition. Vanessa told me that, in part, the practice started as a way to employ men who have been fighting most of their lives and hadn’t developed any marketable skills. Fair enough. Another thing about Rwanda is the number of people walking along the road and the street vendors walking about. Some (evidently) sell SIM cards or minutes for your phone. This is in addition to a wireless shop on every other corner. I was amused by the portable phones they carry that look similar to a desk phone, but without the desk. Finally, though I seemed to be on a normal sleep schedule after my first night here, I couldn’t sleep at all last night. Seriously, I saw the sun rise. I’m sure part of it was that I was up hacking away till 4 in the morning (“just one more thing”) but, still, right now I’m tired. Thank God Rwanda’s primary export is coffee. I need it now!
(Hello, Planet Ubuntu Users! I’m looking for a second MOTU on my php-xdebug package as well as someone to revu my libapache-test-perl package. Any takers?) Emacs CVS now includes XFT (i.e. smooth fonts) in the main branch, so I’m discontinuing my old emacs-xft-snapshot build. Still, the other emacs-snapshot package is targeted to Debian and I’m running Ubuntu Gutsy. So I’ve uploaded a snapshot build to my PPA on Launchpad. One thing that I included is flymake support for PHP. Carl asked me earlier today if I knew how to get the compilation mode in Emacs to work with PHP’s lint function to find highlight problems. I said flymake would be better, but didn’t know how to do that right off, either. After a bit of twiddling, I figured it out and, as a bonus, got compilation mode figured out, too. If you want to enable flymake for PHP-mode (yes, I have a Debian package for that, too) in a version of Emacs you already have installed, add the following code to your .emacs file:
;; Flymake PHP Extension (require 'flymake) (unless (fboundp 'flymake-php-init) (defun flymake-php-init () (let* ((temp-file (flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace)) (local-file (file-relative-name temp-file (file-name-directory buffer-file-name)))) (list "php" (list "-f" local-file "-l"))))) (let ((php-ext-re "\\.php?\\'") (php-error-re "\\(?:Parse\\|Fatal\\) error: \\(.*\\) in \\(.*\\) on line \\([0-9]+\\)")) (unless (assoc php-ext-re flymake-allowed-file-name-masks) (add-to-list 'flymake-allowed-file-name-masks (list php-ext-re 'flymake-php-init 'flymake-simple-cleanup 'flymake-get-real-file-name)) (add-to-list 'compilation-error-regexp-alist-alist (list 'compilation-php php-error-re 2 3 nil nil)) (add-to-list 'compilation-error-regexp-alist 'compilation-php) (add-to-list 'flymake-err-line-patterns (list php-error-re 2 3 nil 1))))
Now, whether you’re using the emacs you started with or the latest emacs-snapshot, you need to tell emacs to use flymake on PHP files. Add:
(add-hook 'php-mode-hook (lambda () (flymake-mode t)))
to your .emacs file and you’re good to go.