Mastering Emacs is 50% Off

The excellent Mastering Emacs is 50% off.

If you use Emacs, you really want this book. It’s been updated for Emacs 25 and is only $20 dollars while on sale.

UPDATE [2016-11-26 Sat 19:49]: matering → mastering

Posted in General | Tagged | 2 Comments

Introductory Magit Video

Arjen Wiersma has a very nice introductory video on Magit. He covers the basic usage such as staging, committing, creating and checking out branches, and logging. If you’re just coming to Magit, it serves as good way to get oriented.

The video is 18 minutes so you’ll need to schedule a bit of time. Eighteen minutes is long enough to get you going but not so long that you get bogged down in details. Wiersma points to the Magit documentation and recommends that for more details or questions.

Wiersma has several videos available. Most of them involve Clojure related topics but he also has some on Emacs. Be sure to take a look at his channel to see what’s available.

Posted in General | Tagged , | Leave a comment

Another of Life’s Little IQ Tests

If you follow security at all, you’re always seeing stupid things. Often it’s stupidity on the part of users but not always. Here’s an example from a vendor that’s so outrageous it takes your breath away. MWave Australia is asking users to provide their complete banking credentials as part of the checkout process. That means MWave would have complete access to your bank account and could, for example, transfer all your funds to their account or do anything else that you could do on-line.

I’ve used MWave here in the U.S. and have always had a very positive experience with them. I checked the U.S. MWave site and they aren’t making this ridiculous demand. I also checked the Australian site and, sure enough, they’re still asking customers for the keys to their bank accounts. I’m sure MWave Australia is honest and has no intention of robbing their customers but how can they not know that this is beyond the pale. It’s beyond the pale even before we begin considering things like man-in-the-middle attacks. It just makes no sense at all.

The site is saying that they need this information to “verify your credit card” and that it’s safe because the information goes through BankStatements.com.au, which, we’re assured, is safe and fast. I know Irreal readers know better but if you live or do business in Australia, warn your friends not to fail this IQ test.

UPDATE [2016-11-24 Thu 13:30]: breadth → breath

Posted in General | Tagged | Leave a comment

Displaying Sunrise/Sunset in Emacs

If you’d like to know what time the sun will rise and set in your area, it turns out to be simple to add it to your Org mode agenda. Jon-Michael Deldin shows how.

The ability to display them is already built into the Emacs Diary. All you have to do is specify your latitude/longitude in your init.el and add

* Calendar
%%(diary-sunrise-sunset)

to one of the files in your agenda list. See Deldin’s post for the details including how to get your lat/lon if your computer or phone won’t tell you.

Posted in General | Tagged , | 1 Comment

Another Great Avy Command

One of the most powerful tricks I’ve learned about using Emacs is from Steve Yegge’s famous post on effective Emacs use in which he recommended using incremental search for navigation. That gave me a huge increase in efficiency. I got an even bigger increase when I started using ace-jump-mode and its later generalization, avy, by abo-abo.

The avy library has many ways of selecting a jump point but they all involve building a jump tree. One of those methods is avy-goto-char-timer. I’ve read its description a few times as I’ve added to my Avy configuration but its usefulness never hit me until I read this tweet from Wilfred Hughes:

It solves a problem that I sometimes have with avy-goto-word-1 (the successor to ace-jump-mode): If you want to jump to a word beginning with a common letter you may have many selections to choose from and the selection labels cover up the beginning of the word. One way to solve this is with avy-goto-char-timer, which allows you to enter a sequence of characters—much like isearch—and it then gives you selections that begin with that sequence.

The “timer” in the command’s name comes from the fact that it considers your entering of the sequence complete when you stop typing for the timer’s value (0.5 seconds by default). I mostly still use avy-goto-word-1 but sometimes avy-goto-char-timer is more efficient and I’ll use that instead. If you don’t like the timer aspect, there’s also avy-goto-char-2, which allows you to enter two characters and build a search tree for those two characters. Its functionality is subsumed under avy-goto-char-timer so I haven’t bothered mapping it to a key sequence.

If you aren’t using one of the Avy functions to navigate, you’re really shortchanging yourself and you should check them out. Avy is available from MELPA so it’s easy to install.

Posted in General | Tagged | Leave a comment

