In Emacs Org-Mode, the default key binding to “highlight” or “format” the selection is C-c C-x C-f. This will then ask for the org-mode syntax thingie to use, i.e. */_~=+. Literally, that’s the prompt. So you have to know which character to use to embolden text. That’s *. But which one is code? It’s ~. And = is for verbatim text, while + is for strike-through.
I wanted to show, just this once for this project, the *compilation* buffer in a bottom split. I also wanted the split to be dedicated, so no other buffers would occupy it by accident, and not be deleted (aka closed) when using delete-other-windows. That should be reserved for code buffers.
Some days I forget to run Denote to create a new journal file for the day, and then the appropriately named note file is missing when I want to write down things later. That’s not how you use a daily journal, I know, but I use Emacs and denote.el to write down things like exercise logs or when I get sick, and these are information I can backfill easily the day after.
With the power of outline-minor-mode in Emacs, you can turn any text buffer into an outline – with the killer feature of “cycling”, i.e. folding and unfolding outline elements. This includes rg.el-managed buffers, search results powered by ripgrep.
Today was a day of convergence. Our home server/NAS had a lot of SATA-related kernel errors and drive failures in the past weeks that I couldn’t track down. I replaced the drive and the cables and things have quieted down. This means I was SSH’ing into the server quite a bit this month. Mild data loss ans corrupted file systems included.
I admit: I’ve been relying heavily on ChatGPT to get to grips with some PHP things. Asking for interpretation, alternatives, and PHP 8-specific stuff was a lot of help. I’ve been using this in a separate floating window (aka ‘frame’) in Emacs next to my editing context, and that was great. Until I accidentally closed the buffer and lost the history.
Normally, you’d associate file path extensions with major modes in Emacs via auto-mode-alist. The associative list contains entries like ("\\.html" . web-mode) so that when you open (aka “visit”) an HTML file, Emacs automatically switches to web-mode, which in turns supplies shortcuts and syntax highlighting and so on.
Upgrading to Emacs 29.1 worked like a charm. There’ve been a couple of small neat additions next to all the big changes like native tree-sitter support – and there’s one in particular that you could say I almost hate. When I compose email and decide to discard everything, I’m politely being asked whether I want to kill (aka ‘close’) the buffer and discard all changes. This applies to all other buffers that haven’t been saved, too, but I mostly run into this with email.
Today I learned that you can tell Emacs to use fontsets (or just “fonts”) for specific character ranges. Thanks to Alan at idiocy.org for the explanation! His example is this: Now instead of Emoji, which work fine in Emacs for me out of the box, I want SF Symbols. Yes, again.
The odd title gives it away – I don’t have a good use-case for this :) Dr. Drang shared how he displayed one random line of “Oblique Strategies” in his email signatures many years ago. The “Oblique Strategies” can be found here: http://www.rtqe.net/ObliqueStrategies/Edition1-3.html
New year marks the day Protesilaos releases modus-themes v4 into the wild; and my package update from MELPA already ingested preliminary changes on Friday Dec 30th (much to my chagrin, because I initially wanted to do something else than fiddling with my Emacs setup) that were absolutely not backwards compatible.
Early this year, I shared my setup to get tab numbers in the form of Unicode characters like “⓪”. This week, I reduced the font size in the tab bar to 80% of the main font and make the tab bar stand out less in general. The numbers in circled didn’t look so great then anymore, and the baseline looked off.
In the previous post I showed some settings to manage a tab dedicated to Org Agenda and its related org files. I also mentioned that I didn’t like how that tab was actually handled, e.g. when I wanted to break out into other tabs.
Emacs’s automatic window management is a bit arcane, but Mickey Petersen’s excellent article “Demystifying Emacs’s Window Manager” is full of inspiring snippets. A couple of months ago, I made some tweaks. One is to dedicate a tab to “Org Agenda”. (That’s a tab-bar-mode tab, not a tab-line-mode tab.)
Emacs users sooner or later disable all the GUI stuff, and usually also get rid of system alerts and file pickers. But if you just once want to pick a file using your operating system’s file picker, these three temporary variable overrides will do: If you’re in this situation, you likely already know use-dialog-box and use-file-dialog because you’ve set both to nil globally.
Emacs’s outline-mode only has font settings aka “faces” for 8 outline levels; then they wrap, so level 9 looks like level 1 and so on. org-mode inherits these faces, and thus also only defines 8 styles. That’s more than enough, I believe, to have some visual variety in your outlines and also sufficient distance between repeating styles.
My blog posts here usually have a line like: For tags I don’t use a lot, I sometimes don’t remember how to write them. So I do the only sane thing – and go to my website’s list of tags and look for a match. Got annoyed by that now after a couple of years :)
I used to rely on M-h to mark the structural element in Emacs; in text buffers, that’d be the paragraph, in org buffers, that was the whole outline item (when the cursor was in the heading line, at least). Ever since I installed Emacs for Mac OS X which now is also on Emacs 28.1, this shortcut wouldn’t work for me anymore, because my Meta key is my left Command key, and Cmd-H is the macOS shortcut to hide the frontmost app.
Sometimes I actually do wonder why the Emacs defaults are whatever they are. Someone somewhere decided that clicking with the left mouse button while holding shift should pop up an appearance menu where you can change font size and things like that. The behavior I expected from my personal history of 25 years or so of using computers is to extend the selection up to the clicked point.
Magit binds M-w to magit-copy-buffer-revision. On my Mac, I use the left Command (⌘) key as the Meta key, though, and wired M-x, M-c, M-v to cut/copy/paste, leaving M-w aka ⌘+W to close the current buffer.
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.
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.
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.
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.
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:
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.
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.
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.
A couple of days ago, I did maybe the weirdest and also most amazing thing on a remote machine thus far (with Emacs) and wanted to share the story. So there’s this EmulationStation software that organizes roms with XML lists for metadata. I needed to change the <name> field of about 100 entries there to drop a numeric prefix. That’d be easy on my local computer with tools I know well, but I was accessing the device remotely via SSH and wanted to see what I could do.
The Apple’s Human Interface Guidelines have a list of named system colors for macOS. These color names can be used for Emacs “faces”, i.e. color-and-font settings of text. Recently, this came in handy when Protesilaos Stavrou published his LIN package source code – it’s basically an extension of the built-in hl-mode, read: highlight-line-mode. The default highlights the current line. That’s kind of useful to find your insertion point more quickly. But it’s also used in selection interfaces to highlight the currently selected line: email modes like message-mode, notmuch, mu4e, and feed reader elfeed use this to show that the actions you can perform pertains to the currently focused or highlighted line. That’s where Prot’s LIN package comes into play: it helps distinguish between highlighting the line in text editing modes and highlighting the line in selection interfaces, so you can use different colors.
I’m having all my project in git repositories. And since I discovered the magic of Magit in Emacs, I sometimes want to have a familiar, interactive interface to select hunks for a commit without having to fire up a proper GUI app for stuff that I don’t already edit in Emacs.
In my previous post, I shared a function to fetch macOS Finder’s frontmost window path using AppleScript. The result was then opened in dired so you can import your Finder session into Emacs, so to speak.
Quite often I have a directory open in macOS Finder that I want to open in Emacs dired, e.g. to mass-rename files, copy stuff to a remote machine via SSH, or what have you. In my last post, for example, I used Gifox to create a GIF and then viewed the result in Finder. To add the GIF to my blog post, I needed to copy it over into the appropriate website project directory. Since I was writing that post in Emacs already, I wanted to quickly copy the file from my Downloads folder (my default scratchpad for output like screenshots and screen recordings, including GIFs) over to the blog post’s location.
I’ve enabled using the macOS system trash in Emacs to feel safer experimenting with dired and other file manipulation functions in Emacs. This enables using the trash by default: When this is enabled, move-file-to-trash is used to delete files. The manual reveals what’s affected, but only the function API docs from within Emacs tell the whole story (and are super hard to search online for whatever reason):
Fellow Emacs-user Göktuğ Kayaalp condensed my frame centering stuff into one function as I mentioned one could do, and then improved it by adding a condition for full-screen frames. This is probably the last post on this topic, ever, because what else could be said. Right?! It’s so nice, I want to share the code, reformatted a bit. And Göktuğ didn’t add the binding of frame to selected-frame as a fallback, so I added that back in, plus longer docs.
When centering my Emacs windows (aka ‘frames’) on my monitors, I noticed that with 2 monitors active, the computation doesn’t work: It doesn’t center in the main monitor; it centers in the area of both monitors combined. That’s not what I want.
When I open a new GUI window of Emacs on macOS (which Emacs calls frame) it’s positioned in the top-left corner. Since I have an ultrawide monitor at my desk, that’s pretty annoying. Unlike regular macOS apps, Emacs doesn’t remember where I dragged the last NSWindow to, so it doesn’t spawn new windows next to that. It also doesn’t stagger them like NSDocument-type apps usually do.
In some modes in Emacs, the hl-line (‘hl’ for ‘highlight’) is used. That’s not intended to highlight the current line when you edit text; it’s used for things like feed readers and email, where you operate on items that are represented on lines. This highlight is way too subtle for my taste.
This week, I seem to have a lucky streak in terms on Emacs customizations. I use Emacs to read and compose most of my email, using the excellent notmuch CLI tool and its accompanying Emacs package. I also really like Protesilaos Stavrou’s modus-themes in both light and dark mode.
In a Discord chat, we’ve recently talked about how well funding for Blender turned out. At the time of writing, they get $137k per month for development. I cannot say if that’s enough or too little. But it’s not nothing. Being crowd-funded comes with its perils. Especially with free open-source software like Blender, developers tell that it’s not easy to know which user base to focus on, which UI/UX compromises to make, and how to figure out if the project backers are satisfied with the result.
I asked Xah Lee for feedback on my case changing functions. He’s fluent in Emacs Lisp, so I figured if he wanted to, he would’ve used my approach years ago. So there must be something I miss. The factoring of the small helper functions don’t seem to be bad, but there are other reasons to design the text editor you use every day in one way or another:
At the moment, I’m proof-reading and editing the book manuscript of my pal Sascha for the new edition of the Zettelkasten Method book. As with most things text these days, I’m doing that with Emacs. Something that continually drives me bonkers is how Emacs handles upcasing, downcasing, and capitalization of words by default. The functions that are called for the default key bindings are upcase-word, downcase-word, and capitalize-word. These sounds super useful to fix typos. The default behavior is odd, though: They only change the case of the whole word when you select the word first. Otherwise they change the case of the remainder of the word beginning at the character at the insertion point. The docstrings say as much: “Capitalize from point to the end of word, moving over.” Why?
In Emacs org-mode, you start with two states for your outline headings by default to manage tasks: TODO and DONE. I recently introduced a new state in between: DOING. That helped me come back to stuff I had to let lie for a while. In code, that means at least: I actually have multiple sequences, but these don’t matter for this demonstrations.
I’m a fan of linking into my Zettelkasten. I usually do this via a convention: when a 12-number digit is used to signify a timestamp with accuracy to the minute, like 202102101025 for 2021-02-10 10:25, then I expect this to be a note identifier in my note archive. When the timestamp is accurate to the second, I expect this to be something else outside my note archive, like invoices I filed away. To utilize this information, in the worst case, I have to copy the ID and paste it into Spotlight to get to the note.
In this post, Protesilaos answers an email by one of his readers. In the email, the sender seems to assume that Emacs is bloated by definition, and that e.g. Vim isn’t, because it comes with less stuff baked-in and works well with piping – the core way to compose in *nix command lines.
The sender asks:
This video [of Luke] really provide some good reasons why to invest on ‘coreutils’ to build a small, maintainable and decentralized system rather than investing on a giant mutable system.
Emacs being the giant, mutable system, and the pipe-able Unix command-line tools comprising the “maintainable and decentralized system”. (That way of asking is loaded with assumptions already.)
Prot does a very good job at not preaching, and actually bringing forth useful arguments.
Vim has a lot of stuff built-in, like a terminal emulator, and isn’t that different from Emacs in that way. (Plain vi is a different beast.)
Prot treats Emacs “as a layer of interactivity on top of Unix”. That’s a very good description, I think.
There is non-negligible overhead in composing a system of many independent pieces. You end up writing a lot of glue code, so to speak. (And it can be rather brittle.)
Emacs ties things together into a coherent software where you can share stuff between pieces of functionality easily. You can copy from the Emacs shell and paste in a text buffer. You can perform mass text replacement from a UI you already know instead of having to learn syntax. (Opposed to sed/awk/…)
In closing, Prot points out that the underlying issue can be binary thinking (which is rather limited and avoids entertaining opposing opinions):
This hints at the kind of thinking that treats the world in simplistic, binary terms: Unix is simple VS Emacs is complex; Arch Linux is for hackers VS Ubuntua is for simpletons… Those are stereotypes that rest on misunderstandings about the intent and the purpose of each of those paradigms, their context-specific pros and cons, as well as the potentially numerous reasons one may have to opt for a given choice.
Worth a read during this time “between the years.”
I played around with Nicolas Rougier’s NANO Emacs configuration because it looks so hot and I wanted to try some of his tasteful settings myself. One thing that let me down for a couple days since I started eyeballing the package was performance. In my huge org files to organize app development tasks, scrolling was so-so. Pixel scrolling, which I discovered through Nicolas’s configuration ((pixel-scroll-mode +1)), didn’t work at all on my machine. I have a MacBook Pro 13” from 2020. This is a text editor. Something’s not right with my config.
I somehow found Abin Simon’s post about how he made pasting text in his Emacs “pulse”, aka temporarily highlight the pasted region. In Emacs parlance, pasting is called “yanking”. His post sadly covers only one use case: Emacs with evil-mode, which adds vim keybindings and apparently also adds a special evil-yank command in place of the regular yank.
I installed Treemacs the other day and found out, to my excitement!, that you can not only hit TAB to expand folders, but also to expand files! When you “expand” a Markdown file, you see its headings in the file explorer. That is bonkers, and so useful for larger writing projects to get a unified overview!
If you have no dignity (like me), you might enjoy displaying emoji in Emacs. I actually really like that when composing/reading email, and when I want to add colorful stuff like stars in my to-do lists. There’s this package, emacs-emojify, you might want to check out. When you install the package, it will download EmojiOne images by default. You can set up your own, and I found the OpenMoji set to look very nice. Clear lines, crisp shapes, very recognizable expressions in big and small sizes. Love it.
During app development, I track the tasks in an org-mode task list. And I track the stuff I finished and want to highlight in the release notes in a Markdown block right there. When I release an update, I’ll copy & paste the Markdown part to the “Release Notes” of the app and push the changes to the server online.
This week I noticed that a ton of files like *message*-20201029-134012 piled up in my home folder. These are email drafts from message-mode, and the numbers are a date-time-stamp. These didn’t appear ever before. So I figured it might have something to do with autosaving after looking at the change history of my configuration file – and it sure does.
Some commands in Emacs and its various packages are destructive. They require a confirmation by the user. These usually use yes-or-no-p, which won’t complete the command until the user replies by writing “yes” and then hits enter, or “no”, or aborts the command with C-g. Some of the commands that require confirmation in this way are overly protective, I find. Like projectile-kill-buffers (C-p k) which closes all open buffers for a project at once. I use this heavily when e.g. editing my website: jump into the project, edit a file or two, commit, then leave. I don’t want to type “yes” and hit enter just for that. (Please note that killing a buffer this way will still ask me if I want to save or discard changes, so the kill command alone is not destructive.)
I noticed that I still had the journaling app Day One (macOS) on my computer. I haven’t touched it in ages. So I figured it’d be time to export to plain text and then shove all the goodness from 2004 and onward into my Emacs org-mode diary.org. Turns out there’s no Day One to org-mode exporter.
No matter if you use exec-path-from-shell or not, Emacs will not be able to know your RVM-managed Ruby information. This drove me crazy. Most Emacs shell commands are invoked in an “inferior” mode, aka a “dumb” shell. This includes M-!, M-x shell, and also the projectile compile commands. That’s when some of your user login scripts will not automatically load, like the entirety of rvm, the Ruby Version Manager.
Emacs comes with a lot of stuff out of the box, but I was missing TextMates “Insert Entity” action that lets me search through HTML entities by name and then insert &quot; or &trade; for me. I can never remember the names of typographic quotation marks in German, for example.
When you delete a character or the current selection, you usually hit C-d (Control + d) in Emacs. I got into the habit of revising drafts by deleting whole words, and the M-d (Meta + d) key combination is super useful for that. It also works into the other direction with backspace. It’s essentially the same effect of ⌥+backspace everywhere else in macOS.
This is week two of the COVID-19 lockdown that led to #IndieSupportWeeks to help independent developers get a shoutout and maybe find a couple extra customers.
beorg is a bit weird. It’s basically a task manager and calendar, but based upon plain text files that I sync via Dropbox. It’s not a particularly user-friendly application, and its UI didn’t win any prizes, unlike e.g. Things or OmniFocus (I’m often confused by the app icons and lack of labels, but also glad because my iPhone 5S screen is so smol). So why did I pick this app, then?
beorg is a mobile companion for my Emacs org mode files. It’s capable of handling org mode outlines, and parts of these outlines can be tasks or TODOs, and you can group them in projects, and then display an overview or “Agenda” – and things get out of hand quickly from there. Emacs is ridiculously customizable, and org mode is no different. beorg makes these information available on mobile.
So since over the years I moved from OmniFocus 1 to Things to OmniFocus 2 to Emacs, I got used to viewing tasks on my mobile phone and iPad; and I really much like the capability to capture information on the go. A piece of paper will do most of the time; but having a web clipping synced to my computer directly is nice.
You can even write Scheme scripts inside beorg! I haven’t touched that topic at all. The REPL (yes, it has a REPL!) provides a sandbox for experimentation, and by convention beorg will load and run init.org file from your list of files right after bootstrapping. You can even customize the app’s UI with this. Writing org files that auto-execute during launch to customize the behavior of the editor is a long-running theme, see this random example (source).
Regarding the business model: most stuff is free, and the free version will get you really, really far. You currently can buy access to additional features:
“Properties” will let you add custom key/value pairs to any item; it’s mostly a UI affordance for the plain text underpinnings
“Encryption” to, well, encrypt your items or files
“Task Timers” to track how long you work on a task (ahem, I suggest an automated service like Timing for that; note: this is an affiliate link)
“Export Themes” are CSS styles to generate HTML from your outlines because, well, org mode is supposed to be a structured markup language for HTML and LaTeX export and such thing
“UI Themes” for Solarized and additional dark modes in the app
“Saved Searches” to more quickly access the results of complex searches
“Box Sync” to … sync to Box.net (beats me why this of all things is an add-on)
The developer provides release notes for updates in the app, which I absolutely adore for this kind of “make it your own” pro user application, to make sure I keep up-to-date with the good stuff. The tip jar that goes along with it is probably the main source of his income – at least as much as I’m concerned. The updates are really good and much appreciated.
I don’t show a clock on my computer. Sometimes, I quickly want to find out what time it is, though. I often run date from the shell to get the current time, and can often get there in my Quake console-like iTerm 2 Hotkey Window by pressing the “up” key since I seldom use the Hotkey Window for anything else.
Emacs is a text editor, kind of. But I use its Org mode for “keeping notes, maintaining TODO lists, planning projects, and authoring documents with a fast and effective plain-text system” – its Agenda became my daily productivity hub. It’s a calendar view of all things scheduled for the day, plus some other info interspersed: thanks to the plain text nature of the whole interface, it’s simple (albeit not easy) to re-style everything you see there. Add sub-headings, spacing, links, text, what have you.
By accident I found a setting for emacs windows that prevents a window from displaying any other content than what it currently is showing. It is not locking the textual contents but the buffer. That means you cannot show the contents of another file, or change the currently visible help page, or whatever.
Emacs can display interactive help windows (the content/buffer name is called “*Apropos*”), and compilation results. I managed to limit the height of the compilation window to 10 lines already. But when I have the compilation results pane focused, I want to close and dismiss it quickly.
The project that I’ve been working on over the weekend, I worked on in emacs. This is part of my re-learning the basics of text editing and programming in emacs to slowly move away from TextMate when it comes to scripts. I want to move away from TextMate because I eventually want to transition to be productive on a Linux machine – that means, to create stuff in an otherwise foreign operating system. Emacs is portable, so that’s a good start.
There’s no standard shortcut to fold the current subtree of an org-mode outline. When I work in org-mode outlines, I usually am 3 or more levels deep into a so-called “subtree” and want to get back to the root item, fold it to hide the details, then drill down into another item. I use that when I am working on an app and want to have a look at a planned milestone nested deep down at a different point in the outline.
I am using Emacs for over a year now to manage my tasks. I like how I can mix tasks with long form notes in a single outline. It’s good. We had to play with vi and emacs for a while at University. I’m very happy I got used to the very basics of both editors because I ended up using vi a lot when SSH-ing into remote machines, and now Emacs for everything else.
I use beorg on iPad/iPhone to view my Emacs Org files. Until today, I did use it only for viewing files, not edit tasks, because I ran into sync conflicts. This is how I solved the problem with a few simple settings. First, put your org files into the Dropbox. I have all .org files in one directory and use the directory as org-agenda-files:
In my quest of total immersion into Emacs, I am trying to write blog posts in Emacs instead of TextMate. That means my TextMate macros are gone for good, including insertion of YAML header information. On this very blog and on Zettelkasten.de, I used to type cthead and zkhead respectively, then expanded the YAML header with tab. TextMate’s great template feature even allows you to specify multiple points inside the templates to jump to by tabbing forward. Emacs works a bit differently, so I adapted the templates to request information up front instead and fill in the values.
I noticed that my Emacs didn’t maintain the current line’s indentation when editing code blocks in Markdown (markdown-mode). I indent the first line with 4 spaces like any sane person would. When I hit enter to continue in the next line, thanks to the markdown-mode defaults, I am presented with a new line that’s properly indented visually. Only when committing to git did I notice that Emacs inserted tabs instead of spaces. Gasp!
I am using GNU Emacs for a while now to do all kinds of stuff. I’m thinking about migrating away from OmniFocus as my task manager and use Org mode instead. What I like so far is the free-form list nature of Org files. I can have an outline of notes and sprinkle TODO items inside them. This way I can take notes on puzzling problems I’m working on and mark things I need to do later. This is super useful to remind myself what to clean up before a commit, for example write or amend tests or remove debug code somewhere. I like it. I got used to a lot of shortcuts already, so most of the pain of daily use is gone.