Magit’s Killer Feature #1: Commit Text Completion Based on the Diff

I’m using the Emacs git frontend (‘porcelain’) Magit for all my projects nowadays. I fire up GitUp (which is great) only to traverse the commit history visually. Here’s one of the reasons: With auto-completion framework company
, I get completion suggestions when I type my commit message. These are based on the actual code diff of the commit.
@EnvironmentObject Is a Branched Global Variable
In SwiftUI, @EnvironmentObject
is used to loosely couple any ObservableObject
without directly passing it down the view hierarchy, e.g. via parameter injection. Unlike Singletons and global variables, Environment Objects are local to view hierarchies: different branches in the hierarchy can maintain different object references.
Happy People = Mac Users
I talked about my “job” the other day and, again, pointed out that I’m making apps, but for Mac, not iPhone. No, no, I also do iPhone. I just don’t like to, and avoid it if I can. But using a Mac, that is fun, and working on a Mac is great. The machines are good, the OS is still good. That’s what I believe the most. For the things I’m interested in making, the Mac is a good platform. It’s a platform to get serious stuff done. And I can be a part in making the experience enjoyable and make “work” fell less like a chore. That’s what I’m interested in.
Link Your Website to Mastodon via Metadata
Since hackers and normies alike check out Mastodon nowadays, here’s an undocumented (as far as I can tell) variant to connect your website link to your Mastodon profile. Update 2022-05-16: Dave Barr made a much nicer illustrated guide for this!
Dependency Injection and the Tree of Knowledge
On Twitter, Manuel Schulze (@zet_manu shared the Swift package Resolver that does dependency injection in a very convenient way with little boilerplate thanks to property wrappers: Mr Dr Dominik Hauser replied, and that’s how it entered my Twitter timeline. I was curious why people use packages like this – I know the concept from Java, but have always found constructor injection and maybe a Service Locator here and there to suffice.
PSA: TextKit 2 Has Bugs
When I linked to Marcin Krzyzanowski’s STTextView, I didn’t want to pollute the link post with this – but I did notice that Marcin added a very informative section to the README: a Bug Report List.
STTextView: A TextKit 2 Text Editor without NSTextView

In my recent post about the TextKit 2 sample app, commenter Frizlab pointed out that Marcin Krzyzanowski (@krzyzanowskim on Twitter) is doing TextKit 2 stuff. I didn’t notice that in my Twitter timeline even though I follow him for years now, so I was confused, nay, angry about the state of my Twitter timeline since Musk’s takeover /s
.
And yes, Marcin does have a very extensive open source sample project that explores TextKit 2! He’s working on Swift Studio, a pure Swift IDE and his STTextView
is a part of that.

So meet STTextView, a “TextKit2 text view without NSTextView baggage”.
One thing I love about the code comments for the UI compoents is the ASCII diagrams of layer contents, e.g. in STTextView.swift
:
// STTextView
// |---selectionLayer (CALayer)
// |---contentLayer (CALAyer)
// |---(STInsertionPointLayer | TextLayoutFragmentLayer)
//
Am totally going to adopt this :)
Clean Downloads Folder on Mac with Hazel

I have a confession to make. I eased into this by sharing the same info on Twitter/Mastodon already. My ~/Downloads
folder is a mess. It’s much less messy than your Downloads folder, most likely, but still. I achieved relative de-messification by automatically filing old downloads into sub-folders, one per month, like ~/Downloads/2022-05 Downloaded
. That was amazing because the actual Downloads folder was clean, and old stuff was somewhat highlighted.
Weak Self – Closure Rules of Thumb
In Swift, you can weak-ify references to self
in escaping closures, and then you need to deal with the case that the reference is gone when the block is called. Last month, Benoit Pasquier and Chris Downie presented different takes on the problem. That discussion was excellent. It prompted me to take some more time to revisit this problem systematically, and I took away a couple of notes for future-me.
TextKit 2 Example App from the Apple Docs

