Thoughts on Perl and Emacs, technology and writing

Enabling Your Users

For many of the tasks I have to do day to day, I have a default tool. If I want to edit some text I’ll use Emacs; if I want to write an application slowly that runs quickly I’ll use C++; if I want to write an application quickly that runs slowly I’ll use Perl. And if I have to look after a hundred different configuration files for a hundred different users I’ll write a web interface so they can maintain the files themselves.

Ultimately, with any web app I write, anything complex is entered through a <textarea>. However, I often think that a sufficiently restricted emacs would give the users a nicer experience. If it was for me, I would just add the necessary functionality to dired. However, for a non-IT person, the dired interface is not reasonable.

So, a little experiment – can I make something emacs-based that a non-IT person would be happy to use?

File Selector Design Outline

What I envisage is a file selector that remembers the files that a user has opened before (fairly standard selector functionality right?). When a file is selected it provides a simplified view of the configuration file to the user. When they select save, it will save the full complex configuration file in all its glory.

I can also enforce some policies such as every save will check-in to source code control. Then if my editor doesn’t work correctly or the user does something they didn’t want to do, I can retrieve an earlier, working version.

File Selector Implementation

I had better give the user some defaults to click on to start with. Fortunately the configuration files are stored in two main areas: /data/sales and /data/admin.

I keep the file selector buffer read-only and therefore need to set inhibit-read-only to t whenever I write to it. I can then get all the files and directories within the current directory using directory-files-and-attributes.

I skip all the files beginning with a period. A string is a type of array so I can just compare against the first character using aref. I suspect it is more efficient than using a regex (surely it must be?) but I haven’t measured.

Okay that is probably enough for one post. Obviously I have a fair amount of functionality left to implement. What do you guys think? Am I crazy to even consider using emacs over <textarea>? Let me know in the comments.

When I read it, I was really curious about what it did/looked like. That’s probably why it stuck in my noggin and your post jogged it loose. I imagine an interface similar to customize but even that must be off putting (to me at least).

BTW, really like your blog. I’ve been using emacs for about 1.5 years now and have learned quite a bit from your posts. Keep up the great work and thanks for sharing.

I’ve been thinking lately about putting together an emacs ‘distro’ (actually a lightweight Linux distro with Emacs + packages + usable customizations) for use by writers, and I’d love to see a decent dired-substitute file selector. Even though the combination I’m thinking of is still only suitable for people with some willingness to plow through new interfaces, and learn keymappings, and post cheatsheets near their desks, you do want to cut the complexity where you can, especially if it only comes at the expense of functionality which you don’t need at that location in the interface.

Thanks for the positive comment on the blog. It really is nice to hear that people find it useful.

@commonman – I put together a distro for my parents to use, mainly so they could appreciate org-mode. Re: the alternative dired I’ve had some other work to do recently but I’m hoping to get back to it shortly. If you’ve any suggestions I’d be interested to hear them.