Emacs on Android, because why not?

For those of you familiar with a terminal, whether it be from back in the MS-DOS days, because you need to manage some headless machines for a job, or you just like to toy around with Linux, I would hope you’ve heard of Emacs.  For those of you who don’t (or are die-hard vi fans), it’s a pretty impressive piece of software which some say can almost replace your entire operating system due to its already large feature set and extensibility.  Personally the feature I find the most useful (and also confusing to learn) is the “kill-ring” which allows you to keep multiple text snippets for pasting at once (in Emacs this is called “”).  However, great as Emacs is, it can’t really compete with today’s tasks of rich-text email, Instagram photos, Google Drive and other cloud storage, etc.  But just like there will always be a place for the command line, I’m sure Emacs will continue to live on as an older, but still effective application for some specific purposes.  So if that’s the case, then why not install it on your phone?  While the use may be questionable, the difficulty level is low, and the fun & educational factors should outweigh it.

So here’s what we’ll need:

TerminalIDE is an app which I’ve always had some mixed feelings about.  It hasn’t seen development in awhile, but luckily works well for our purposes right now.  What sets it apart from some other terminal applications is that the Unix applications have all been recompiled to work locally within the app, thus it works even on phones that are not rooted.  The flip side of this is that the app is quite large in size (so if you’re limited on space you might have to pass this one by) and the native applications within TerminalIDE are not able to do DNS resolution, so any network activity must use IP addresses (or be preceded by a call to jping to get the IP).

For anyone clever enough to notice that there’s an Emacs app for Android, I’m sure you’ll also notice how ineffective/buggy it is, thus the reason for this post.

The data files are the same ones used by the Emacs Android app, but independent of the less-than-useful terminal emulator.  By joining the two, we can create a functional instance of Emacs to fool around with.

First, start by installing TerminalIDE and placing the Emacs files in an accessible location on your device.  If you know where the home folder within TerminalIDE is, and you can place them there then that’s great, otherwise, the Downloads folder works just as well (yes if you wanted you could do this whole process from just your phone).

Issue the following commands to decompress the Emacs binary and make it executable:

unlzma emacs.lzma
chmod 755 emacs

Next we need to create the directory for Emacs to work in.  For our purposes (and in being consistent with Android applications) this will be an ’emacs’ directory placed within ‘sdcard’:

mkdir sdcard/emacs

Now we must move the other downloaded files to this new directory and extract them:

mv etc.tlzma sdcard/emacs/etc.tar.lzma
mv lisp.tlzma sdcard/emacs/lisp.tar.lzma
cd sdcard/emacs
unlzma etc.tar.lzma
unlzma lisp.tar.lzma
tar xvf etc.tar
tar xvf lisp.tar
rm etc.tar
rm lisp.tar

At this point Emacs should be ready to go, this can be checked by going back to your home directory and executing it:

cd
./emacs

And that’s it!  If Emacs fails to load, it could be because there seems to be a minimum screen width.  On my Moto X (2014) loading in landscape worked (with about 4 usable lines in the editor) but portrait would not work until reducing the text size in the TerminalIDE options.

Usability?

So here’s the question: is it really usable?  Well you definitely need a full-featured keyboard.  This can be accomplished in at least three ways:

  • Install a third-party keyboard such as Hacker’s Keyboard
  • Attach an external keyboard via USB OTG or Bluetooth
  • Use telnet or ssh to access it from another machine with a full keyboard (details available within the TerminalIDE app)

After fiddling with the first option, I can say that it does indeed work, but I wouldn’t call it efficient or particularly enjoyable (except for when I played a decent game of Emacs Tetris!).  I think this option would be nice to have in your back pocket (or front pocket, or purse, wherever you keep your device) just in case you absolutely need to use Emacs at the drop of a hat.  The second option is a bit more enticing, it allows you to type like you normally would, leaving only the tiny screen to stand in your way of ultimate Emacs exploitation.  For this I wonder if utilizing screen mirroring via Miracast or Chromecast would make for a decent setup (somewhat reminds me of the “Could companies issue only one device and have it do everything?” question raised by the Ubuntu Phone).  As far as the last option goes, at that point I don’t see the use.  If you have another machine with a full-keyboard then why aren’t you just using Emacs on that (I’m sure someone playing devil’s advocate could come up with something…)?

So is it usable? Yes, but there’s a reason GUIs were invented and screens became touch-enabled, and I think that for most of us, embracing these things will allow for a much more pleasant experience.  However, there will always be a place for terminals and robust applications to run on them, and here’s just one example of how you can keep one within arm’s reach, for whatever you dream up.

Screenshot_2014-11-11-18-29-41Productivity at its finest

UPDATE: With the release of Android 5.0 “Lollipop” the need for Android executables to be Position Independent (PIE) is enforced. As such, the method outlined above will no longer work. In addition, a bug in TerminalIDE causes it to crash when the Google Keyboard is toggled, this behavior is not exhibited using Hackers keyboard or the built in TerminalIDE keyboard, however there doesn’t seem to be any active development on either projects at this time.

Special thanks to David Megginson for the instructions that inspired this post, and for all the people who have contributed to the development and use of GNU Emacs.

The Moto X (2014) – My New Phone of Choice

