Version 2 of Mastering Emacs is Out

Just got my Mastering Emacs update. Mickey has put out version 2 to incorporate new material reflecting changes in Emacs 25.1. The upgrade is free to current owners; You should be getting an email from Mickey. If you don't already have a copy and you're an Emacs user, you're in luck. Mickey is making the new edition available for just $25. That's a 37% discount so follow the link and get yours now.

Posted in General | Tagged | Leave a comment

Using ace-link with Org Mode

I was checking the ace-link page and discovered something I didn't
know. You can also configure ace-link to work in Org mode. When
invoked, ace-link-org will build the typical avy tree—such as you
get with ace-jump and friends—and allow you to quickly choose the
desired link by pressing a single1 key. As abo abo says, choosing
the correct link goes from an O(n) operation, where n is the
number of visible links, to an O(1) operation.

I use ace-link all the time for Info and HELP files and occasionally
for eww. The ace-link-setup-default command sets up many file
types but not Org mode. To do that, abo-abo recommends

(define-key org-mode-map (kbd "M-o") 'ace-link-org)

The【Meta+o】binding is already assigned to something to do with faces. Since I've
used that exactly zero times in my entire Emacs using years, I had no
hesitation in rebinding it.

Footnotes:

1

Or possibly two or three if you have a lot of links visible
in the buffer.

Posted in General | Leave a comment

Kill This Buffer

[Editorial Note: Sorry about the lousy formatting. Org2blog is misbehaving again so I had to paste the HTML into the WordPress editor.]

Ben Maughan over at Pragmatic Emacs has a really nice tip. It's one of
those things that you (or at least I) don't think about but once you
see the tip, you think, “That's just what I need.” The idea is to kill
the current buffer without asking
.

Maughan asks how many times you've called kill-buffer via
Ctrl+x k】and wanted to kill some buffer other than the one you're in. I can't
ever remember doing that. Maughan provides a one line fix to your
init.el that will just delete the current buffer without asking.
Perfect.

If you think you'll sometimes want the old behavior and don't want to
remember kill-buffer, it's trivial to add a bit of Elisp that
calls kill-this-buffer unless the universal argument is provided in
which case it calls kill-buffer. Bind this to
Ctrl+x k】 and you have the best of both worlds.
Here's some code that does that

(defun jcs-kill-a-buffer (askp)
  (interactive "P")
  (if askp
      (kill-buffer (funcall completing-read-function
                            "Kill buffer: "
                            (mapcar #'buffer-name (buffer-list))))
    (kill-this-buffer)))

(global-set-key (kbd "C-x k") 'jcs-kill-a-buffer)
Posted in General | Tagged | 6 Comments

PSA: SSH Suddenly Asks for Passwords in OS X

Background

If you're an OS X user who uses SSH keys to SSH to remote machines and have just updated to Sierra you may have noticed that SSH has suddenly started asking for a password. My situation is that I've upgraded my MacBook Pro but not yet my iMac. I can no longer SSH into the iMac from my MacBook Pro without giving a password. I am able to SSH into a remote Linux machine using the SSH RSA key.

There are two things going on here, I think. The first is that I think Sierra now requires an RSA key rather than a DSA key. This is for security reasons and something that Linux did a while ago. I can't find any mention of this in the Sierra release notes but it's consistent with what I'm seeing.

On the remote Linux host, SSHD will look for the RSA key in either the authorized_keys or authorized_keys2 file but OS X specifically configures SSHD to look for keys only in the authorized_keys file. This means that you have to add your id_rsa.pub key to the authorized_keys file on a remote OS X machine. Once I did that, everything was back to normal and I no longer had to supply a password.

Summary

If you suddenly find yourself needing to supply a password for SSH operations you should check that you are using an RSA key rather than a DSA key. You may have to generate an RSA key if you don't have one. You should then add this key to authorized_keys on any Macs you are trying to access. Other machines may require the key be added to authorized_keys2 instead. If you're not sure which to use, just add the key to both files.

Posted in General | Tagged , | Leave a comment

An Example of pcase-lambda

Over at the Emacs reddit, instant_sunshine has an example of using pcase-lambda. It's not used very often but can be useful if you have to write functions that need to look inside Lisp objects. The documentation for pcase-lambda is a bit obscure so it helps to have an example of its use.

The idea is that it's like lambda except that the arguments can be any pattern accepted by pcase. Take a look at the pcase documentation or John Wiegley's pcase post to understand what those patterns are.

UPDATE 2016-09-22 19:39:09: Added link.

Posted in Programming | Tagged , | 2 Comments

Blogging Woes

I finally got yesterday's post up by generating the HTML from my Org source file and then pasting it into the WordPress editor. I'm still not sure what's happening. Very occasionally I can push a post with org2blog but most times it gets an error and hangs Emacs.

I recompiled org2bog and updated all the packages. Now I'm about to try to push this file. If I have to paste in the HTML again, I'll add an update. In the meantime, if anyone else is seeing this problem, please leave a comment.

UPDATE 2016-09-21 14:06:08: OK, that worked but I'm suspicious that it might have been one of the rare exceptions. If this update pushes too, I'll be more confident that things are back to normal.

Posted in Administrivia | Tagged | Leave a comment

The Five Second Rule

The New York Times has published an article on the five second rule.
You'll be shocked—shocked—to learn that if you drop food on the floor
you get bacteria on it even if you pick it up in less than 5 seconds.
There are a couple of things I don't understand.

First, why would anyone waste time and money studying this issue? It's
not the first time someone's looked at it and guess what: they arrived
at exactly the same conclusion last time. Is there anyone who doesn't
realize that the 5 second rule is meant as a joke? Even as I child, I
understood that it was nonsense and just a humorous way of justifying
picking food off the floor and eating it.

The second thing I don't understand is why the Times thought it was
worth devoting space to this. It's not like we've run out of news.
It's like those cloyingly cute stories we keep seeing on TV news: all
sugar, no nutrition.

As is often the case, Kontra has the final word on the matter

Posted in General | Tagged , | 1 Comment

Problem Posting

I'm have a problem posting today's offering and I've run out of time to deal with it right now. I'll try to get back to it later tonight.

If you're reading this, it means that it's not a problem with Emacs or org2blog so it must be something in the post itself.

Sorry.

UPDATE: have --> having

UPDATE: It looks like the problem is something with org2blog afterall. Every once in a while the post will work but most times not. I doing these updates from WordPress itself. Sigh.

Posted in Administrivia | Tagged | Leave a comment

Fundamentals

So true and so often disregarded

Hat tip to Karl Voit.

Posted in Programming | Tagged | Leave a comment

Emacs 25.1

As you surely know by now, Emacs 25.1 is out and available for download at the usual places. Check the Emacs download page for a mirror near you. They also have pointers to some precompiled binaries if you prefer that.

I built and installed the new version with no problems at all. The compile even seemed snappier than I remember. If you're on OS X and want to use eww you need to use a slightly different configure line. I explained how to compile Emacs with eww on OS X for version 24.4 but the procedure is the same.

Meanwhile, Mickey has an excellent annotation of the NEWS file for the new version. You should be sure to give it a read to find out what's new and changed. One thing I learned is that if you want dynamic modules you have to specify that on the configure line. I haven't done that yet but if you want it be sure to add it.

I'm writing this with Emacs 25.1 but I just finished compiling and installing it so I haven't done much with it yet. So far, though, everything seems fine. If you haven't been living on the bleeding edge and using the development version, you can finally install the new Emacs.

Thanks to the many people under the excellent leadership of John Wiegley for this release. I know it was a big change and a lot of work.

Posted in General | Tagged | Leave a comment