Zamansky: Travis-CI

Mike Zamansky has a new video up but it’s not one in his Using Emacs Series. Zamansky is doing a miniseries (probably 2 or 3 videos) on GitHub Classroom and how he uses GitHub in his teaching. His first video is on Travis-CI and how it fits in with his overall teaching workflow.

If you’re in CS education, you will definitely want to follow this series but even if you’re not, there’s still something to learn from the videos. For example, although I was vaguely aware of Travis-CI, I didn’t know how it worked or all the things you could do with it. Zamansky’s current video fills in that gap nicely and even though it’s unlikely that I’ll need to set up a teaching environment, it’s entirely possible that I might find having a continuous integration environment of the sort that Travis offers useful. As usual with Zamansky’s videos, there’s always something to learn.

The video is 18 minutes, 45 seconds so plan accordingly. I’m looking forward to the rest of series not only out of curiosity but also to see what other useful things I can learn.

Posted in General | Tagged | Leave a comment

Using ed

About a year and a half ago, I wrote, somewhat disparagingly, about the idea of using the ed editor for every day work. The problem is that ed is a line editor meant for use with teletype-like devices. Because it can’t use cursor addressing, editing happens on whole lines. Although a few intrepid souls claim to use it for day-to-day work, it really has only two uses today:

  • Emergency fixes. Because ed is small and lives in /bin, it’s available even if Unix/Linux has problems coming up and wasn’t able to mount /usr/bin, the home of full screen editors such as Vi(m) and Emacs. Many developers and system administrators learn ed for just such occasions.
  • Scripting. Most editors can do some sort of scripting but they aren’t really that good at it. Scripting has always been an important ed use case.

After writing the above post and another that looked at a scripting application of ed, I went back to not thinking about it. Then, I saw the coda to Brian Kernighan’s video about where the name “grep” came from. In it, Kernighan was asked what editor he uses today. He mostly uses either Vi or Sam but said that he occasionally fires up ed for a quick editing job or when he wants to script. For some reason that inspired me to take another look at ed.

I’d never bothered to actually learn ed but I knew enough about it from Vi—which is built on top of ed1—that I could use it in an emergency. There are only a handful of commands to learn (remember there are no cursor movements) so it was pretty easy to get up to speed. Almost all the action is in the line addressing, which, again, is almost the same as that in the Vi(m) ex commands.

I have a log file that I edit everyday—mostly just deleting certain lines that match a regexp—so I’ve taken to doing that in ed. That helps me remember the ed commands and various line addressing functions. Occasionally, I’ll do some other (really unnecessary) edits just for practice. The next time I have a boot emergency, I’ll be ready. Of course, I haven’t had to worry about that in some years but if the day ever comes…

If you’d like to come up to speed with ed (it probably takes less than an hour), here are some resources:

  1. The Gnu ed manual. It’s sort of like an extended man page and covers all the commands.
  2. Kernighan’s ed tutorial which covers just about everything you need to know about ed.
  3. Kernighan’s Advanced Editing on UNIX tutorial, which covers some of the more advanced ed features.

Realistically, you’ll probably never need to use it in anger but if you do learn it, you can tell everyone that you can use the standard Unix editor, and as Eric S Fraga says, familiarity with ed makes using sed scripts easy.

NOTE (Added after this was written but before it was published): Despite popular belief, ed is far from dead and is, in fact, still being actively maintained as a GNU project. Here’s the announcement of the release of GNU ed 1.15. It’s 2019 and the standard Unix editor just keeps on keeping on.

Footnotes:

1

Or actually ex, which is a slightly improved version of ed.

Posted in General | Tagged | Leave a comment

Glass Panel Keyboards

This post may seem Apple-centric but it’s not. Even though it’s Apple that is patenting this idea, it’s the technology itself that I find interesting and want to discuss.

According to AppleInsider, Apple has applied for a patent on replacing keyboards with a glass panel having raised key sections. Once can see why, after the keyboard disaster of the penultimate MacBook release, Apple would be interested in such an idea. It would certainly prevent crumbs and dust from jamming things up as well as making keyboard cleanup easier. It would, I suppose, even protect against the occasional coffee spill.

According to the article, the raised key sections and a small amount of give provide tactile feedback to the user, making it easier to touch type on the keyboard than it is with the virtual keyboards of the iPhone and iPad.

This seems attractive to me but I’m not convinced that it would provide a good “typing” experience. Of course, Apple patents all type of ideas but only actively develops a few of them so there’s no guarantee that such a keyboard will ever become a reality.