It’s an exciting time right now! After a long, long two years I’m finally eligible for a phone upgrade. While in the process of determining a worthy successor to my Droid 4, I realized just how much smartphones, and my taste in them, had changed in just two years.

October 2012: The yearn for customization

When I could finally afford to add a data package to my cell phone plan, I was beyond excited. A few years earlier, I had begun my foray into pocket computing with a second generation iPod touch, which was then upgraded to a 4th generation to take advantage of some new stuff from Apple. After having jailbroken both of them to get some more desirable features, and with Android getting a better reputation thanks to their release of gingerbread, I realized that Android was really where my heart was.  I was able to snag an original Droid off of ebay for the cost of a couple lunches (an order of magnitude cheaper than my iPods) and after installing Cyanogenmod on it, was satisfied with the performance but completely taken by everything else. The OS was nowhere near as polished as iOS at the time, but it was also much more open to my tweaks and ad hoc enhancements.

After that there was really no looking back. The college student with social media accounts and a borderline obsession with Google searches was ecstatic that he was going to be killing so much time on lines answering emails and scrolling through feeds, and the for-the-heck-of-it tinkerer and tweaker knew that there would be no shortage of opportunity to explore and refine my experience with the open ecosystem – Android it was. The external keyboard and removable microSD card were what sealed the deal for me at the time, both features I planned to use extensively in the coming months.

Motorola Droid 4My 2012 phone of choice.

September 2014: The yearn for cutting edge

Fast forward two years, and my phone has been through quite the overhaul. The quest for features and improvements has led me to adopt Cyanogenmod 11 in the absence of updates from Motorola/Verizon, and the immense amounts of customization available for Android has allowed my homescreen to adapt to my needs. But the biggest issue as of late?  My phone is old, and it’s slow. The custom ROM breathed new life into the device, but regardless, it’s showing its age.  Luckily, it’s a quality product and I’ve been able to continue to use it, however at times it has become more of a chore than an experience.  I’ll often go retrieve my tablet (or laptop if it’s on) to perform some task because I know there’s a chance my phone will give me some sluggish response time, even if it’s in another room (dramatic I know…although more beneficial from a health standpoint until Google Fit and Apple HealthKit get up to speed).

So since I’m about to head into another two-year commitment, I wanted to be sure that my new device, which is sure to be amazing at the start, would still be amazing a couple years down the road, or at least not almost obsolete. In addition, my personal use cases for my phone has altered a bit, for example, the slide-out keyboard is hardly utilized anymore (save those times I really need to SSH into a machine while on the go), my microSD card consists mainly of music and is accessed less and less frequently (the “shuffle-all” setting is just an invitation to hit next for an hour), and I wanted to increase my screen size (studies have shown this is a common trend, as clearly evidenced from Apple’s latest  phone behemoth).  These trends line up with the trends of the smartphone market in general, allowing my personal tastes and a company’s flagship phone to line up more easily.  Why flagship? Because those are the devices that get all the attention (attention = updates), and the ones (in my experience) that user’s are continually swearing by even years after their release.

So really my choice became clear once I knew that I wanted a flagship Android smartphone with no shortage of customizations: the Moto X. Coming from a Motorola phone, I can appreciate the almost-stock experience it provides, and the sheer level of options afforded through Moto-Maker are sure to provide me a unique phone from start to finish. The added voice and notification features, combined with some trend-setting inclusions such as Trusted Bluetooth devices are all just cherries on top.

Will it actually withstand the test of time?  We won’t know just yet, but from past experience, I think the 2nd generation Moto X has a lot going for it (maybe enough for me to be more verbose about it once it’s in hand), and it will sure be a fun ride along the way!

Moto X (2nd Gen.)

My new phone of choice!

Hello World – Chris Weber Edition

Well I suppose the title says it all.  I’d like to think that there’s something profound I can say here to kick off this site in some dramatic fashion, but I’m not sure there is.  I think part of this stems from my indecisiveness as to what I want this site to be: political commentary? Not really my strong suit. Technological advancements? I’m a pretty busy student (maybe we’ll get to this more later), I don’t think we’d have many updates, and even fewer remarkable ones. A collection of hilarious GIFs and cat videos? In addition to being partial to puppies, I think there are plenty of sites doing a much better job of that.  What I do know, is Stony Brook has given me some web space, and like all other resources you get in college, why not use it?

So here we are, a site with some potential, but somewhat lost in terms of a direction, not so unlike its author.  I’m an alumni of Stony Brook University and also a current Graduate Student there as well, both in Computer Science.  Originally from the Hudson Valley Area of New York, college is both far enough away and not too far at the same time.  As a Computer Scientist I’ve been able to study a subject that I find both challenging and rewarding for a number of years, however my interests lie on a far broader spectrum than just behind a keyboard.  These interests have been able to occupy and employ myself and my time for quite some time now, and one of my fears of getting older is that my job, family, personal life, interests, and everything else that goes into a life may fall out of whack while I’m not looking.  Luckily I’ve been fortunate enough to be surrounded by some amazing people, and all told, it’s been a great time.

So what is this site? I’m not sure anyone knows (but I know of some snarky texts I’ll be getting because of it haha), but I’m excited to find out, and if anyone has some insight they’d like to share, feel free to let me know in the comments section…I think I have a comments section at least…

The guy behind the keyboard.

The guy behind the keyboard.