Configuring Mbsync to Work with Gmail

I long ago gave up using Gmail due to privacy concerns. Still, lots of folks—and companies—still use it because, among other things, it does have the advantage of portability that doesn’t depend on your current ISP or your OS. Gmail is easy to use as long as you use their Web UI.

If you’re an Emacs user who’d like to deal with email from within Emacs, however, things are bit more difficult. The hard part is retrieving mail from Gmail’s IMAP server. You’d think you could just use your usual credentials but that doesn’t work.

Jakub Kadlčík has a post that explains how to configure mbsync to deal with Gmail. The difficulties mostly involve generating and using a special password. I’d like to beat up on Google for making things so difficult but they’re simply trying to make the process a bit more secure and, truth by told, setting things up for Apple Mail is similar.

I’ve never configured mbsync for Gmail but I did for Apple Mail and found it difficult because I couldn’t find any write-ups on how to do it. As with Gmail, the difficulty is not the mbsync configuration file, it’s generating the special app password you use. It’s the same with Gmail: the tricky part is knowing that you need an app password and finding out how to get one. That’s where Kadlčík’s post comes in handy. If you’d like to retrieve Gmail with mbsync—or, really, any of the IMAP downloaders—take a look at his post.

Posted in General | Tagged | Leave a comment

Managing Window Placement

One of the tropes of Emacs use is the idea that there’s always something new to learn about the editor. I know that to be true but today it was brought home to me by a new video from Protesilaos Stavrou. The video is nominally about managing window placement but part of that is the notion of “side window.”

I had never heard of them before or even the concept that they implement. It’s no wonder. While I was preparing to write this I looked them up in the documentation but couldn’t find anything at all about them in the Emacs manual. I had to consult the Elisp manual to find any information about them.

The problem that Stavrou is seeking to solve is the inconsistent placement of the windows that pop up for things like HELP. Sometimes a new window is created; other times an existing window is reused. If you’re like me, you probably suspected that the behavior is configurable but haven’t seen or used the mechanism to do it. Window placement configuration is fairly fine-grained so you can pretty much have it anyway you like.

Unless you’re very particular about window placement or want to implement something like emacs-dir-treeview, you probably won’t need to deal with side windows or the other functionality that Stavrou discusses but his video does show how the configuration is possible if you need it. The video is just short of 19 minutes long so plan accordingly.

Posted in General | Tagged | Leave a comment

Red Meat Friday: Word

And rendering. Don’t forget rendering. Yes, yes. I know. The rendering’s gotten better but it’s still not a good as a real typesetter like LaTeX or Troff.

Using Word is just another way of saying, “I don’t care what my content looks like.”

Posted in General | Tagged , | Leave a comment

Some Z Shell Tricks

A lot of Linux people have been singing the praises of Zsh for a long time and even as a Mac user it was always an option but I never bothered. Part of that is that I mostly stay in Emacs and don’t use the shell as much as I used to and I was happy with Bash so it never seemed worth the effort to upgrade.

Then, of course, Apple made up my mind for me by making Zsh the default shell in macOS. A useful way of thinking about Zsh is as a superset of Bash so I mostly haven’t noticed any changes except for fixing the prompt string.

Over at the Twilio Blog Lizzie Siegle has a nice post on some Zsh tricks that show some of its benefits. There’s no point in me relisting those tricks but if you’re a Zsh user you should definitely take a look. In particular, if you’re on a Mac and got (more or less) force changed into Zsh, you probably haven’t explored all it has to offer so you should definitely read the post.

Siegle’s post by no means exhausts all the additional goodies you get with Zsh. You can even get Oh My Zsh, a whole package of additional plugins. The post has links to a cheat sheet and list of Zsh plugins if you want more information.

Posted in General | Tagged | Leave a comment

Exporting Org to HTML

Jake B has a helpful video on exporting Org files to HTML. Irreal readers almost certainly knows how to do this so why am I writing about it? As you know, you can tweak your Org file to pull in CSS files that alter what the exported HTML will look like when you export it with org-export-dispatch (Ctrl+c Ctrl+e) so that it will appear nicer than the default plain HTML output. The video shows how easy this is.

Jake B starts with getting rid of section numbering and the Table of Contents. That’s simply a matter of a couple of options but the real win comes with using Fabrice Niessen’s readtheorg CSS files that provide a really beautiful layout. I always thought that using Niessen’s themes involved a bunch of cloning and configuration but that’s not true. As Jake B shows, all you need do is add the line

where NAME is either readtheorg or bigblow.

Finally, Jake B shows how to add your own CSS. With the exception of the CSS file itself, that’s also a one-liner:

#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="styles.css"/>

assuming your CSS file is styles.css.

I started by saying Jake B’s post is helpful because it shows how easy it is to improve the default HTML exported from an Org file. If you use one of Niessen’s templates, it’s a matter of adding a single line. Use one of those templates or your own CSS and increase the beauty in the world.

Posted in General | Tagged , | Leave a comment

Paul Graham: What I Worked On

By any reckoning, Paul Graham has had a pretty successful life. He’s recognized as an expert on Lisp and has written a couple of books on the subject. In addition to his accomplishments in computer science, he also trained as a painter, founded and ran Y Combinator, a very successful early stage venture capital fund, and is currently enjoying a career as an essayist.

