Scrolling and Font Size Changes in macOS

After my post on a Linux specific problem and Emacs I feel entitled to bring up another macOS specific issue. This problem is brought to us by Alvaro who explains that it’s possible to combine trackpad scrolling and certain keystrokes that result in a spontaneous font size change in the current buffer. Depending on whether you scroll up or down, the font may become larger or smaller.

The font size changes get triggered when Ctrl is pressed while scrolling. It’s tempting to say it serves him right for using the mouse in Emacs but, as Alvaro says, the MacBook trackpad is especially convenient for scrolling and easy to get used to when in one of those other applications. It’s right there below the keys and so easy to reach with a thumb that one can almost pretend they’re not using the mouse.

For a while, Alvaro solved the problem by simply reloading the file with Ctrl+x Ctrl+v but then someone showed him how to stop Emacs from changing the font sizes to begin with. If you’re having this problem, head over to Alvaro’s post to see to solution. Better yet, keep your hands off the trackpad.

Posted in General | Tagged | Leave a comment

D-Bus and Emacs

I have, from time to time, written Emacs posts that are specific to macOS. Lots of folks use macOS so I don’t apologize for that but lots of folks use some flavor of Linux too so it’s only fair to recognize some Linux specific Emacs uses as well.

Lars Ingebrigtsen is a Linux/Emacs user who likes things the way he likes them and who has no patience for systems that don’t meet his needs exactly. He has an interesting post that lists three such problems:

  1. His laptop goes into power save mode sooner than he’d like.
  2. When he closes his laptop cover it goes to sleep like most laptops. He doesn’t like that for reasons you can read in his post. He wants it to turn off his screen and nothing else.
  3. When he turns off his Bluetooth speakers, he wants his laptop to stop playing music.

He noticed that what all these problems have in common is that he wants to react to some hardware event in his own way, not in the way the system developers thought best. His solution to this is to use D-Bus to listen for the requisite events and notify him when they occur. From there, it’s a simple matter to react in the appropriate way.

What may be surprising is that all this is written in Elisp. He doesn’t show the code in the post but does provide a link to it. The code is straightforward and there’s not much of it. It is, as he says, specific to his needs but should be easy to adopt to any user’s needs.

Sadly, this is mostly useful for Linux users although there is a port of D-Bus for macOS. I’ve never used it so I don’t know how well it would work for an application like this but it’s easy to install with Homebrew and worth checking out if you have problems similar to Ingebrigtsen’s.

Posted in General | Tagged | Leave a comment

Some Great Emacs Packages

Over at Lambda Land, Ashton Wiersdorf opines on what he considers the best Emacs packages. You may agree or disagree with any particular choice in his list but it’s hard to argue that his choices are not reasonable.

His list starts with Magit, Org Mode, and Avy, which should, in my opinion, be on everyone’s top 5 (or so) list but that’s low hanging fruit. Next on his list is Embark, Eat, and Jinx. I use Embark and like it but it’s not a must have for me. I really liked the idea of eat, but after I installed it, I never used it so it was a dud for me. One of the things everyone loves about it is how fast it is but the speed of all the Emacs terminal emulators seem fine to me. I’m not familiar with Jinx but it seems like it’s something worth checking out.

His next three packages are Vertico, Consult, and Corfu. I don’t use any of these. I much prefer the Swiper/Ivy/Counsel package. It does pretty much the same things and I’m used to and happy with it so I’m not inclined to change.

Regardless of my predilections, these are great packages and worth taking a look at to see if they would work for you.

Posted in General | Tagged | Leave a comment

Casual Info

Charles Choi is back with another of his “Casual” packages. This time it’s for what some of us consider the the dumpster fire that is Info1. His latest offering, Casual Info, provides a porcelain for Info that not only provides a menu for Info but also rationalizes some of the keystrokes.

As Choi says, most users probably expect Info to behave more or less like a Web browser, yet Info is almost perverse in its choice of UI. To be fair, the Info interface was fixed long before Web browsers were popular but almost everyone is going to find it disconcerting. That’s why Choi changed some of the bindings on his interface.

Alphapapa suggested that since Transient is now an Emacs builtin, Choi should offer his various Casual packages as part of vanilla Emacs. That makes a bit of sense. All of them help with the use of Emacs functionalities that have hard to remember bindings and would be a boon to not just n00bs but even more experienced folks like me who have trouble remembering seldom used bindings.

Choi seemed open to the suggestion. My opinion is that they’re a worthy addition but it doesn’t really matter. If you want them, they’re easily available from MELPA. Having them in core might, I suppose, aid discoverability. Regardless, I certainly wouldn’t object to their inclusion.

