A Timestamp Hydra

It’s astounding how many “standard” formats there are for date/time stamps. Two or three years ago, I gave up my American provincialism on the matter and settled on the formats

  • 2018-05-09,
  • 2018-05-09 Wed, and
  • 2018-05-09 Wed 13:24.

I like them because they are unambiguous—unkike, say 10/11/12—and easy to parse programmatically. They also seem more logical because they move from the more general to the more specific. What kind of logical sense does “May 9, 2018” make?

Still, other folks prefer different formats such as ISO-8601, which I’d use except it confuses the civilians with the T and offset. Whatever your preferences, Grant Rettke has you covered with a hydra to generate timestamps in multiple formats. You may think it’s silly to have so many formats available but sometimes you’re dealing with entities that insist on a certain format and Rettke’s hydra let’s you use whatever’s appropriate. If your favorite format isn’t included, it’s trivial to add another.

Rettke leverages hydras for his workflow a lot and this is another excellent example of how their use can make your workflow easier. Some folks don’t like them but unless you fall into that category, you’ll probably find that they can ease your workflow by grouping similar tasks into a simple menu-driven interface.

Posted in General | Tagged | Leave a comment

SSH Tips

If you’re reading Irreal, the chances are that you’re also a frequent SSH user. Very often it’s because you have to log into servers or development boxes at work. I use it even at home to log into remote or local machines and, of course, for remote repositories.

One of the things that can be really annoying about using SSH, is remembering the domain and host names (which in some situations can even be an IP address) and dealing with the passwords. Happily, both of these problems are easily solved and Ivan Zinovyev tells you how.

Even better, Zinovyev gives you three other tips for making your SSH experience better. If you have long running (remote) applications or several connections to the same machine, Zinovyev shows you how to keep the session alive, even if the underlying connection goes down. He also shows you how to reuse a single SSH connection for multiple sessions.

None of this is hard and involves only a few additions to your ~/.ssh/config file, which you probably already have. If you’re using SSH, you should definitely take a look at Zinovyev’s post.

UPDATE [2018-05-10 Thu 18:41]: .sshr/config.ssh/config

Posted in General | Tagged | Leave a comment

Text Manipulation with Command Line Utilities

If your computing experience has always involved GUI tools, you may be unfamiliar or rusty with the command line tools that Unix provides. Similarly, if, like me, you do almost all your text manipulation from within Emacs, you might also be rusty with the command line tools. Happily, Kade Killary has a solution.

Killary has a very useful post entitled Command Line Tricks for Data Scientists that discusses those tools and how to use them for a variety of everyday text manipulation chores. Although the title mentions data scientists particularly, the information is useful for anyone manipulating data in their day-to-day work.

He covers the tools

  1. Iconv
  2. Head
  3. Tr
  4. Wc
  5. Split
  6. Sort & Uniq
  7. Cut
  8. Paste
  9. Join
  10. Grep
  11. Sed
  12. Awk

and gives examples of their use. For some of the tools, like Iconv and Head, he tells you everything you’ll ever need to know; for others, like Sed and Awk, he mentions just a few use cases and points you to the documentation for more details.

At the end of the post he gives a series of links to further information. One of those links points to this Sed introduction and tutorial. It’s the best tutorial on Sed I’ve seen so if you took the advice in my Sed post, you’ll definitely want to take a look and bookmark it.

Posted in General | Tagged , | Leave a comment

Emacs 26.1 Should Be Released Very Soon

Eli Zaretskii is asking the Emacs Devel list if there are any objections to releasing Emacs 26.1 in a week. That was on [2018-05-06 Sun] so we should be seeing the new Emacs soon. I’ve been running Emacs 26.1 RC1 for a while and haven’t had any problems. Some folks were pushing to get a couple more bug fixes in before the release but there doesn’t appear to be any show stoppers.

As always, congratulations to Eli, John, Nicolas, and the (many) others for their hard work. It’s really nice to have regular releases but it does mean a lot more work for the developers.

I almost missed this announcement but Sacha, as she often does, had me covered with her Emacs News list.

Posted in General | Tagged | Leave a comment

Elisp Guide

One of the questions that n00bs are always asking in Emacs venues is, “How can I get started with Emacs Lisp?” It’s a huge help if the requester has a little Lisp background, of course, but the real hurdle to my mind—others disagree—is learning the Elisp specific commands and idioms.

