krz/orgstar

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

Commit 674de54223

674de542235029741e65b44cbb458b8846dec924

parent: 9abba9cfc5

Verified · cmc

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

Apply every editing setting on iOS

OrgPreferences.options now carries org-M-RET-may-split-line,
org-hide-emphasis-markers, org-pretty-entities, braced sub/superscripts,
the startup options and spell checking, with the Mac's defaults. The iOS
editor turns spell checking on only when the setting is on.

Layout: unified · split

Sources/OrgApp/OrgPreferences.swift +9 −2
@@ -14,13 +14,20 @@ public enum OrgPreferences {
1414 return settings
1515 }
1616
17 /// What commands run from the agenda and capture follow: logging and tags.
17 /// The editing options, as the Mac's Settings apply them.
1818 public static func options(_ defaults: UserDefaults = .standard) -> EditingOptions {
1919 var options = EditingOptions(
2020 tagsColumn: integer("tagsColumn", defaults), insertHeadingRespectContent: bool("headingAfterSubtree", defaults),
21 metaReturnMaySplitLine: bool("splitLine", defaults),
2122 listAllowAlphabetical: bool("alphabeticalLists", defaults), fillColumn: integer("fillColumn", defaults),
23 hideEmphasisMarkers: bool("hiddenMarkers", defaults), prettyEntities: bool("prettyEntities", defaults), subSuperscriptsNeedBraces: true,
2224 logDone: LogHow(rawValue: string("logDone", defaults)), logIntoDrawer: string("logIntoDrawer", defaults).nonEmpty,
23 logReschedule: LogHow(rawValue: string("logReschedule", defaults)), logRedeadline: LogHow(rawValue: string("logRedeadline", defaults))
25 hideDrawerStartup: bool("hideDrawerStartup", defaults), hideBlockStartup: bool("hideBlockStartup", defaults),
26 logReschedule: LogHow(rawValue: string("logReschedule", defaults)), logRedeadline: LogHow(rawValue: string("logRedeadline", defaults)),
27 useSpeedCommands: bool("useSpeedCommands", defaults), startupWithInlineImages: bool("startupWithInlineImages", defaults),
28 startupIndented: bool("startupIndented", defaults), hideLeadingStars: bool("hideLeadingStars", defaults),
29 startupAlignAllTables: bool("startupAlignAllTables", defaults), startupTruncated: bool("startupTruncated", defaults),
30 spellCheck: bool("spellCheck", defaults)
2431 )
2532 options.electricPair = bool("electricPair", defaults)
2633 return options
Sources/OrgstarMobile/MobileEditor.swift +4 −2
@@ -54,7 +54,9 @@ final class KeyedTextView: UITextView {
5454final class MobileEditor: NSObject, DocumentBuffer {
5555 private(set) var document: DocumentState
5656 let textView: UITextView
57 var options: EditingOptions = .org
57 var options: EditingOptions = .org {
58 didSet { textView.spellCheckingType = options.spellCheck ? .yes : .no }
59 }
5860 var keymap = KeymapPreset.emacs.keymap
5961 var onChange: (() -> Void)?
6062 var onMessage: ((String) -> Void)?
@@ -96,7 +98,7 @@ final class MobileEditor: NSObject, DocumentBuffer {
9698 textView.smartQuotesType = .no
9799 textView.smartDashesType = .no
98100 textView.smartInsertDeleteType = .no
99 textView.spellCheckingType = .yes
101 textView.spellCheckingType = options.spellCheck ? .yes : .no
100102 textView.keyboardDismissMode = .interactive
101103 textView.alwaysBounceVertical = true
102104 textView.textContainerInset = UIEdgeInsets(top: 12, left: 8, bottom: 24, right: 8)
Tests/OrgAppTests/OrgPreferencesTests.swift +7
@@ -11,6 +11,9 @@ struct OrgPreferencesTests {
1111 #expect(OrgPreferences.options(defaults).logDone == nil && OrgPreferences.options(defaults).tagsColumn == -77)
1212 #expect(OrgPreferences.agendaSpan(defaults) == 10 && OrgPreferences.agendaStartOffset(defaults) == -3)
1313 #expect(OrgPreferences.reminders(defaults) && OrgPreferences.reminderLead(defaults) == 12)
14 let fallbacks = OrgPreferences.options(defaults)
15 #expect(!fallbacks.metaReturnMaySplitLine && fallbacks.hideEmphasisMarkers && fallbacks.prettyEntities && fallbacks.subSuperscriptsNeedBraces)
16 #expect(fallbacks.startupIndented && !fallbacks.spellCheck && fallbacks.hideDrawerStartup && !fallbacks.hideBlockStartup)
1417
1518 let problems = UserConfig.apply("""
1619 org-todo-keywords = "TODO NEXT | DONE"
@@ -19,6 +22,9 @@ struct OrgPreferencesTests {
1922 org-agenda-span = 7
2023 org-agenda-start-day = "-1d"
2124 appt-message-warning-time = 30
25 org-M-RET-may-split-line = true
26 org-hide-emphasis-markers = false
27 org-pretty-entities = false
2228 [orgstar]
2329 reminders = false
2430 """, to: defaults)
@@ -26,6 +32,7 @@ struct OrgPreferencesTests {
2632 #expect(OrgPreferences.orgSettings(defaults).todoSequences.first?.active.map(\.name) == ["TODO", "NEXT"])
2733 let options = OrgPreferences.options(defaults)
2834 #expect(options.logDone == .time && options.logIntoDrawer == "LOGBOOK")
35 #expect(options.metaReturnMaySplitLine && !options.hideEmphasisMarkers && !options.prettyEntities)
2936 #expect(OrgPreferences.agendaSpan(defaults) == 7 && OrgPreferences.agendaStartOffset(defaults) == -1)
3037 #expect(!OrgPreferences.reminders(defaults) && OrgPreferences.reminderLead(defaults) == 30)
3138 }