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

What Cursor Position

You may or may not know about what-cursor-position (bound to Ctrl+x =) that displays the current position of the point in the echo area. It’s probably not too useful if you have the row and column displayed in the mode line although it does give additional information.

Wilfred Hughes’ Emacs Command of the Day offers a handy tip about it:

All that information is the same as what you get with describe-char but it’s conveniently bound to a shortcut, which decribe-char isn’t by default.

Posted in General | Tagged | Leave a comment

File Name Conventions and Tagging Trees

A couple of days ago, Karl Voit gave a really great talk at Grazer Linuxtage 2018. It was entitled The Advantages of File Name Conventions and Tagging, which is pretty much self-explanatory except for the tagging part.

The first part of the talk discusses Voit’s fine naming conventions and the tools he uses to make dealing with them easier. A typical file in his file system has the form

 2013-05-09T16.17 file name with time stamp -- tag3 finance.csv 

Note that there are several parts to the name. First there’s the date or date/time section that gives the date—and perhaps time—of a file. Next there’s a brief description of the file’s content followed by one or more optional tags separated from the description by “ -​- ”. Finally, there’s the file extension, as usual.

Notice how that convention makes it easy to search for files in any number of ways. If you’re searching for photographs taken on 2018-04-29, you might use something like

find . -name "2018-04-29*.jpg" 

to locate them no matter where they’re stored. Similarly, you could search for one or more tags.

The meat of the talk for me is the notion of Tag Trees. The idea is that the files are kept in a single storage area and then indexed by their tags. If we’re trying to find the file 2013-05-09T16.17 file name with time stamp -- tag3 finance.csv, we can look for all the files in the Tag Tree with the tag tag3 or for all the files with the tag finance but there might be many such files. In the branch of the Tag Tree for tag3 there’s a subtree for finance, which has all the files with a tag of both tag3 and finance. Similarly, the Tag Tree branch finance/tag3 contains a link to the file.

I’ve given a very brief description here, so be sure to take a look at the talk for the details. The video is 45 and a half minutes, so plan accordingly. If you’d like to get your file system organized and make files easy to find, you really need to watch this video.

Posted in General | Tagged | Leave a comment

Emacs Video: Play Emacs Like an Instrument

Alain Lafon gave an excellent talk on using Emacs like a virtuoso, which, happily, was captured on video and is available for everyone to enjoy. The talk isn’t really an introduction to Emacs for n00bs—although it could be used for that—rather it’s a demonstration of how a master uses Emacs as the center of all his computing.

Lafon’s inclination, like mine, is to do everything from within Emacs. He thinks of Emacs not as an editor but as a Lisp REPL. That’s similar to my thinking of Emacs as a sort of light-weight Lisp Machine. The impetus for both points of view is that Emacs is the hub of our computing, not just an editor.

This talk is definitely worth watching. I learned about generating thumb nails of pictures from Emacs, picked up an idea for a “code snippet” capture template, and several other Emacs capabilities that I either didn’t know about or didn’t know the details of. The subject matter is much too extensive to cover here so I’ll just refer you to the talk. The only thing that surprised me about his Emacs environment is that he’s still using Ido and Smex rather than the far superior Ivy/Counsel/Swiper suite.

The video is a bit over and hour and 50 minutes so you’ll definitely need to schedule time. You may want to download the slide deck first so that you can get an idea of what Lafon covers but be warned that the slides don’t cover some of the most interesting material he discusses.

Again, even though the video is lengthy, it’s well worth your time. You’ll almost certainly learn some new Emacs techniques and it’s just enjoyable to watch a master show his work flow and what he can make Emacs do.

Posted in General | Tagged | Leave a comment

Documents and Presentations with Org Mode

John Goerzen has another post in his coming back to Emacs series. This time he looks at writing documents and preparing presentations with Emacs and Org mode. It’s an elementary discussion but there’s plenty that will be useful to newcomers to Org.

He starts with an explanation of the Org exporting system and how easy it is to export an Org document in many different formats. In addition to the “standard” export formats provided out-of-the-box by Org, there are several 3rd party packages that allow exporting to additional formats.

One of those export options is to Beamer. Although it’s just another export choice, it feels like a separate functionality. You can write your presentation in an easy and natural way with Org and then export it to a set of slides suitable for a presentation. Although he doesn’t mention it, there is also the org-reveal package for presentations. If you have presentations to give and want slides to go with them, either Beamer or org-reveal gives you an easy way to generate them from the comfort of Emacs and Org.

If you’re new to Emacs, Goerzen’s series on his return to Emacs is worth reading. It’s a good overview of Org mode and Emacs and what they can do for you.

Posted in General | Tagged , | Leave a comment