Xah Lee on Frames vs. Window in Emacs

Xah Lee has an interesting post that I hadn’t seen before even though it’s originally from 2014 (since updated) and mentions a post of mine. The post is a discussion of whether it’s better to have a single large Emacs frame with multiple windows or multiple smaller frames. Lee makes the case that it’s more efficient to have two window-sized frames rather than running Emacs in full screen mode and having two windows in the frame.

When Lee says something about efficiency with respect to Emacs, it’s worth paying attention. In the end, you might not agree but Lee takes this stuff seriously and generally studies the alternatives to determine which is best. If you haven’t read his post, you should do so now so that you understand the context.

Lee’s argument, as I understand it, is that switching between windows in a single frame is suboptimal because various Emacs operations will destroy your windows configuration and using something like winner-mode to restore your window configuration is too much trouble. He prefers to let the OS handle the sizing and position of frames and configures a set of convenient keys to switch to Emacs and move between frames. He then feels free to split either frame temporarily into multiple windows and restore to the single window, presumably with something like Ctrl+x 1, when he’s done.

I disagree with his workflow but not emphatically. I think the multiple frame idea has merit but I don’t see how it’s better—or even as good as—multiple windows. If you divide a frame into more than two windows, you’re still going to want an easy way of switching between them. As I wrote in the post that Lee linked, ace-window is the ideal way to do that. And I don’t see how using winner-mode to restore your default window configuration is any harder than using delete-other-windows.

Still, most of this boils down to individual preference and there’s not really a right or wrong answer. All that said, my actual workflow is not that different from Lee’s. I have an OS key to switch to Emacs which is usually running in full screen mode with two windows. Sometimes I need to split one of those windows temporarily and when I’m done I just call winner-mode to restore things. Sometimes (usually when I running elfeed in a full screen window) I do fire up another frame. It opens in full screen mode but doesn’t, of course, show the original frame. When I’m done, I destroy the new frame with Ctrl+x 5 0 and I’m back to where I was.

I could easily use two frames with this method but then I’d have to worry about two ways of switching to the window I wanted rather than just using ace-window. What do you think? In particular, if you’re using the two frame method, what has been your experience?

Posted in General | Tagged | Leave a comment

Zamansky 49: Mu4e-conversation

Mike Zamansky has another video in his Using Emacs Series up. This time he talks about mu4e-conversation, which I wrote about previously. Mu4e-conversation is a package that makes reading email threads easier. It has two modes, (1) linear mode that displays every message of the thread in a single buffer that you can, say, search them all at once or just scroll through the message and (2) Tree mode that displays the messages in an Org mode tree.

Zamansky demonstrates both modes so you can get an idea of how it works. Like him, I haven’t decided yet whether it will become a permanent part of my workflow. As I said in my original post, threading in my workflow comes into play only when I’m reading posts from a mailing list. Otherwise, the threads are too shallow to need any special presentation.

One thing that I—and apparently Zamansky—haven’t figured out is how to get the individual messages colored by sender. They all appear in my normal display colors. I did a quick check of the code and it looks as if it should be working but I haven’t really researched the problem. I think that’s a very attractive feature of mu4e-conversation so I’ll probably spend a bit more time on it when I get a chance.

In the meantime, take a look at Zamansky’s video and see if mu4e-conversation makes sense for your workflow. The video is just a bit over 6 and a half minutes so it should be easy to fit it in.

Posted in General | Tagged , | Leave a comment

Klipse

I was looking through my file of blog ideas and found an interesting post about the Klipse plugin. The idea is that Klipse allows a blog post—or any Web page—to contain live code examples. Live code examples are just code snippets but with the additional feature that the reader can edit the example and have the result automatically recalculated.

This type of capability is ideal for language tutorials. Here’s an Interactive overview of Scheme’s semantics that illustrates the idea. It’s really easy to build posts like this. You can take a look at the Klipse plugin link or check out the README at the Klipse GitHub repository for the details.

Klipse supports:

  • Javascript
  • Clojure
  • Ruby
  • C++
  • Python
  • Scheme
  • Common Lisp
  • PHP
  • BrainFuck
  • JSX
  • EcmaScript2017
  • Google Charts

All the examples show retrieving the plugin from the Klipse repository but you can also host it locally if you prefer.