Translating Text with Org Babel

This really blew me away when I saw it. It’s an example of a simple use of Org Babel to translate phrases from English to Mandarin. Of course, all the heavy lifting is done by the Python library translate but the amazing thing is how simple it is to put everything together in just a few lines of an Org python source block.

Take a look and see if you aren’t impressed. What I find most impressive is that it’s just a quotidian use of Babel. It’s merely that it does something besides add a column of numbers that makes it so spectacular.

Posted in General | Tagged , | Leave a comment

Zamansky 22: emacsclient

Mike Zamansky has another video in his Using Emacs series up. This time it’s about emacsclient. All Emacs users tend to obsess over the editor’s load time. We are always looking for ways to speed it up or to avoid having to load it in the first place.

For many of us that means leaving Emacs running all the time. Some folks even arrange for it to be loaded by systemd as part of the boot process. Leaving Emacs up all the time has the downside of accumulating buffers. I used to fret about that myself but I finally realized that Emacs can handle hundreds of buffers without difficulty so I stopped worrying about it. I restart Emacs often enough—due to things like updating packages such as yasnippet that really want to be restarted when they’re updated—that I never accumulate more than a couple hundred buffers anyway.

One nice way of handling this strategy is to run Emacs in server mode and pop up a new frame when needed with emacsclient. The way to do that is to call it as

emacsclient -a "" -c

The -a "" will try to start the Emacs server if it’s not already running. If you want to start it in a terminal, the spell for that is

emacsclient -a "" -t

The terminal version is really useful for when you ssh into a remote machine and need to bring up Emacs on the remote. I have this captured in a bash script named et so that I can call it easily.

Zamansky demonstrates all this and shows how he binds the magic spells to keyboard shortcuts so that he can instantly launch an Emacs frame in the desktop or in a terminal window when he needs it. This weeks video is really short—less than 5 minutes—so you can watch it while you’re waiting for your coffee to cool enough to sip.

Posted in General | Tagged | Leave a comment

Org Mode 9.0.1

There’s a bug fix release of Org Mode out.

Posted in General | Tagged , | Leave a comment

Lessons From Using Org as an Init File

Over at the Emacs reddit, tiktaaliki asks how he can put his init.el file in Org format. As it turns out, I learned some really useful things from the post. First off, the easy answer to that question is to watch Mike Zamansky’s video on org init files. It good for beginners because it’s part of his series on building an Emacs configuration and at the point in the video, the configuration is still pretty simple and you won’t get bogged down in details. I particularly like his simple boot strapper. Once you watch the video, you can take a look at some full-blown examples such as this one from Sacha or this one from Grant Rettke.

Grant has a comment in which he remarks that he prefers to tangle the Org file manually. In it he mentions the function org-babel-demarcate-block (bound to Ctrl+c Ctrl+v d) that’s a big help in refactoring an existing init.el into an Org based init. If there’s an active region, org-babel-demarcate-block will wrap it with BEGIN_SRC, END_SRC tags doing the correct thing if the region is already in a source block. If you call org-babel-demarcate-block from within a source block with no region, it will split the block at that point into two separate source blocks. If you specify the universal argument, it will also insert a heading between the blocks.

This makes it really easy to quickly break up an existing init.el into separate Babel source blocks that form the basis of an Org init file. One possible strategy is to take your init.el and break it up into separate source blocks. Then you can fill in the narrative at your leisure.

Finally, I found a nice use case for narrowing. The documentation for org-babel-demarcate-block is a bit lacking. In particular, although it takes an argument, the documentation doesn’t say what that argument, ARG, does. I could have just searched for the symbol arg but I would have gotten lots of hits. Instead, I simply called narrow-or-widen-dwim, which narrowed to the org-babel-demarcate-block function and then searched. That got only 3 hits and it was easy to see that when it was non-nil the function inserts a header.

UPDATE [2016-11-18 Fri 11:43]: org-babel-demarcate-blogorg-babel-demarcate-block

Posted in General | Tagged , | 1 Comment

Save Org Structure as Directory and Files

Marco Wahl posted a gist that saves an Org file structure as a series of directories and files. I have no idea what I’d use this for but it’s pretty neat.

Posted in General | Tagged , | 3 Comments