Chris Done has an excellent GitHub repository that contains an Elisp Guide. He assumes the reader has some programming experience but not necessarily that it’s Lisp experience. The guide covers many of the basic features of the language and is a good first look at Elisp programming. Done’s goal is to get the reader to the point that he can profitably read the manual.

If you’ve been wanting to try out Elisp or maybe just make a simple change to your configuration, this is a nice resource. As I say, it will get you to the point that you can fill in the blanks by reading the manual.

Posted in General | Tagged | Leave a comment

Org 9.1.13

Bastien tweets to let us know that there’s a new version of Org mode (a bug fix) available:

If you’re tracking Org with ELPA, it’s already available in the repository.

Posted in General | Tagged , | Leave a comment

A Handy Tip for Counsel/Swiper Users

Marcin Borkowski (mbork) has a very handy tip for Counsel and Swiper users. The idea is that if you want to search for the symbol at point, you need only type Meta+n to use it for the search target. This works for Swiper and the counsel grep functions such as counsel-rg, counsel-ag, etc. See Borkowski’s post for the details.

Posted in General | Tagged | Leave a comment

Ivy, Counsel, and Swiper

As regular Irreal denizens know, I’m a huge fan of the Ivy/Counsel/Swiper suite and consider it one of my two most important packages (along with Org mode, of course). If you aren’t already using it, you should stop what you’re doing and install it right now.

If you’re not decided, Michael Hunsinger has an excellent introduction and tutorial. It by no means covers everything the suite can do but it does show the basic operations, complete with animated gifs. If you want to whole picture, take a look at the Ivy User Manual. It shows all the shortcuts and explains the wonderful regex interface. If you’re an Ivy user and not familiar the alternative regex modes, be sure to take a look at the Completion Styles section of the manual. With the later versions of the suite you can change the method on-the-fly so, for example, if you want to search for several terms in any order, it’s easy to do.

Take a look at Hunsinger’s post and see if you aren’t convinced. Really, it will make your workflow much more efficient.

Posted in General | Tagged | Leave a comment

Writing LaTeX with Org Mode

Writing in \(\mathrm{\LaTeX}\) produces beautiful documents but there’s a pretty steep learning curve. If you’re writing technical documents with lots of mathematics, it’s worth climbing that curve and if you’re an Emacs user, you’ll certainly want to become familiar and adept with AUCTeX.

If you’re a more casual \(\mathrm{\LaTeX}\) user and just want to write a nice looking report or even a letter, there’s an easier way: Org mode. With Org mode, you simply write in the usual Org markup and then export to \(\mathrm{\LaTeX}\) or PDF. You can embed \(\mathrm{\LaTeX}\) commands in the document and add headers to the Org source so that you have pretty much complete control over the look of the final document. It’s even possible to produce journal ready \(\mathrm{\LaTeX}\) or PDFs as John Kitchen has shown (click to see the list):

Sachin Patil has a nice post that shows how easy it is to produce \(\mathrm{\LaTeX}\) with Org mode. You can produce nice looking documents from a completely vanilla Org file that doesn’t mention \(\mathrm{\LaTeX}\) at all. Of course, you can also export that same Org file to HTML or any of several other formats.

I do almost all my \(\mathrm{\LaTeX}\) document preparation through Org mode. I still have some things in \(\mathrm{\LaTeX}\) format but those are mostly older or documents with a lot of mathematics in them. If you want to produce nice looking documents, Org mode is an easy way to do it and Patil shows you how.

Posted in General | Tagged , | Leave a comment

Emacs Lisp Bytecode

Very few Emacs users—no matter how advanced—ever need to worry about the specifics of the Elisp bytecode, or even, for that matter, that it exists. Still, as guys like Chris Wellons have shown, it can sometimes be useful to have a basic understanding of the bytecodes.

R Bernstein has put together a comprehensive, book-length documentation on Elisp bytecodes. After a short introduction, the documentation considers the bytecode environment including the compiler, interpreter, and bytecode optimization. Then there’s a long section on the individual bytecode instructions.

Finally, there are sections on the changes in bytecodes between Emacs versions, a table of opcodes, and a reference section. There’s also a GitHub repository of the document source.

As I said, you probably will never need this but if you do, you’ll be very glad to have Bernstein’s documentation. It’s another example of the vibrant Emacs community.

Posted in General | Tagged | Leave a comment