Posted in Blogging | Leave a comment

Xah Lee on Abbrev Mode

Xah Lee has a nice video on abbrev mode that shows you a couple of ways to use the facility. Abbrev-mode is built in so you don’t have to install any packages: you can just start using it.

Lee covers both ways of using abbrev-mode. There’s an “official” way that he’s documented here and the easier “Elisp” way that he’s written about here. The video covers both methods so you can watch them in action and decided which you prefer. The difference really only affects how you edit and maintain the abbrev file; actual use is the same.

Unlike Lee, I prefer to use yasnippet but, as always, Emacs lets you have it your way. I agree with Lee that whichever system you prefer you should definitely be using one of them or, perhaps, both.

I also agree with Lee that the simpler “Elisp” way is easier and better. With that method you just edit a simple text file as usual and don’t have to remember a bunch of commands and their key sequences to maintain your list of abbreviations.

The main thing I don’t like about abbrev-mode is that it gets triggered automatically when you type an abbreviation followed by a space. I don’t like things happening automatically when I’m editing text so I prefer the yasnippet way of triggering the expansion with a Tab after the abbreviation.

As I said, whatever your preferences, you should be using one of the systems. They really do make your life easier even if you use it only for implementing shortcuts to phrases you use all the time: imtin the mean time for instance.

The video is 10 and a quarter minutes so it should fit easily into a coffee break.

Added While Waiting for Publication:

While this post was sitting in my READY queue, I stumbled across a reddit post by rmberYou that reminded me of one abbrev-mode application that yasnippet can’t do: the automatic correction of common spelling errors or typos that you make. Suppose you often misspell “receive” as “recieve.” If you make recieve an abbreviation for receive, it will automatically get corrected for you each time you type it. This is one place where even I would want the translation to happen automatically.

UPDATE [2018-06-20 Wed 11:20]: Deleted superfluous “one.”

Posted in General | Tagged | Leave a comment

Internationalization of Text Strings with Emacs

I’ve had this topic in my blog queue for a couple of weeks but I noticed literally scores of tweets pointing to the post in question. That was enough to make me forego my own post on the subject but on rereading the original post, I realized there are some good ideas in it regardless of what’s going on with the tweets.

The post, by Dylan Kirby of MojoTech, discusses to problem of internationalizing text strings in an application that will be used in more than one country. Kirby discusses the problem in terms of the React framework but almost exactly similar problems occur anywhere you need internationalization. I’ve done my share of that in C where we used the GNU gettext library. It’s always a pain and, truth to tell, I avoided working on it whenever I could slough it off to my colleagues. I’m a bad person, I know.

Regardless, Kirby and his colleagues were stuck with doing it and he noticed that it was mostly repetitive work. They used Google Translate to provide a first order translation that was later refined by a human translation service so a first hack at the translation could be automated along with the rest of the mechanics.

You can get the details from Kirby’s post but the most important lesson from his account for me is that it serves as an answer to why you might prefer an Emacs “lisp-machine-like” environment to the pure editing environment of Vim. Kirby’s problem is representative of a common class of problems that are easy to automate with Emacs. My Vim-foo is rusty enough that I don’t see an easy way to do the same thing in Vim, especially the querying of Google Translate. You can argue that you don’t want to read emails in Emacs or use it to listen to music but, believe me, if you have to deal with internationalization, you’ll be happy to have a way of automating it as much as possible. It’s just one more reason that I’m glad to be an Emacs user.

Posted in General | Tagged | Leave a comment

How The Teletype Works

If you’re like me and enjoy seeing how the mechanical marvels—like the Mergenthaler Linotype typesetter—that were used before computers took over everything worked, you many enjoy this film on how the teletype operates. It’s from 1940 and considers the mechanics of sending telegrams at that time.

The subject came up in The Unix Heritage Society mailing list in a thread about the Model 37 Teletype (a common early Unix input device) and the observation that it implemented a mechanical shift register. You can see that in the linked film even though it’s not about the Model 37.

Another interesting thing is the production quality of the film. These days, something like this would be a YouTube video, probably of dubious production quality. This film is like an eleven minute movie. Of course, that’s all there was then. They had enough trouble digitizing a telegraph character: digitizing video was doubtlessly still a distant dream, although television was starting to become available.

