Ben Simon has a post up on his blog describing how he set up a scheme development environment on his Galaxy S9 Android phone. It was also an especially timely post as I had been eyeing a Mac Quadra with a Symbolics Lisp Machine extension card on eBay. As if we needed another reminder just how powerful current phones have become!
Saw the announcement on on the GNU Emacs mailing list this morning. Much to my surprise, it’s also already available on homebrew. So my Mac is now sporting a new fetching version of Emacs as well :). I’ve been running the release candidate on several Linux machines already and was very happy with it, so upgrading my OS X install was pretty much a no brainer.
Here we go:
I’ve previously blogged about using Emacs to convert line endings and use it as an alternative to the dos2unix/unix2dos tools. Using set-buffer-file-coding-system works well and has been my go-to conversion method.
That said, there is another way to do the same conversion by using M-x recode-region. As the name implies, recode-region works on a region. As a result, it offers better control over where the line ending conversion is applied. This is extremely useful if you’re dealing with a file with mixed line endings.
Mixed line endings due to version control misconfiguration are actually the main reason for me having to use these type of tools in the first place…
As posted in a few places, Emacs 26.1-RC1 has been released. Following up my previous experiments with running Emacs on the Windows Subsystem for Linux, I naturally had to see how the latest version would work out. For that, I built the RC1 on an up-to-date Ubuntu WSL. I actually built it twice – once with the GTK+ toolkit, once with the Lucid toolkit. More on that later.
The good news is that the text mode version works right out of the box, the same way it worked the last time. I only gave it a quick spin, but so far it looks like it Just Works.
A quick follow-up to my last post where I was experimenting with running emacsclient from an ansi-term running in the main Emacs. Interestingly, you can run Emacs in text mode within an ansi-term, just not emacsclient:
Yes, the whole thing got a little recursive. Yes, it’s a little silly, and yes, I’m one of those people who think they need answers to the question “I wonder what this unmarked button does?”
I’m experimenting with screen recordings at the moment and just out of curiosity decided to see if I can load and edit a text file inside the main Emacs process from inside an ansi-term using emacsclient.
Spoiler alert – yes, you can. At least the way it is set up on my system, emacsclient doesn’t play with text mode (-nw) as it doesn’t recognise eterm-color as a valid terminal type, but loading and editing the file into the GUI works flawlessly.
I’ve had the Linux Subsystem for Windows enabled for quite a while during the time it was in Beta. With the release of the Fall Creators Update, I ended up redoing my setup from scratch. As usual I grabbed Emacs and a bunch of other packages and was initially disappointed that I was looking at a text-mode only Emacs. That might have something to do with the lack of an X Server…
For a free X Server on Windows, I had a choice of Xming and VcXsrv. I used Xming a long time ago and I’m happy to pay for software, but decided to go with something free for this initial proof of concept. Plus, I was curious about VcXsrv, so I picked that. I really like that its installer includes everything I needed right out of the box, including the fonts.
Emacs 25.3 was released on Monday. Given that it’s a security fix I’m downloading the source as I write this. If you’re using the latest Emacs I’d recommend you update your Emacs. The vulnerability as been around since Emacs 19.29, you probably want to upgrade anyway.
Build instructions for Ubuntu and friends are the same as before, the FreeBSD port appears to have been updated already and I’m sure homebrew is soon to follow if they haven’t updated it already.
I haven’t done much with Ubuntu recently, but had to set up a laptop with XUbuntu 17.04. That came with Emacs 24.5 as the default emacs package, and as skeeto pointed out in the comments, with a separate emacs25 package for Emacs 25.1. I tend to run the latest release Emacs everywhere out of habit, so I revisited my build instructions to build a current Emacs on Ubuntu and its derivates. The good news is that in thanks to some changes in the Emacs build, the build is as straightforward as it used to be prior to the combination of Ubuntu 16.10 and Emacs 25.1. In other words, no need to remember to switch off PIE as was necessary when building GNU Emacs 25.1 on Ubuntu 16.10.
Here’s a brief recap of the build steps so you don’t have to go back and click your way through my old posts.
First, if you haven’t enabled the ‘source code’ repository in Ubuntu’s software sources, do so now. If you don’t, you’ll run into the following error when installing the build dependencies for Emacs:
E: You must put some 'source' URIs in your sources.list
Assuming you have added the source code repositories to your software sources, execute the following commands. The first command installs the build tools, the second one installs all the build dependencies for the stock Emacs build. Those dependencies will give you a fully functioning GUI Emacs. If you need additional third party libraries for additional functionality that aren’t covered by the regular Ubuntu Emacs build dependencies, make sure you install those also. I usually go with the stock configuration so for me, these are the two commands I need to run:
sudo apt install build-essential sudo apt build-dep emacs25
On my fresh install of XUbuntu 17.04, the build-essential packages were already installed, so it may not be necessary to execute that step any longer. However, it was necessary in the past so I’m still leaving it in there as it makes sure you have the normal build setup.
You can install the build-deps for either the emacs or the emacs24 package instead of the one for the emacs25 package as I show in the example above. They all appear to install the same dependencies as trying to install all three doesn’t appear to result in any additional packages being installed.
At this point, it’s time to download the GNU Emacs 25.2 tarball from your favourite GNU mirror, extract it to a suitable place and do the usual configure/make/make install dance. I prefer to install my home built binaries in a local subtree in my user directory, hence the $HOME/local prefix passed to configure:
./configure --prefix=$HOME/local make && make install
At this point, we’re good to go:
timo-xubuntu-VirtualBox% emacs --version GNU Emacs 25.2.1 Copyright (C) 2017 Free Software Foundation, Inc. GNU Emacs comes with ABSOLUTELY NO WARRANTY. You may redistribute copies of GNU Emacs under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING.
The instructions above will also work for building Emacs 25.2 on older versions of Ubuntu, although you have to make sure that you pick the correct build-dep package to install the build dependencies first.
Turns out I made some unnecessary “work” for myself when I tried to add support for command history to inf-mongo.
As Mickey over at Mastering Emacs points out in a blog post, comint mode already comes with M-n and M-p mapped to comint-next-input and comint-previous-input. Of course these keybindings work in inf-mongo right out of the box. I still prefer using M-up and M-down, plus I learned a bit about sparse key maps and general interaction with comint-mode. So from that perspective, no time was wasted although it wasn’t strictly necessary to put in the work.
But with Emacs being the box of wonders it is, it’s still fun to learn about features and new ways of doing things even after using it for a couple of decades.
There are a more gems hidden in Mickey’s blog post so if you’re using anything that is based on comint, I would really recommend reading it.