The Apple Developer Docs have an example app, “Using TextKit 2 to Interact with Text”. That’s related to WWDC 2021’s introduction to TextKit 2.
How to Upgrade Sendy from Version 5 to 6 from the Shell via SSH
I’m using Sendy for our newsletters. Recently, verison 6 was released. Here’s how I updated like a pro on my VPS via SSH. The beginner-friendly but ultimately drag-and-drop/FTP-based online instructions assume that you will be moving files over from “new location” to “existing location”. That’s quite cumbersome when all you have is SSH.
Center Window on the Current Monitor in Emacs, Simplified
Louis Brauer over on Xah Lee’s Discord helped simplify my Emacs window centering code (cf. original single monitor solution. It’s great, and only a handful of lines!
Transient Menus Galore

I just wanted to take a short minute to shout out to two transient.el
based packages I discovered this week. One is org-menu
, and bound to C-c m, it shows a transient menu of, well, transient keybindings to navigate around, move outline items, and do a lot of other things.
Fixing Our Recent Xcode 13.3.x Dependency Cycle Errors
So for quite some time, I had the Swift Build System Integration flag enabled to speed up my builds. It was good. I set it, it worked, I forgot about it. With Xcode 13.3 and 13.3.1, now, we got a lot of dependency cycle warnings out of nowhere. Clean build works, but any build afterwards would occasionally fail.
How to Assemble Menu Bar App Screenshots for Mac App Store

To make menu bar app screenshots for the Mac App Store, you need to fill 2800 by 1880 pixels with something that highlights a widget in the corner of the screen. Geoff Hackworth did this: Since today, you can look at the result of this on the App Store: check out Geoff’s app “SF Menu Bar”.
Aergrind by Knock Coffee Grinder, and Their Amazing Customs Duty Service

I bought a hand grinder that would replace our 40+ years old, dull antique. Of course I looked for advice on James Hoffmann’s YT channel and figured the Aergrind by Knock would be a great fit. As the man coffee scientist himself says, the grinder is so good it would’ve blown away any cheaper competition from his other video, so he included it in the premium segment comparison. That was one reason I considered this.
Add Any Directory to project.el’s List of Projects
I am using the built-in project.el
in Emacs to find files in various git-backed projects. But I also have a shared folder of blog post drafts with Sascha at zettelkasten.de that does not have any version control backing. I couldn’t get that folder to show up in project.el
’s list because of that.
Get Your xcode.tips Card Printouts!

Dominik Hauser maintains the illustrated xcode.tips page I’ve mentioned on Twitter here and there because the graphics are just lovely and the tips are really useful to become a proficient user of Xcode. It’s a complex piece of software, and the illustrations capture a tip in a single graphic, with shortcuts and UI hints and all.
Prioritize hl-line Highlight Over Neotree Faces

In hindsight, it looks like my quest to tweak how Emacs looks and feels is to make it more Mac-like. No wonder, because I really like the OS X-era UI. So I’m still using the system default selection highlight colors and want these everywhere.
More Swifty NSAttributedString Attribute Query Methods
NSAttributedString
API takes an NSRange
by-reference. That’s cumbersome to use, though, because you need to initialize a non-nil range, and there you should initialize it with NSNotFound
to indicate an illegal state. Afterwards, you need to check if the range changed to a legal value.
Context Menu in Magit Status Buffers

I’m a very happy user of Magit, the amazing git frontend for Emacs. Today I noticed again that I miss one thing from GitUp, a GUI frontend for macOS, that I use when I’m selecting changes for a commit, discarding experimental file and line changes here and there in the process:
The Playdate’s Docs Are Made with More Love Than Most End Products
Michael Tsai shared a link to the Playdate’s Design Guidelines. The page blew me away. The Playdate is a handheld console that the team at Panic brought to live, and which you can actually buy since late last year.
What’s the Problem With Old But Excellent Mac Apps?
Tyler Hall wrote about “Half-Assed Mac Apps” the other day. His argument goes like this: Catalyst made it easy to deploy iPad apps to the Mac. But iPad apps don’t make the best experience on Mac. Users end up with more apps, but a lot of them being “half-assed” Catalyst ports.
Split Window in Emacs and Resize and Recenter Frame to Make Room

I got an email by reader Andrej this week, asking about ways to (ab)use frame recentering in Emacs so that when a split window is created, the frame would grow to make room. So if you have a frame with 1000px width, and split the window to the right, it should enlargen to 2000px width. And then recenter.
Add Numbers to Emacs tab-bar-mode Tab Titles for Quick Access

For about two months now, I’ve been using tab-bar-mode
in Emacs to have multiple “workspaces” open. I was fine with buffer switching, too. But tab-bar-mode
not only allows you to switch between buffers, but also window configurations – that means one tab will have 1 window with 1 buffer visiting a file, while another might have a gazillion split panes. So the main upside for me is to arrange stuff into panes aka windows, and then open a new tab to do something in a single-pane view.
Copy Dropbox Link to File Using Maestral
Joel Rendall on the Keyboard Maestro forums published a macro collection for Maestral users. Since my switch to Maestro from the macOS native Dropbox app with all its annoying features, there’s only one thing I missed from the Dropbox app – copying links to files in my Dropbox to share them with others. I do this quite often with video recordings for bug reports, I found.
I Uninstalled the Dropbox App in Favor of Maestral
Today I have uninstalled the Dropbox app from my Mac. I’ve been an early Dropbox user and invited friends until I got up to 10 GiB, which was a ton of storage back in the day. But the native apps gets more and more annoying; they have a history of faking system standard dialogs to “trick” you into installing the kernel extension with root privileges; and resource consumption was at times confusingly high. Stuff like that made me tired of the app.
Closing Circe IRC Buffers in Emacs Without Leaving the Room
It’s a hack but it works: To stay in a room (or rather: let the bouncer stay there) and still close the buffer locally, it helps to change the major mode of the circe
buffer: M-x fundamental-mode RET
. If you change the buffer’s mode to any text mode, the circe-mode
specific teardown hooks won’t be triggered and you can close the buffer without leaving the room.