Posted in General | Tagged | Leave a comment

Line Numbers in Emacs 26.1

As you’ve probably heard, Emacs 26.1 has replaced the old linum-mode with a faster and less cluttered implementation. I almost never need or want line numbers so they’re normally turned off but for the occasional times when they’re useful, I have a custom key sequence to turn on linum-mode on a buffer basis. I replaced that call to the new facility by calling display-line-numbers-mode instead. They look a lot nicer and don’t slow things down as much for large files but I still don’t use them much.

Others disagree. I just watched a Xah Lee video on Abrev mode (I’ll be writing about that later) and noticed he had them turned on globally, presumably with global-display-line-numbers-mode. David Crook also likes to turn them on globally but he didn’t want them to display in his neotree buffer. He’s posted what he had to do to stop them from cluttering up his neotree buffer. It was harder than you might think so if you have the same or similar problem, you should take a look at his post to see how to fix things.

If you’re one of the people who likes line numbers in your buffers, you’ll appreciate how much the facility has been improved. Just another example of how vibrant our developer community is and how far from moribund Emacs is, no matter what the naysayers tell you.

Posted in General | Tagged | Leave a comment

The Macalope Takes Down Tech Addiction

I keep writing about the silliness known as “tech addiction.” I can’t help myself but I’m not going to seek help. I’m not going to seek help because somehow has to call BS on this nonsense. Now the Macalope comes galloping—or is it loping—to my aid with his own takedown. It’s the Macalope so of course his article is written from an Apple-centric point of view but what he says travels well.

He starts with a story in Wired of a picture from Apple’s latest WWDC in which a person is looking at his iPhone rather than following the events on stage. See? Tech addiction. It’s robbing us of our ability to concentrate and focus. The thing is the person is Rene Ritchie, the editor-in-chief of iMore and as he later tweeted, what he was doing was taking a picture. In other words, he was using his iPhone to do his job by taking a picture of the action. Some might say the very definition of focus and concentration.

That’s not an isolated example. The Macalope offers another story where the Twitter set lose their collective minds over a group of school children who appear to be ignoring a Rembrandt painting while they stare at their smartphones. Of course, it turns out that the students were doing research for a school project on the art.

As amusing as these stories are, they are examples of how the Tech Addiction Police go looking for trouble and keep finding it where none exists. As I pointed out in my Tech Addiction is Not Real post, even experts in addiction psychology don’t believe there is such a thing. Others though, those with something to sell, are pushing the meme and, for example, offering Apps to provide a “less distracting” home screen.

It’s no doubt true that not everyone pushing tech addiction has a financial motive but they should consider that, as the Macalope says, we keep using our smartphones because they’re useful. They’re how we catch up on the news, keep in touch with loved ones, listen to music, read books, and do research. Of course we use them a lot.

Posted in General | Tagged | Leave a comment

We Have Always Been at War with Spam

Via Wilfed Hughes we have:

Over 150 years and we still haven’t won. Or made any progress for that matter. Maybe if we all complain to The New York Times.

Posted in General | Tagged , | Leave a comment

Mu4e-conversation

As I’ve said before, I’m not a fan of threading in emails. That’s mainly because it’s not that useful for the type of emails I deal with but I’m aware that most people have different workflows and probably do like threading. For those people who also use mu4e, Ambrevar has an excellent solution to some of the problems with threading.

Although it’s still in early development, Ambrevar has released his package, mu4e-conversation, to Melpa. The idea is to show all the messages in a thread together in a single buffer. That makes for a more natural reading of the thread and it’s possible to assign colors to each participant in the thread to further aid in understanding who’s saying what.

There’s also a tree-view, which presents the thread as an Org mode tree with each message a node in the tree. Since you can operate on the tree in the usual Org mode ways, that provides a powerful tool for dealing with the thread. It’s easy to switch between the linear and tree views so you don’t have to choose one but can use whichever’s most convenient at the time. You can see screen shots of both methods at the package’s GitLab repository.

Ambrevar shows you how to configure mu4e to always use mu4e-conversation but you don’t have to do that. You can install it and then call it when you want it from the mu4e headers view.

This seems like a really useful package and I’m tempted to try it out for the few times that I want a thread-view of my messages.

Posted in General | Tagged , | Leave a comment