Many developers, myself included, prefer mechanical keys and a few us diehards still swear by the IBM Model M and its Unicomp progeny. It’s hard to imagine that cohort accepting a keyboard where the keys are not only not mechanical but don’t move at all. Still, I love a chance to tryout such a thing. What about you?

Posted in General | Tagged | Leave a comment

Howard Abrams’ GTD Workflow

Howard Abrams is rethinking his GTD workflow and has written a three part post that describes his evolving scheme. The first part is here; there are links to the next part in each post.

The basic idea is that every new task or idea is initially put, as an Org file subtree, into an inbox that he reviews everyday. Upon review, each item is moved to an intermediate destination that reflects its status. For example, items that can be acted on immediately are placed in his task file; items that are more complicated to complete are placed in a project file. Similarly, reference material is filed away in an appropriate file. The exact scheme is shown schematically in his second post. Finally, when a task is completed it is archived in his journal.

As you can see, there’s a lot of data moving involved with all this so Abrams has written several helper functions to easily move the Org subtrees among the various files that make up his taxonomy.

Not everyone is a GTD adherent, of course, but if you use Org-mode to track and schedule your tasks and ideas, Abrams’ post has a lot of good ideas that you may find useful. He’s made the code easy to understand and modify so you can directly use some of his helper functions if they fit in with your workflow.

As always with Abrams’ posts, there’s a lot of good ideas worth stealing in the post so you should definitely take a look.

Posted in General | Tagged , | Leave a comment

Zamansky 56: Dictionaries and Thesauri

Mike Zamansky has another video up in his Using Emacs Series. This time it’s about dictionary and thesaurus apps for Emacs. Like many of us—or, perhaps, most of us—Zamansky uses Emacs for almost every chore that involves text: he reads and writes his email with it, he reads his RSS feed with it, and he writes his blog with it. Up until now, he hasn’t integrated a dictionary app into his workflow. He usually just switches to his browser and looks up the word in one of the on-line dictionaries.

That, he says, is kind of lame so he wants to be able to look up words from Emacs. I’ve been doing that ever since abo-abo introduced his excellent define-word package. I use it multiple times a day either to check a definition or as a backup to flyspell, which on my machine takes a conservative view and often produces false positives. Its use is so integrated into my workflow that even when I’m not in Emacs, I’ll switch to it so I can look up a word. I get annoyed when I’m on my iPad or iPhone and have to use some other method of looking up a word.

Zamansky settled on the dictionary package. It’s a nice package and easy to use. It’s also more flexible than define-word because it can handle several dictionaries. You can even have a local dictionary server if you’re off-line a lot.

For his thesaurus, he looked at powerthesaurus and synosaurus. He settled on synosaurus while I’m using powerthesaurus. Either one seems a good choice. Synosaurus can use either a local thesaurus (Wordnet, which must be installed separately) or the on-line OpenThesaurus, which does not appear to support English synonyms.

I found this video particularly useful. In the first place, it reminded me about the try package, which is useful to easily experiment with packages before committing them to your configuration. Because Zamansky learned about powerthesaurus from Irreal, it’s a nice bit of what goes around comes around that I learned something about the package from his video. It turns out the powerthesaurus-lookup-word-dwim command is much more useful than the powerthesaurus-lookup-word command that I had been using.

Finally, no discussion of Emacs dictionaries could be complete without—again—mentioning Draft #4 and why you are probably using the wrong dictionary. If you do any type of creative writing you should definitely follow the above link and see what you’re missing. Pointers for installing the 1913 + 1828 Webster’s Revised Unabridged Dictionary and the necessary software is available here.

The video is just short of eleven and a half minutes so it should fit easily into a coffee break. If you don’t yet have a dictionary and thesaurus interface in Emacs you should definitely watch this video. Even if you do have apps installed, watch it anyway: you may, like me, learn something new.

Posted in General | Tagged | Leave a comment

The Emacs C API

As you probably know, Emacs now has a C API that allows you to write extensions in C or any language that provides C bindings. Via Wilfred Hughes we have a pointer to this excellent documentation on how to use the system.

The documentation is fairly long and detailed. There are examples of how to use some of the functions and how to initialize your module. There’s no point in going over everything in this post so I’ll just refer you to the documentation if you’re interested. Be aware, though, that this API does not mean you can now write your extensions in C and not have to know anything about Lisp. Emacs is a Lisp machine and you will still have to understand general Lisp ideas and how data is represented so that you can communicate with it from your C (or other language) module.

Posted in General | Tagged | Leave a comment