If you, too, find the Info interface maddening, take a look at Choi’s post for an alternative. Perhaps it will one day be built in but regardless MELPA is only a couple of keystrokes away.

Footnotes:

1

“Dumpster fire” is probably too harsh but it’s certainly fair to say that its user interface is less than optimal.

Posted in General | Tagged | Leave a comment

TABs or Spaces

No, I’m not going to relitigate one of our favorite holy wars. Really, I don’t care very much about the issue. Long ago, I arbitrarily settled on spaces but don’t have strong feelings one way or the other and would change in an instant if there were a good reason.

Still, lots of people do care and chansey97 over at the Emacs subreddit wants to know what people think. The main way you express your preference in Emacs is with the indent-tabs-mode variable. If it’s t TABs get used, otherwise only spaces are used. There are some finer adjustments possible but indent-tabs-mode is the important setting.

To my surprise, most of the respondents echoed my indifference. They basically said that they just want Emacs to do the right thing when they press the TAB key. That’s actually pretty reasonable because the major modes will do the right thing—or whatever you’ve configured—when you press TAB.

Happily, your choice doesn’t commit you to one or the other for every file. For example, I have an old file—dating from my Vim days—that has TAB delimited fields. At the top of that file I simply added

# -*- Mode: text; indent-tabs-mode: t -*-

and when I press TAB, an actual TAB character is inserted.

I don’t know what other editors do. I don’t even remember how Vim handles the situation. It’s enough to know that whatever your preference, Emacs has you covered.

Posted in General | Tagged | Leave a comment

A Flush-lines Example

I’m fond of telling stories about folks using Emacs to solve difficult—or at least complicated—problems but Emacs is probably used more often to solve simple, one-off problems. These problems typically don’t require anything fancier than, maybe, keyboard macros.

Mario Jason Braganza has a nice case in point. The TL;DR is that he made a bulk purchase of comics and wondered how many he got. The site that he bought them from had all the information about the purchase but it included much more than just the titles. Each bit of information was on a separate line and Braganza decided to count just the title lines to see how many comics he had.

So Braganza downloaded the information and pasted it into Emacs. He thought that if he could get rid of the extraneous lines, he could simply do a line count to calculate the total number of comics he had bought.

Experienced Emacers are jumping up and down yelling, “I know, I know”. The answer, of course, was flush-lines. You simply call flush-lines, give it a regular expression, and Emacs deletes any lines having a match for the regex. Braganza could, of course, have given it a complicated regex that got rid of all the unneeded lines at once but he chose the simpler—and probably more rational—method of eliminating one type of line at a time. In the end, he had only titles left and a simple line count gave him his answer.

This is, to be sure, a trivial example but it illustrates nicely one of the areas where Emacs shines: simple one-off tasks that would be tedious without the editing power of Emacs. Could you do this in some other editor? Maybe, but why should we care. It works in Emacs and that’s all we need to know.

Posted in General | Tagged | Leave a comment

Emacs As Crack

Jack Baty has a very amusing, but true, take on using Emacs and how resisting it is like resisting gravity: in the end you’re gonna lose. His story is that he hates futzing around with things, especially his Emacs configuration, so every once in a while he decides to find simpler apps to perform all the chores that he does in Emacs.

It never ends well. He starts out loving the new apps and not having to constantly tweak their configuration but he inevitably finds himself missing some of the custom tweaks that he made to Emacs. Then one day, he needs to work on an Org file, opens it in Emacs, and suddenly he’s right back where he started. He rediscovers all those customizations he made to Emacs that made his life so much easier.

It’s like the Borg: resistance is futile … , or perhaps like crack: once you start, you can’t stop. Of course, unlike the Borg and crack, Emacs is not evil—users of those other editors notwithstanding—but a real boon to our workflow. Still, there’s no denying that its use is addictive. Once you start you soon find yourself wondering how you can import this or that task into Emacs. Before long, having to leave Emacs is an imposition. Finally, like me, you find yourself installing emacs-everywhere so that even when you’re not in Emacs, you can be in Emacs.

So rather than the Borg or crack, Emacs is actually the editor for all seasons.

Posted in General | Tagged | Leave a comment

De-Googling: My Secret Weapons

Neeraj Adhikari has a nice post on one of my favorite crusades: banishing Google from my life. I’ve been pretty successful at this because of two thing: Emacs and macOS.

Most longtime readers know that the Irreal empire mostly runs on an Apple substrata. Even so, I’m not really a fanboy because, let’s face it, Apple can be annoying and their fanboys even more so. Still, I do think their hardware is usually best in class and their integration across devices exceeds what Linux/Android is able to do because they control the hardware as well as the software.

To see what this has to do with de-Googling, let’s take a look at Adhikari’s post. He lists several categories of services that he’s managed to find non-google alternatives for.

