The weather’s getting warmer, so what better time to take a trip to the hottest place in the universe — Fresh AI Hell! Emily and Alex take a spin through more than 30 hype artifacts, with topics including medicine, data centers, and fake people.
"Ian Smith": 'nuff said, excellent, amusing, don't miss
What a week it's been for the Prime Minister. In the aftermath of seismic local elections results, there's been non-stop Labour party in-fighting. Wes Streeting has resigned as Health Secretary so the race for Labour leader is seemingly on - who will throw their hat in the ring? Will Andy Burnham, i.e. the King of the North, make his move? In other news, the panel discuss Trump's state visit to China and why the Royal Navy has to redesign women's uniforms over 'inappropriately placed' buttons.
Helping Andy make sense of it all this week is Nish Kumar, Ian Smith, Katy Balls and Mhairi Black.
Written by Andy Zaltzman.
With additional material by: Alex Kealy, Ruth Husko and Claire Rammelkamp
Producer: Georgia Keating
Executive Producer: Richard Morris
Production Coordinator: Asha Osborne-Grinter
Sound Editor: Marc Willcox
Recorded by David Thomas
pullquote (heavily edited): > [[org-remark](https://github.com/nobiot/org-remark) anchors notes in targets] by highlighting the passage you’re [annotating. The] position of that highlight and its associated notes are kept in a separate Org file with [metadata pointing back to the target. Org-remark] comes with builtin support for several document types but Holland says that it’s pretty easy to add others and that in fact he’s added them for Elfeed, PubMed, and Wombag. The major shortcoming that I can see is that [org-remark doesn't support PDFs, though [org-noter](https://github.com/org-noter/org-noter) does.] [Holland’s post](https://www.chiply.dev/post-annotate-in-place) includes an 18 minute, 15 second video that demonstrates org-remark and provides a nice overview of the post. The post itself is long and comprehensive.
Charlie Holland has a very interesting post about annotation in place. The idea is to take notes on digital content the same way you would if your were marking up a book or a physical paper. The important thing is that you don’t want to suffer a context switch disruption by switching to another app to take your notes and you want those notes to appear (even years later) when you revisit the file. A secondary consideration is that you want to be able to go not only from the text to the notes but also from the notes to the text.
There is—as we Emacsers always say—an Emacs package for that. That package is org-remark. It does its magic just as you’d expect. The notes are anchored in the text by highlighting the passage you’re writing about and the position of that highlight and its associated notes are kept in a separate Org file with enough meta data to get back to the original document.
The package comes with builtin support for several document types but Holland says that it’s pretty easy to add others and that in fact he’s added them for Elfeed, PubMed, and Wombag. The major shortcoming that I can see is that PDFs aren’t supported.
Holland’s post includes an 18 minute, 15 second video that demonstrates org-remark and provides a nice overview of the post. The post itself is long and comprehensive.
The org-remark package seems like a nice app that could be a big help for those of us that like to take notes as we’re reading. I could see myself using it to take notes on Web pages that I want to write about for Irreal. If it seems like it might be useful to you, take a look at Holland’s post.
Update [2026-05-21 Thu 13:48]: Added link to Holland’s post.
VERY EXCELLENT, very detailed esp re Israeli hasbara (as well as USCFM)
The Turbulence crew returns to discuss the state of the Iran War, including potential escalations and Trump taking possibly the first real L of his entire political career. We also talk about the horrifying Nicholas Kristof story about rape in Israeli prisons, discuss AOC vs. MTG, and then close things out on a lighter note with a Wall Street Journal op-ed about how China doesn’t have babes.
Recorded on Friday morning, Andy and the panel dig into the election results from 7th May. Who’s done well? Who’s done not so well? And how does this have anything to do with The Grand National? Also up for discussion is The Met Gala and the legend that is Sir David Attenborough’s 100th birthday.
Written by Andy Zaltzman.
With additional material by: Mike Shephard, Cameron Loxdale, Stephanie Kemp and Angela Channell
Producer: Georgia Keating
Executive Producer: Pete Strauss
Production Coordinator: Asha Osborne-Grinter
Sound Editor: Marc Willcox
Recorded by Jerry Peal and Jon Calver
A year into the Great Recession, one film was brave enough to ask, "But what about the corporate consultants?" We discuss Jason Reitman's onetime critical darling UP IN THE AIR (2009), a film that invites us to have sympathy for the downsizers.
Join us on Patreon for an extra episode every week - https://www.patreon.com/michaelandus
you probably guessed, but, JIC: ICanHazShortcut is Mac-only
I’ve been using ICanHazShortcut for years. I originally started using it to have an easy way to switch to Emacs from anywhere in my system. Eventually, I added Safari and HomeKit to the list of apps I can invoke with a simple keypress but most of my ICanHazShortcut shortcuts are Emacs related. For example, I have F9 mapped to Emacs capture so that I can invoke any Org capture template from anywhere on my system. That’s really handy and I use it several times a day. I also have a shortcut to invoke Emacs Everywhere so that I can escape into the comfort of Emacs when entering data in some other app.
Today (Sunday, as I write this) I received a notification that a new version of ICanHazShortcut was available. It’s completely rewritten in Swift from Basic and has some new capabilities. You can read about them at the above link. For me, not much has changed. The new version continues doing what ICanHazShortcut has always done.
ICanHazShortcut is a minimal app that simply provides a shortcut for any command that you can specify in the terminal. There are plenty of more full featured key mappers available that may be better for more complicated situations but I find ICanHazShortcut perfect. It’s light weight and easy to configure. I almost never mess with ICanHazShortcut’s configuration. The last time I changed it—to add HomeKit, I think—was years ago. It truly is a set it and forget it app.
If you want a simple app for invoking Emacs—or anything else—in various ways, take a look at ICanHazShortcut; it’s worked very well for me.
I couldn't get past the 1st few minutes: the guest/author is one of these extreme anti-Soviet Trot-types, which makes me suspect that the rest of this interview is highly unreliable :-( /Euraknot/ seems to be very much going down the anti-Putin/anti-USSR/pro-US-empire ideological (try to keep this "clean") hitshole
In August 1924, a group of rebels organized by the anti-Bolshevik Committee for the Independence of Georgia and led by the Georgian Social Democratic Party, rose up against Soviet forces in the mining town of Chiatura. The Bolshevik reaction was swift and harsh. The fear of another "Kronstadt” still haunted the Bolsheviks, especially since their control over Georgia was tenuous. The uprising failed. Thousands were killed. Its ringleaders either fled into exile or were executed by the Georgian Cheka, then led by Levrenti Beria. The uprising was the culmination of Georgian opposition to Bolshevik rule after the fall of the Menshevik-led Republic in 1921. This small but significant story about Georgian resistance and a social-democratic alternative to Bolshevism has remained in obscurity. That is, until Eric Lee came along. Eric is a passionate partisan for Georgia. Not just for the place and its people. But for the promise that early Republic and its Menshevik leaders represented for the history of social democracy. What were the roots of this uprising? What was Bolshevik rule in Georgia? And how does the Social Democratic Republic and the August Uprising fit into today’s memory politics in Georgia? The Eurasian Knot spoke to Lee to get a fuller story behind this almost forgotten moment in the history of Georgian resistance to Russian rule.
Guest:
Eric Lee is an author, journalist and historian. He’s the author of several books. The most recent is The August Uprising, 1924: The Georgian Anti-Soviet Revolt and the Birth of Democratic Socialism published by McFarland Publishers.
Keep your eyes peeled for Season 2 of Welcome to the Crusades, our crossover series with Eleanor and Luke, coming soon. For now, enjoy Season 1.
Happy Mother’s Day! Danny and Derek reunite with Eleanor and Luke of We’re Not So Different to talk about the life and legacy of Eleanor of Aquitaine. They discuss Eleanor’s power and wealth, her marriage to Louis VII, the Second Crusade, her relationship with Henry II, failsons Richard and John, her several success daughters, political influence, patronage of troubadours, courtly love, and Eleanor’s place in medieval and popular memory.
VERY EXCELLENT political-cultural humor, good crowdwork
This week, Geoff looks at the “angry middle-aged white men” that Gary Neville identified as the source of all division within the UK. Is that fair? If so, why are they angry? And could there be both a deeper reason for their anger and also a better outlet for it?
As ever, these serious points are intercut with “manly hypotheticals”, the sort of question men ask each other to avoid talking about stuff that matters, like - if you’re drinking non-alcoholic beer, are you still obliged to buy a round?
This is episode 2 of Series 2 of Geoff Norcott's Working Men's Club. To hear more from this series, search "Stand-Up Specials" on BBC Sounds.
Written and presented by Geoff Norcott
Recorded by Sean Kerwin
Production manager: Dawn Williams
Executive producer: Caroline Raphael
not sure why they're omitted from the episode notes, but this week's guests are Ashley Storrie, Vittorio Angelone, Simon Evans, and Cindy Yu
This week you’re all cordially invited to join us for King Charles’ state visit to Donald Trump’s White House. Please dress to impress. We’ll also be digging into the state of the nation ahead of the upcoming elections on 7th May. Plus, what do we think about MPs drinking at work?
Written by Andy Zaltzman.
With additional material by: Matt Hulme, Eleri Morgan, Joe Topping and Angela Channell
Producer: Georgia Keating
Executive Producer: James Robinson
Production Coordinator: Asha Osborne-Grinter
Sound Editor: Marc Willcox
Jonathan Chu is a software engineer and Emacs enthusiast who’s been looking for a note taking app that he can actually use. He’s tried all the usual suspects but found them too opinionated for his liking. He wanted to work in Emacs and write his notes in Org mode but none of the existing packages were quite right. So he did what Emacs users always do when things don’t work exactly as they like: he wrote an Emacs package do things the way he wanted. The result was grove.
Chu says that Grove was informed by his experience with Obsidian. I’ve never used Obsidian so I can’t comment on that aspect but Chu says that Grove is Obsidian-like. The only external dependencies are ripgrep, Graphviz if you want the graph view, and Consult if you want the enhanced search capability. One of his goals was to have an easily installable and configurable package.
It looks like a pretty nice package if you’re looking for a note taking method with a bit of but not too much structure. I use Org mode for all my note taking across many dimensions and have never felt the need for a more organized approach. Sure, sometimes I think about using Denote or Org Roam but—for me—they never seemed worth the effort. Many others disagree, of course, but Emacs has a home for us all,
Take a look at his post or the Github repository for the details and a bit more on how things work.
Will, Felix, and Alex take a break from the news this week to answer some Dear Prudies! We answer questions about nude dogsitter, several bad parents, an old swinger couple with a bedroom dilemma, and a man who is cartoonishly afraid of eating pussy. Really gross episode honestly, girlfriends beware.
Follow Alex on Twitter: x.com/@Lowenaffchen
Check out his show Fortune Kit: https://www.patreon.com/fortunekit
And watch ChapoFYM: https://www.twitch.tv/chapotraphouse
Donald Trump boasted that the US government acts "like pirates", seizing Iran's ships and oil. "It's a very profitable business", he said. Meanwhile, Beijing is openly resisting Washington's sanctions against Chinese companies for trading with Iran. China has ordered all domestic firms to ignore US sanctions. Ben Norton explains these geopolitical developments.
VIDEO: https://www.youtube.com/watch?v=vfB8xQEZolk
Topics
0:00 (CLIP) Trump: "We're like pirates"
0:14 US blockade of Iran
1:11 (CLIP) Trump on US piracy
1:57 US seizure of Iranian ships
2:43 AI memes of Trump as pirate
3:01 Multiple acts of US piracy
4:09 Venezuela
5:06 (CLIP) Trump on stealing oil
5:30 Pirates of the Persian Gulf
6:31 US sanctions on China
8:42 Hengli plant in Dalian
9:23 China challenges US sanctions
10:49 Secondary sanctions threat
11:38 USA crossed China's red line
14:17 US sanctions 1/3rd of world
14:47 Map of US sanctions
15:00 Sanctions are very deadly
16:21 Blockade of Cuba
17:19 US empire's goal
17:59 New sanctions on Cuba
19:02 Chinese solar panels help Cuba
19:47 Blowback: US sanctions backfire
20:45 Outro
excellent, informative esp regarding how US remains net importer of /crude/ oil
Oil has been at the center of the war on Iran. Ben Norton explains how the United States became the biggest oil producer on Earth, and how the US empire uses petroleum as a geopolitical and economic weapon, pushing for monopolistic Big Oil corporations to dominate the global market. Ben also discusses why Trump pressured the UAE to withdraw from OPEC, and he debunks the myth that the USA is "energy independent".
VIDEO: https://www.youtube.com/watch?v=gh-E3q6tGEw
Check out our related video on the biggest oil crisis in history: https://www.youtube.com/watch?v=bUdyPJM_rOw
Topics
0:00 Iran war and oil
0:36 Petrodollar
1:52 USA is biggest oil producer
3:39 US oil exports increase
4:32 Oil price skyrockets
5:03 Corporate profits rise
5:37 Strait of Hormuz
6:30 UAE withdraws from OPEC
7:31 Abraham Accords
8:37 OPEC history
9:14 Seven Sisters: Big Oil
11:01 OPEC members
12:13 OPEC+ participants
13:18 Goal of OPEC
14:25 State-owned oil companies
15:12 Why USA dislikes OPEC
16:56 Oil is political
17:18 Venezuela economic war
19:06 Big Oil execs in US govt
20:55 Cuba oil blockade
22:29 Energy and food crisis
23:36 US "energy independence"
25:06 US oil imports
26:12 Types of crude oil
27:26 US oil refineries
28:47 US imports by country
30:36 Oil benchmarks
32:47 Oil futures market
33:53 Price predictions
36:04 Economic crisis fears
37:02 Outro
moderately amusing, surprisingly tame--Chaponda subpar, OK but fails to carry the load
Some hot topics of conversation this week include the ever evolving Peter Mandelson vetting saga, phones being banned in schools and robots who can take over the world... sorry robots who can take over sports. Helping Andy make sense of it all are Daliso Chaponda, Catherine Bohart, Hugo Rifkind and Ria Lina.
Written by Andy Zaltzman.
With additional material by: Jade Gebbie, Christina Riggs, Henry Whaley and Angela Channell
Producer: Georgia Keating
Executive Producer: Richard Morris
Production Coordinators: Asha Osborne-Grinter & Caroline Barlow
Sound Editor: Marc Willcox
The United Arab Emirates announced on Tuesday it will leave OPEC effective May 1, ending its membership in the oil cartel that dates to 1967 and removing the group’s third-largest energy producer.
Drop Site’s Ryan Grim, Sharif Abdel Kouddous, and Maysa Mustafa discuss the implications of the move.
They are also joined by Jacquline Sweet to discuss her latest investigation revealing the highest paid employees of the Israeli group running the infamous doxxing site Canary Mission.
And as Israeli attacks on Lebanon continue with daily airstrikes, shelling and demolition in the south, NYU journalism professor Mohamad Bazzi joins to discuss Israel’s 50-year war on Lebanon, Hezbollah’s increasing use of fiber optic FPV drones as a tactic of asymmetric warfare, Israel’s campaign of destruction and erasure in southern Lebanon, and more.
This week, the Iran War will reach its official 60-day mark. That’s a critical deadline under the War Powers Resolution, a Nixon-era law created to limit presidential war-making.
Under that law, President Donald Trump can claim a one-time, 30-day extension, so the Iran War will likely continue. But the War Powers Resolution also gives Congress a secret weapon to end this unpopular war — or any war — whenever it wants. So why has Congress never used it?
In this special episode, David Sirota tells the wild story of how a Kenyan-born immigrant and a Ralph Nader-aligned lawyer unwittingly expanded the powers of the president — and left Congress believing that it’s powerless to stop unauthorized wars.
Note: This bonus episode marks the start of our midseason intermission for Master Plan: The Kingmakers. We’ll be back this summer with the remaining four episodes. Until then, please become a paid subscriber to keep receiving bonus episodes, updates, and more.
I previously wrote about useful Emacs commands for reading. This allowed me to use j and k to scroll the window up and down instead of going forward or backward a line.
I am now using meow for my modal editing needs and have been really happy with it. Meow allows for custom states to be defined, but I have been using a different method recently that takes advantage of the built-in normal and motion states.
Meow has a very clever design choice in that when a key is pressed it can translate it to the default emacs binding and call it via a macro. Below is an example of the function meow-next, which I have bound to j. It essentially just executes the key-binding that is stored as the value of meow--kbd-forward-line which happens to be C-n.
(defun meow-next (arg)
"Move to the next line.
Will cancel all other selection, except char selection.
Use with universal argument to move to the last line of buffer.
Use with numeric argument to move multiple lines at once."
(interactive "P")
(unless (equal (meow--selection-type) '(expand . char))
(meow--cancel-selection))
(cond
((meow--with-universal-argument-p arg)
(goto-char (point-max)))
(t
(setq this-command #'next-line)
(meow--execute-kbd-macro meow--kbd-forward-line))))
(defvar meow--kbd-forward-line "C-n"
"KBD macro for command `forward-line'.")
Because meow’s keyboard macro commands are all stored as variables, it is easy for us to overwrite them locally. In the following example I will show how I made a minor mode that lets me have a more enjoyable reading experience.
Firstly, we need to bind the new functions to some obscure key combination. I chose to add these to the global keymap in this case as I want them available across a variety of major-modes.
Then I wrote functions to toggle between the original values of the meow–kbd variables and their overrides.
Finally, I defined a minor mode that can be added to a major-mode’s hook.
The reason that I prefer this to making a whole new “reading-state” is that this is still using meow’s default motion-state. I get to take advantage of all of the default key-bindings. One of the reasons that I moved from evil to meow was that I was getting tired of having to bind so many functions myself. With this method, I can essentially say “I want this mode to behave the same as all of the others, just with one or two changes”.
I am also working on a minor mode for lisp modes that takes advantage of smartparens to hopefully create a lispy like environment, but that is still a work in progress.
VERY EXCELLENT: HP @ 3rd mic helps deliver some GOAT Chapo (analysis /and/ humor)
Streamer and international man of controversy Hasan Piker joins us to recap and analyze Saturday’s assassination attempt at the White House Correspondents’ Dinner. We talk about the radical-centrist shooter, the diverse cast of assassins we’ve met since that fateful day in Butler, and the cast of Chapo all-stars at the dinner itself. Plus: more talk about the media blitz against Hasan, and reading series from the Wall Street Journal and Dylan Byers.
Our 10 year anniversary merch is ready for pre-order through April 30! Order at https://chapotraphouse.store/
Excellent (necessarily thin but broad) survey of 1920s US. Note however that Dave and Justin do /not/ in this episode (as advertised above) get to Garvey and the KKK revival--Prohibition is the last major topic in this audio
A little bit of everything as we take two hours to start to paint a picture of Interwar America.
enjoyable dragging of /Da Vinci Code/ writing, acting, directing, and the franchise generally
We once again travel back to the dark heart of the Bush era by discussing one of the biggest cultural events of the 2000s. Ron Howard's THE DA VINCI CODE (2006) adapted Dan Brown's turgid bestseller into an even more turgid blockbuster.
Join us on Patreon for an extra episode every week - https://www.patreon.com/michaelandus
In this News Brief, we talk with A. J. Bauer, assistant professor at the University of Alabama, about his new book," Making the Liberal Media: How Conservatives Built a Movement Against the Press". In our discussion we break down the corporate and ideological forces that shaped the popular idea mainstream media was crawling with fifth columnist agitators hostile to the values of Real America.
EXCELLENT review of some text-folding (/not/ just code-folding) issues and means (including cut'n'paste-able config code for your init.el. Pullquote (heavily edited):
> The primary drawback of [text] folding modes is inconsistency. For example, hs-minor-mode and outline-minor-mode use entirely different functions and keybindings to perform the exact same logical action. The solution is [author's] package [kirigami](https://github.com/jamescherti/kirigami.el), which acts as a universal frontend for text folding. You define your keybindings once, and kirigami automatically detects the active folding and routes your commands to the appropriate engine.
> A [text] folding backend is the underlying engine that handles the logic of identifying and hiding specific blocks of text. NOTE: When configuring folding backends, ensure that only one folding minor mode is active concurrently in a single buffer, as conflicts and unexpected behavior may occur. For this reason, adding folding hooks to broad categories like prog-mode-hook or text-mode-hook is discouraged. Instead, hooks should be applied specifically to individual language modes, such as emacs-lisp-mode-hook.
Navigating large source files containing thousands of lines of code with Emacs makes it difficult to perceive the underlying structure. For a software engineer spending the majority of the day reading and writing code, reliable folding is a requirement for maintaining focus and managing complexity.
Before we dive in, please consider sharing this article on your website/blog, Mastodon, Reddit, X, or your preferred social media platforms. Sharing it will help fellow Emacs users discover better ways to manage code folding.
In this article, we explore:
A folding Frontend: Consolidating folding commands into a single, predictable keymap that operates consistently across all code folding modes.
Folding Backends: Ready-to-use hooks to activate the most effective folding backend for the following major modes: C, C++, Java, Rust, Go, Python, JavaScript, TypeScript, Emacs Lisp, shell scripts, Lua, Haskell, YAML, Org-mode, Markdown…
Editor Integration: Using indirect buffers to maintain independent folding states, configuring search operations to strictly ignore folded text, and setting up display-line-numbers-mode…
Discouraged Folding Engines: A review of legacy or poorly performing packages to avoid.
Why code folding?
Code folding is about managing cognitive load, preserving spatial memory, and controlling screen real estate:
Navigating through code (e.g., with LSP) can create a vacuum of context. Folding an entire file to its top-level headings allows the manipulation of the file skeleton directly in the main buffer. Revealing only a specific entry and its parents provides an immediate understanding of the hierarchy without losing position.
When tasked with debugging a 20,000 line legacy file, immediate refactoring is rarely an option. Folding enables the visual modularization of massive files on the fly, making hostile codebases readable.
Every visible line of code on the screen requires a fraction of subconscious attention to ignore. During debugging sessions, folding adjacent functions or complex implementations acts as a visual garbage collector.
Moving or deleting a massive function or block is prone to selection errors. When a block is folded, it behaves as a single logical unit that can be cut, copied, or moved safely and cleanly.
Folding is effective for tracking progress during extensive pull requests. Collapsing previously examined functions or blocks actively filters out visual noise.
Code Folding Frontend
The primary drawback of code folding modes is inconsistency. For example, hs-minor-mode and outline-minor-mode use entirely different functions and keybindings to perform the exact same logical action.
The solution is a package called kirigami, which acts as a universal frontend for text folding. You define your keybindings once, and kirigami automatically detects the active folding and routes your commands to the appropriate engine, whether that is outline-minor-mode, outline-indent-minor-mode, org-mode, markdown-mode, gfm-mode, treesit-fold-mode, hs-minor-mode (hideshow), and many others…
To install and configure kirigami, add the following code to your Emacs init file:
(use-package kirigami
:commands (kirigami-open-fold
kirigami-open-fold-rec
kirigami-close-fold
kirigami-toggle-fold
kirigami-open-folds
kirigami-close-folds-except-current
kirigami-close-folds)
:bind
;; Vanilla Emacs keybindings
(("C-c z o" . kirigami-open-fold) ; Open fold at point
("C-c z O" . kirigami-open-fold-rec) ; Open fold recursively
("C-c z r" . kirigami-open-folds) ; Open all folds
("C-c z c" . kirigami-close-fold) ; Close fold at point
("C-c z m" . kirigami-close-folds) ; Close all folds
("C-c z a" . kirigami-toggle-fold))) ; Toggle fold at point
If you are an evil-mode user, add the following keybindings to your init file:
;; Uncomment the following if you are an `evil-mode' user:
(with-eval-after-load 'evil
(define-key evil-normal-state-map "zo" #'kirigami-open-fold)
(define-key evil-normal-state-map "zO" #'kirigami-open-fold-rec)
(define-key evil-normal-state-map "zc" #'kirigami-close-fold)
(define-key evil-normal-state-map "za" #'kirigami-toggle-fold)
(define-key evil-normal-state-map "zr" #'kirigami-open-folds)
(define-key evil-normal-state-map "zm" #'kirigami-close-folds))
In addition to providing a unified interface, the kirigami package enhances folding behavior in outline, markdown-mode, and org-mode packages. It ensures that deep folds and sibling folds open and close reliably.
Code Folding Backends
A code folding backend is the underlying engine that handles the logic of identifying and hiding specific blocks of text. While the kirigami package provides the user interface and keybindings, it requires a backend, such as outline-minor-mode or hs-minor-mode, to perform the folding.
NOTE: When configuring folding backends, ensure that only one folding minor mode is active concurrently in a single buffer, as conflicts and unexpected behavior may occur. For this reason, adding folding hooks to broad categories like prog-mode-hook or text-mode-hook is discouraged. Instead, hooks should be applied specifically to individual language modes, such as emacs-lisp-mode-hook.
Below are ready-to-use hooks to activate the optimal folding backend for each major mode:
Outline (built-in)
outline-minor-mode relies on hierarchical headings to determine collapsible sections. It is effective for structured text and is my default choice for Elisp, Lisp, Markdown, Diff, and configuration files.
hs-minor-mode parses buffer syntax to accurately detect the start and end of blocks. It is the best tool for C-style languages, or anything using braces {} and explicit block structures like sh/Bash shell scripts.
;; Systems and General Purpose
(add-hook 'c-mode-hook #'hs-minor-mode)
(add-hook 'c++-mode-hook #'hs-minor-mode)
(add-hook 'java-mode-hook #'hs-minor-mode)
(add-hook 'rust-mode-hook #'hs-minor-mode)
(add-hook 'go-mode-hook #'hs-minor-mode)
(add-hook 'ruby-mode-hook #'hs-minor-mode)
;; Web and Frontend
(add-hook 'js-mode-hook #'hs-minor-mode)
(add-hook 'typescript-mode-hook #'hs-minor-mode)
(add-hook 'css-mode-hook #'hs-minor-mode)
;; Scripting, Data, and Infrastructure
(add-hook 'sh-mode-hook #'hs-minor-mode) ; for bash/shell scripts
(add-hook 'json-mode-hook #'hs-minor-mode)
(add-hook 'lua-mode-hook #'hs-minor-mode)
(add-hook 'nxml-mode-hook #'hs-minor-mode)
(add-hook 'html-mode-hook #'hs-minor-mode) ;; mhtml and html
hs-minor-mode folds a single level at a time, such as entire functions, without providing convenient access to nested blocks. This makes it less practical for languages that require deep folding, such as YAML, where multiple nested levels are common. Even in languages like Python, Hideshow can be impractical, because it allows folding classes but does not provide convenient folding for the functions within those classes for example.
Outline-indent
The outline-indent package provides code folding based on indentation levels. It is recommended for Python, Haskell, and YAML because it supports an unlimited number of folding levels. For instance, it allows folding an entire function or specific nested blocks within that function, such as if statements inside while loops.
In addition to code folding, outline-indent allows moving indented blocks up and down, indenting/unindenting to adjust indentation levels, inserting a new line with the same indentation level as the current line, and moving backward/forward to the indentation level of the current line.
Treesit-fold
The treesit-fold package provides Intelligent code folding by using the structural understanding of the built-in tree-sitter parser. Unlike traditional folding methods that rely on regular expressions or indentation, treesit-fold uses the actual syntax tree of the code to accurately identify foldable regions such as functions, classes, comments, and documentation strings.
For the treesit-fold block to function, you must be using Emacs 29.1 or newer, and you must have the actual Tree-sitter grammars installed on your machine for those specific languages.
Markdown-mode
The markdown-mode package provides a major mode for syntax highlighting, editing commands, and preview support for Markdown documents. It supports core Markdown syntax as well as extensions like GitHub Flavored Markdown (GFM). Markdown-mode and gfm-mode support outline-minor-mode folding.
Maintaining independent folding states in separate windows via indirect buffers (clones)
Opening the same buffer in multiple windows results in synchronized folding states; any folding or unfolding action performed in one window is immediately reflected in all others.
This occurs because folding engines use buffer-local overlays, which are shared across all windows associated with that specific buffer.
Indirect buffers provide a robust solution to this limitation. An indirect buffer shares the underlying text of its parent buffer but maintains an independent set of overlays. This distinction allows for the maintenance of different folding configurations for the same file simultaneously.
To create an indirect buffer (clone) of the current buffer in a separate window, execute:
M-x clone-indirect-buffer-other-window
Creating an indirect buffer provides a separate buffer object that references the same text while maintaining its own isolated set of opened/closed folds.
Preventing Emacs search from matching text within folded blocks
Note: This setting is for users who want search operations to ignore folded blocks instead of expanding them. This behavior is subjective and may not suit every workflow.
By default, search operations can match text within folded blocks, which often causes Emacs to automatically expand the hidden content.
To instruct Emacs to strictly ignore invisible text during search operations, add the following configuration to your init file:
(setq-default search-invisible nil)
Alternatively, to restrict this behavior to specific modes, apply a buffer-local configuration via a mode hook:
Integrating display-line-numbers-mode with code folding
The built-in display-line-numbers-mode renders line numbers in the side margin of the window. By default, it uses absolute line numbering, which tracks the absolute line count in the buffer. Consequently, when a block is folded, the line numbers skip the hidden range (e.g., jumping from 15 to 120).
For users who prefer visual line numbering, display-line-numbers-mode can be configured to ignore collapsed content and assign numbers sequentially based only on what is currently rendered on the screen.
To implement visual line numbering as your global default, set the following variable in your configuration:
(setq-default display-line-numbers-type 'visual)
(Note that you must still enable the mode itself using M-x global-display-line-numbers-mode for the line numbers to appear.)
Discouraged Emacs Folding Engines
Choosing an appropriate folding engine is important for maintaining performance and stability within Emacs. While several third-party and legacy options exist, the following packages and methods are generally discouraged in favor of more modern or integrated alternatives:
Origami: This package is slow and largely unmaintained. Origami uses a non-standard API and a complex implementation that frequently conflicts with other overlay-based minor modes. Its overhead can lead to performance degradation, especially when handling large buffers or deeply nested code. (Modern alternatives to origami: outline-indent, treesit-fold, outline-minor-mode, hs-minor-mode)
Yafolding: This package is also unmaintained and suffers from performance issues. (Modern alternative to yafolding: outline-indent)
Semantic (CEDET): Part of the legacy CEDET suite, Semantic folding is widely regarded as heavyweight. The parsing overhead required for its operation often introduces noticeable latency, making it vastly less efficient than modern built-in alternatives like Tree-sitter. (Modern alternatives to CEDET code folding: treesit-fold, outline-minor-mode, hs-minor-mode, outline-indent)
Selective Display (set-selective-display): This is Emacs’ oldest built-in folding method (often bound to C-x $). It causes unpredictable cursor jumping, and lacks any contextual awareness.
Folding-mode: This ancient package relies on explicit structural markers placed manually inside code comments (e.g., {{{ and }}}). While robust for the user, markers pollute the source code with editor-specific metadata. This is heavily frowned upon in modern collaborative environments where team members use varying IDEs.
Vimish-fold: Although useful for manual, ad-hoc text folding, vimish-fold is not recommended as a primary automated folding engine. Unlike Vim’s set foldmethod=marker, the vimish-fold implementation does not support recursive markers, such as {{{ inside of {{{. Additionally, like folding-mode, vimish-fold also uses markers that pollute the source code with editor-specific markers, a practice discouraged in collaborative environments where team members use a variety of editors and IDEs.
Conclusion
Establishing a unified folding interface in Emacs converts a buffer into a structured environment. Whether you are refactoring complex Python classes or navigating extensive Org documents, relying on a standardized command set simplifies the experience. Integrating the hooks outlined in this article ensures you enable the optimal backend for each major mode, allowing you to focus on logic rather than editor mechanics.