Freeing Space on Your Mac Development Machine

This post is nominally specific to Mac users but the same techniques, mutatis mutandis, could be used by developers on Linux and perhaps even Windows.

It’s a commonplace today that disk space is cheap and that we can operate—to a first approximation—as if we had infinite disk storage. The reality, of course, is a bit different. Our local disk space, while generous in comparison to just a few years ago, is anything but infinite and sooner or later we’re going to have to clean things up. That’s because crud—in the form of log files, old caches, and other such files—accumulate over time wasting space and making things slower.

There are, of course, programs to automate a lot of the cleansing but developers have special needs that most of those programs don’t know about. Gant Laborde has a nice post entitled How to free up space on your developer Mac that discusses some of the things developers can do to free up space on their Mac. As I said, most of his ideas translate to other Unix-like systems and perhaps—although I don’t know for sure—to Windows.

It’s surprising how many ways cruft can accumulate on your machine so it’s nice to see some techniques for getting rid of a bit of it. If you’re a developer, be sure to take a look at Laborde’s post even if you’re not a Mac user.

Posted in General | Tagged | Leave a comment

Having Org Notes Buffer Inherit Its Input Method

When it comes to eliminating workflow friction, few do it better than Matus Goljer (Fuco1). His latest post describes a fix for a problem that I didn’t even know existed: When Org pops up a log note buffer (after a change of task status, for example), the input method reverts to English. That’s fine if English is your native language and you’re shamelessly provincial like me. As I say, I didn’t even know it’s a problem. But English is not Goljer’s first language and he, of course, prefers to use an input method appropriate for his native tongue. The problem is, the log note buffer reverts the input to English.

As Goljer notes, that’s ironic given that the current maintainers are also not native English speakers. In any event, he put together a few lines of Elisp that solved the problem for him. As he says, he spent a total of about 2 minutes on it, far shorter than the time he spent searching for a solution in the manual.

If you also use a default input language other than English, be sure to take a look at Goljer’s post for an easy fix. If you are a native speaker, you might also want to check out his post just to see his code. I learned a couple of new Elisp functions that I didn’t know about so it was worth it for me.

Posted in General | Tagged | Leave a comment

Moving to Emacs

Continuing yesterday’s theme of moving to Emacs, let’s discuss some ways of easing the transition. Nikhil Soni has a nice post that describes how he got Emacs to provide the features he was used to from editors like VSCode, Atom, and Sublime.

In particular, he wanted Emacs to give him these functionalities:

  1. Duplicate current line
  2. Move a line up or down
  3. Multiple cursors
  4. Auto-completion
  5. Fuzzy search for file name
  6. Project tree view
  7. Go to function or class definitions
  8. Return to previous cursor position
  9. Find all function references
  10. Markdown preview

Most serious Emacs users already have solutions for these but Soni goes through them one-by-one and shows how he implemented them. Almost every item was implemented by loading a package or with a (very) few lines of Elisp. Soni shows the Elisp in his post but also provides a pointer to the file in his configuration that provides them.

It’s a nice post that demonstrates that there’s nothing—other than bling—keeping you from upgrading from VSCode, Atom, or Sublime. Or so I say. Some partisans of those other editors will doubtlessly strongly disagree. That’s alright. As I’ve said before, the choice of an editor is a personal, not a moral choice. Of course, if you want the best editor…

Posted in General | Tagged | Leave a comment

Why You Should Buy Into Emacs

Christoffer Stjernlöf over at Two Wrongs has a very well done post on Why You Should Buy Into the Emacs Platform. Posts on “Why I moved to Emacs” are common, of course, but Stjernlöf has written a comprehensive post that recognizes Emacs as more of an environment than just an editor.

He notes, for example, that you can edit code with any old editor but only Emacs can give you Magit. He says that Magit alone is reason enough to adopt Emacs but there are many other applications available with the Emacs platform. You can even write your own applications for Emacs if you like.

There’s no point in me listing all the Emacs features and packages that Stjernlöf admires; you should go read his post. Nonetheless, it’s worth noting that in keeping with his holistic view of Emacs, Stjernlöf lists many ELPA packages that he finds useful. Evaluating a piece of software by taking into consideration addons that third parties wrote my seem like cheating but it isn’t. Almost all of us have several packages installed to make our editing easier or to deal with tasks such as Email or RSS. It’s the packages that make Emacs an environment worth spending the time to explore and learn.

In any event, Stjernlöf’s post is interesting and worth a read.

Posted in General | Tagged | Leave a comment