Email
You can read Adhikari’s post for his replacements but happily for me, Emacs and macOS have me covered. All my email flows through my Apple account. Apple’s not (at least not yet) interested in harvesting my information so they don’t bother scanning my email. Apple also doesn’t insist that I use their mail app. I read and send my email from Emacs with mu4e. And I can still read and send email with the mail app if I’m on my iPhone or iPad.
Photos
None of you, believe me, would be interested in seeing my photos so I’m not much concerned with efficient sharing. For the few that I do want to share, iCloud does the job nicely for my needs. The Apple Photos app takes care of curating my photos, syncing them across my devices, and backing them up to iCloud.
External Drive
Again, iCloud works well for me. It’s not expensive, reasonably reliable, and can be accessed from any of my devices as well as from a browser on any device. It’s probably not so good for collaborative work but that’s not a problem for me.
Calendar and Contacts
Again, Emacs and macOS are excellent alternatives. I use both Emacs and macOS for these functions and although it’s possible to sync between them, I don’t bother because I use them on disjoint data.
Phone
Let’s face it, if your Google-free life includes not using an Android phone, there is really only one alternative. Anything other than an iPhone or Android phone is simply a non-starter these days.
Maps
Although opinion varies, many informed folks say that Apple maps are as good or better than Google maps at this point. I haven’t bothered checking because I don’t care. I use Apple maps almost every day and have never had a problem with them. I use them in my car with Car play and on my Apple devices through the Maps app. I haven’t used Google maps in years.

That leaves Web search and videos. Web search is easy. I use Duck Duck Go and have for years. For a long time it was probably not as good as Google search but from everything I read, Google search has become a dumpster fire lately so Duck Duck Go is not only a good choice but arguably a better one.

Finally, the spoiler: Videos. YouTube continues to be the only realistic choice and is, in fact, the sole Google product used in the Irreal bunker.

So the takeaway is that if you want to live a Google-free life, macOS and Emacs are good places to start.

Posted in General | Tagged , , | Leave a comment

🥩 Red Meat Friday: Emacs Doesn’t Have Plugins

Note: I’m calling this a Red Meat Friday post because of the pushback I got the last time I broached the subject. It’s not really all that controversial.

Over at the Emacs subreddit TheTwelveYearOld asks what makes Emacs and Lisp so special when they’re used together. The answers are interesting but what struck me the most was the role that Elisp plays in Emacs. It’s not something that was tacked on later on: it’s what Emacs itself is built from.

Five years ago I was feeling grumpy and complained about the term “plugin” being used to describe Emacs extensions. I got a bit of pushback. Just because we Emacsers prefer “Package” or “Extension” doesn’t mean that “plugin” is a bad choice, they said. But it is. The word plugin, as commonly understood, refers to code that uses a predefined API provided by the host program that allows users to add limited functionality. Elisp is not at all like that. It’s not just the same language that Emacs itself is written in; the code you write lives in the same environment as the builtin Emacs code. It’s indistinguishable from the code the editor ships with. In fact, packages can be and sometimes are moved into Emacs core virtually unchanged.

Contrast this with other editors that allow you to write plugins in Lua, Javascript, or whatever. The code you write for them are plugins because they can do only what the API allows. You can’t change basic functionality or improve the algorithms the base editor provides.

At the end of the day, Emacs is—as I always say—a Lisp machine. Virtually everything in the system, except a bit of C code, is accessible to the user at run time. There’s no need to edit and recompile. You just change the running image on the fly. It doesn’t have plugins because it doesn’t need them.

Posted in General | Tagged , | Leave a comment

Emacs For PhD Students

Over at the Emacs subreddit, InstinctsInFlow says that he’s a PhD student in computer engineering who has been using Emacs for a couple of years because of its support for VHDL coding. He really likes Emacs and want to find better ways of using it so he asked for advice on using Emacs as a PhD student.

I found the answers in the comments to be particularly useful. InstinctsInFlow does his coding in Python so he was particularly interested in how to use Emacs with Python in an optimal manner. Everyone has an opinion on this, it seems, but the suggestions were all good.

The other thing that almost everyone mentioned was, of course, Org mode. If you’re a PhD student, you’re going to be doing a lot of writing. Writing that’s apt to include a bunch of mathematics and there are really only two choices1: Org mode or LaTeX. It’s certainly true that LaTeX gives you finer control but not much finer and in almost all cases Org is fine and it’s always easier.

There are some other good recommendations. If you’re interested in using Emacs for your PhD studies, take a look at the post. It’s short and has some good suggestions.

Footnotes:

1

Sorry, Word is a non-starter in the Irreal universe.

Posted in General | Tagged | Leave a comment