krz/orgstar

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

Commit 32bc22b560

32bc22b560ddee58768489a481583c727358f833

parent: ec4eda648b

Verified · cmc

cmc <hello@cleberg.net> · 2026-10-05 05:43 UTC

Table keys and display settings in the app

Layout: unified · split

Sources/OrgEditorAppKit/EditorCommands.swift +1 −1
@@ -31,7 +31,7 @@ public struct EditorCommand: Sendable {
31} 31}
32 32
33public enum EditorCommands { 33public enum EditorCommands {
34 public static let all: [EditorCommand] = Commands.all.map { EditorCommand(id: $0.id, title: $0.title, action: .text($0)) } + [ 34 public static let all: [EditorCommand] = Commands.everything.map { EditorCommand(id: $0.id, title: $0.title, action: .text($0)) } + [
35 EditorCommand(id: "org.cycle", title: "Cycle Visibility", action: .view), 35 EditorCommand(id: "org.cycle", title: "Cycle Visibility", action: .view),
36 EditorCommand(id: "org.cycle-global", title: "Cycle Global Visibility", action: .view), 36 EditorCommand(id: "org.cycle-global", title: "Cycle Global Visibility", action: .view),
37 37
Sources/Orgstar/ContentView.swift +6 −1
@@ -17,9 +17,14 @@ struct ContentView: View {
17 @AppStorage("splitLine") private var splitLine = false 17 @AppStorage("splitLine") private var splitLine = false
18 @AppStorage("alphabeticalLists") private var alphabeticalLists = true 18 @AppStorage("alphabeticalLists") private var alphabeticalLists = true
19 @AppStorage("fillColumn") private var fillColumn = 80 19 @AppStorage("fillColumn") private var fillColumn = 80
20 @AppStorage("hiddenMarkers") private var hiddenMarkers = true
21 @AppStorage("prettyEntities") private var prettyEntities = true
20 22
21 private var options: EditingOptions { 23 private var options: EditingOptions {
22 Preferences.options(tagsColumn: tagsColumn, headingAfterSubtree: headingAfterSubtree, splitLine: splitLine, alphabeticalLists: alphabeticalLists, fillColumn: fillColumn) 24 Preferences.options(
25 tagsColumn: tagsColumn, headingAfterSubtree: headingAfterSubtree, splitLine: splitLine, alphabeticalLists: alphabeticalLists,
26 fillColumn: fillColumn, hiddenMarkers: hiddenMarkers, prettyEntities: prettyEntities
27 )
23 } 28 }
24 @State private var selectedFile: String? 29 @State private var selectedFile: String?
25 @State private var query = "" 30 @State private var query = ""
Sources/Orgstar/OrgstarApp.swift +7
@@ -155,6 +155,8 @@ struct SettingsView: View {
155 @AppStorage("splitLine") private var splitLine = false 155 @AppStorage("splitLine") private var splitLine = false
156 @AppStorage("alphabeticalLists") private var alphabeticalLists = true 156 @AppStorage("alphabeticalLists") private var alphabeticalLists = true
157 @AppStorage("fillColumn") private var fillColumn = 80 157 @AppStorage("fillColumn") private var fillColumn = 80
158 @AppStorage("hiddenMarkers") private var hiddenMarkers = true
159 @AppStorage("prettyEntities") private var prettyEntities = true
158 @AppStorage("todoKeywords") private var todoKeywords = Preferences.defaultTodoKeywords 160 @AppStorage("todoKeywords") private var todoKeywords = Preferences.defaultTodoKeywords
159 161
160 var body: some View { 162 var body: some View {
@@ -186,6 +188,11 @@ struct SettingsView: View {
186 Toggle("M-RET splits the line at the caret", isOn: $splitLine) 188 Toggle("M-RET splits the line at the caret", isOn: $splitLine)
187 Toggle("Lists can use letters (a. b. c.)", isOn: $alphabeticalLists) 189 Toggle("Lists can use letters (a. b. c.)", isOn: $alphabeticalLists)
188 Stepper("M-q fills to column \(fillColumn)", value: $fillColumn, in: 40...200) 190 Stepper("M-q fills to column \(fillColumn)", value: $fillColumn, in: 40...200)
191 Toggle("Emacs hides emphasis markers (org-hide-emphasis-markers)", isOn: $hiddenMarkers)
192 Toggle("Emacs shows entities as characters (org-pretty-entities)", isOn: $prettyEntities)
193 Text("Tags, tables and M-q measure text as your Emacs displays it, so both write the same file.")
194 .font(.caption)
195 .foregroundStyle(.secondary)
189 TextField("Default TODO keywords:", text: $todoKeywords) 196 TextField("Default TODO keywords:", text: $todoKeywords)
190 Text("For files without #+TODO, in #+TODO syntax. Takes effect when Orgstar restarts.") 197 Text("For files without #+TODO, in #+TODO syntax. Takes effect when Orgstar restarts.")
191 .font(.caption) 198 .font(.caption)
Sources/Orgstar/Preferences.swift +6 −2
@@ -11,10 +11,14 @@ enum Preferences {
11 return OrgSettings.default.withTodoKeywords(line) ?? .default 11 return OrgSettings.default.withTodoKeywords(line) ?? .default
12 } 12 }
13 13
14 static func options(tagsColumn: Int, headingAfterSubtree: Bool, splitLine: Bool, alphabeticalLists: Bool, fillColumn: Int) -> EditingOptions { 14 static func options(
15 tagsColumn: Int, headingAfterSubtree: Bool, splitLine: Bool, alphabeticalLists: Bool, fillColumn: Int,
16 hiddenMarkers: Bool, prettyEntities: Bool
17 ) -> EditingOptions {
15 EditingOptions( 18 EditingOptions(
16 tagsColumn: tagsColumn, insertHeadingRespectContent: headingAfterSubtree, 19 tagsColumn: tagsColumn, insertHeadingRespectContent: headingAfterSubtree,
17 metaReturnMaySplitLine: splitLine, listAllowAlphabetical: alphabeticalLists, fillColumn: fillColumn 20 metaReturnMaySplitLine: splitLine, listAllowAlphabetical: alphabeticalLists, fillColumn: fillColumn,
21 hideEmphasisMarkers: hiddenMarkers, prettyEntities: prettyEntities, subSuperscriptsNeedBraces: true
18 ) 22 )
19 } 23 }
20} 24}