His latest essay, What I worked On, is the story of how it all happened. It’s a bit over 14,000 words so it’s a long read but definitely worth your time. The essay traces his life from high school to the current time. He learned a lot of lessons along the way and shares some of them in his story.

To my mind, the most compelling was to work on whatever you want. He doesn’t put it that way; he says to not be afraid to work on non-prestigious projects. He says that, mostly by happenstance, that’s what he’s done and that it’s worked out well for him.

One amusing anecdote was that one day while he was struggling as an artist he heard a radio report about a fund manager who was “super rich” and asked himself, “Why don’t I become rich?” That question led him to form Viaweb, which he later sold to Yahoo! and which, did indeed, make him rich.

His whole life seems like that. He followed what he wanted to do and managed to turn it into a success. Of course, Graham is an exceptional intellect but there is, I think, a lesson in his story for all of us.

Posted in General | Tagged | Leave a comment

Sleeping in Unfamiliar Places

npr has an interesting article on some recent research about what happens when humans sleep in an unfamiliar place. It’s long been known that humans don’t sleep well in an unfamiliar place. The effect is so common it even has a name: “first-night effect.” Sleep studies have long thrown out data from subjects during their first night in the sleep lab. The new research explains why this happens.

It turns out that half our brains are standing guard. This is completely understandable on evolutionary terms: when in a new place our ancestors were unfamiliar with the predator risks so only half their brains went to sleep. The other half, the left half, stayed alert and watchful. This happens with many birds and mammals but has never before been documented in humans.

The npr article is short and worth reading just for the details. The actual paper goes into more detail, of course, but seems well tracked by the npr story. The npr story describes the experiments the researchers performed to reveal the effect. The takeaway is that you can expect to sleep less well your first night in a new place and that the effect is involuntary and can’t be avoided.

Posted in General | Tagged | Leave a comment

REPL Driven Development

David Vujic has a nice post on interactive programming—what he calls “REPL driven development”—and the huge difference it’s made to his development workflow. His post, Test Driven Development Deluxe, recounts his frustration with having to switch context from the code in his editor to the terminal so he could run a test. By the time he got back to the code, he’d lost a lot of the context he’d built up while coding.

Vujic is writing in Clojure so he has the power of the REPL at his command. His editor is Emacs so it’s a simple matter to test an individual form or a whole function right in the editor. He loves the instant feedback he gets from that and how easy it is to wrap his test commands into a test function in support of his TDD workflow.

The ability to use interactive programming is one of the main reasons that I try to do most of my programming in some sort of Lisp (Elisp, Scheme, Common Lisp). I still haven’t tried Clojure, though. Maybe after taxes and the rest of the Yak Shaving gets done.

Posted in General | Tagged | Leave a comment

Fixing Two Spaces Between Sentences

Marcin Borkowski (mbork) has an interesting post on how to deal with two spaces after a sentence when transferring data from Emacs to an external application via the clipboard. The problem is that mbork likes to use two spaces so that he can take advantage of Emacs’ sentence-aware commands but most people—at least most Poles—insist, some strongly, on single spaces.

The one/two spaces between sentences is a long-standing holy war that I’ve written about before. Years after learning to put two spaces after sentences (an artifact of learning to type on an actual typewriter) I became persuaded that the one-spacers had the better story and converted to a single space. That, of course, broke the sentence-aware commands in Emacs but I didn’t mind too much. Then I discovered that, as usual, Emacs lets you have it your way. All you need do is tell Emacs how you end sentences:

(setq sentence-end-double-space nil) ;period single space ends sentence

For one reason or another, mbork chose not to use that solution and instead wrote some code to change the two spaces into one. His final solution will still have problems with code in some languages but appears to be working for him.

As well as being interesting, mbork’s post is also serendipitous. Serendipitous because his code for the changing the number of spaces echoes a point from Thursday’s post. Part of his code wants to move to the beginning of a buffer. He does that with (goto-char 0), which is incorrect because the lowest point in a buffer is 1 not 0. Nevertheless the code works. That’s for the same reason that (goto-char 1) works in a narrowed buffer: goto-char clips values outside buffer to be inside the buffer. Another example of Emacs having our backs.

Finally, mbork wonders if his strategy of using a buffer to make his transformations really makes much difference. The answer is almost certainly yes as Chris Wellons explained and I wrote about here.

Update [2021-02-13 Sat 16:56]: Used actual Elisp in goto-char invocations.
Update 2 [2021-02-14 Sun 14:49]: Added link to mbork’s post.

Posted in General | Tagged | Leave a comment

Red Meat Friday: The End of the Story

The seemingly never-ending saga of SCO versus Linux may finally have come to an end. SCO’s Darl McBride who spearheaded the effort has declared bankruptsy. If you’re too young to remember those days, it’s hard to comprehend how much the tech industry obsessed over the matter. One company that capitulated to the extortion became an instant pariah in tech circles. Groklaw, the famous Web site the controversy spawned, is still online if you want to revisit those days.

Of course, schadenfreude is always premature when it comes to this story. Just two and a half years ago the suit rose, phoenix-like, from the dead years after everyone thought the matter was settled. At this point, I’d be distressed but not surprised if the suit outlived me.

Posted in General | Tagged | Leave a comment