krz/orgstar

A native macOS editor for org-mode files. editor org-mode swift

Commit bd3ef3d82a

bd3ef3d82a420bd737269276214670667ab691dc

parent: 1579064da0

Verified · cmc

cmc <hello@cleberg.net> · 2026-10-08 03:29 UTC

Drop the unreachable C-c C-e export dialog binding

C-c C-e is the prefix of C-c C-e h h and the other export keys, so the
dispatcher always waited for the next key and the dialog binding never
ran. As in Org, C-c C-e now only starts the export keys, whose pending
hints list the formats; the dialog stays in the command palette. A test
checks that no preset binding is also a prefix.

Layout: unified · split

Sources/OrgCore/Keymap/Presets.swift −3
@@ -753,9 +753,6 @@ public enum KeymapPreset: String, Sendable, CaseIterable {
753753 keys = "C-c C-x A"
754754 command = "org.archive.to-sibling"
755755 [[bind]]
756 keys = "C-c C-e"
757 command = "app.export-dialog"
758 [[bind]]
759756 keys = "C-c C-x C-v"
760757 command = "org.toggle-inline-images"
761758 [[bind]]
Sources/Orgstar/ExportSheet.swift +1 −1
@@ -1,7 +1,7 @@
11import AppKit
22import SwiftUI
33
4/// C-c C-e: the format, where the file goes, and whether to open it after.
4/// Export… (`app.export-dialog`): the format, where the file goes, and whether to open it after.
55struct ExportSheet: View {
66 let source: URL
77 let export: (_ format: String, _ destination: URL, _ open: Bool) -> Void
Tests/OrgCoreTests/KeymapTests.swift +11
@@ -126,6 +126,17 @@ struct KeymapTests {
126126 #expect(KeymapPreset.mac.keymap.keys(for: "org.deadline") == [KeyChord("e", [.control, .command])])
127127 }
128128
129 /// A binding whose keys start a longer live binding never runs: the dispatcher waits for more.
130 @Test func presetsBindNoPrefixes() {
131 for preset in KeymapPreset.allCases {
132 let keymap = preset.keymap
133 for binding in keymap.bindings where !binding.unbinds && keymap.isLive(binding) {
134 #expect(!keymap.isPrefix(binding.keys, mode: binding.mode),
135 "\(preset): \(KeySequence.format(binding.keys)) (\(binding.command)) is also a prefix")
136 }
137 }
138 }
139
129140 @Test func shadowedBindingsShowNoKeys() throws {
130141 var problems: [String] = []
131142 let map = Keymap.layered([KeymapPreset.emacs.keymap, try Keymap(toml: "[[bind]]\nkeys = \"C-c C-t\"\ncommand = \"app.save\"\n", problems: &problems)])