krz/orgstar

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

Commit e0c1e99fae

e0c1e99fae4aa4da59acc11a2fc5c0b08028f528

parent: 3f59087b14

Verified · cmc

cmc <hello@cleberg.net> · 2026-10-07 23:51 UTC

Fix build warnings

Exclude the conformance fixtures from OrgCoreTests, silence the 64-to-32
warning in the vendored tree-sitter scanners, apply snipe's operator-pending
check to both s and S, and clear the Swift warnings.

Layout: unified · split

Package.swift +3 −2
@@ -54,7 +54,8 @@ let package = Package(
54 .target(name: "TreeSitterClojure", path: "Sources/TreeSitterClojure", sources: ["src/parser.c"], cSettings: [.headerSearchPath("src")]), 54 .target(name: "TreeSitterClojure", path: "Sources/TreeSitterClojure", sources: ["src/parser.c"], cSettings: [.headerSearchPath("src")]),
55 .target( 55 .target(
56 name: "TreeSitterScanners", path: "Sources/TreeSitterScanners", 56 name: "TreeSitterScanners", path: "Sources/TreeSitterScanners",
57 sources: ["javascript/scanner.c", "lua/scanner.c", "python/scanner.c", "yaml/scanner.c"] 57 sources: ["javascript/scanner.c", "lua/scanner.c", "python/scanner.c", "yaml/scanner.c"],
58 cSettings: [.unsafeFlags(["-Wno-shorten-64-to-32"])]
58 ), 59 ),
59 .target( 60 .target(
60 name: "OrgHighlight", 61 name: "OrgHighlight",
@@ -89,7 +90,7 @@ let package = Package(
89 .executableTarget(name: "OrgstarSpotlight", dependencies: ["OrgCore"], linkerSettings: extensionEntry), 90 .executableTarget(name: "OrgstarSpotlight", dependencies: ["OrgCore"], linkerSettings: extensionEntry),
90 // The iOS share extension, bundled into the iOS app by scripts/build-ios-app.sh. 91 // The iOS share extension, bundled into the iOS app by scripts/build-ios-app.sh.
91 .executableTarget(name: "OrgstarShare", dependencies: ["OrgApp"], linkerSettings: extensionEntry), 92 .executableTarget(name: "OrgstarShare", dependencies: ["OrgApp"], linkerSettings: extensionEntry),
92 .testTarget(name: "OrgCoreTests", dependencies: ["OrgCore"]), 93 .testTarget(name: "OrgCoreTests", dependencies: ["OrgCore"], exclude: ["Conformance"]),
93 .testTarget(name: "OrgDocumentTests", dependencies: ["OrgDocument"]), 94 .testTarget(name: "OrgDocumentTests", dependencies: ["OrgDocument"]),
94 .testTarget(name: "OrgIndexTests", dependencies: ["OrgIndex"]), 95 .testTarget(name: "OrgIndexTests", dependencies: ["OrgIndex"]),
95 .testTarget(name: "OrgWorkspaceTests", dependencies: ["OrgWorkspace"]), 96 .testTarget(name: "OrgWorkspaceTests", dependencies: ["OrgWorkspace"]),
Sources/OrgCore/Agenda/AgendaSearch.swift +1 −1
@@ -111,7 +111,7 @@ public struct TagsMatcher: Sendable {
111 111
112 if tagsPart.contains(where: { !$0.isWhitespace }) { 112 if tagsPart.contains(where: { !$0.isWhitespace }) {
113 var alternatives: [[Term]] = [] 113 var alternatives: [[Term]] = []
114 var parts = Self.split(tagsPart) 114 let parts = Self.split(tagsPart)
115 var i = 0 115 var i = 0
116 while i < parts.count { 116 while i < parts.count {
117 var part = parts[i] 117 var part = parts[i]
Sources/OrgCore/Commands/Fill.swift +1 −1
@@ -305,7 +305,7 @@ extension EmacsBuffer {
305 /// `fill-region-as-paragraph` with left justification and adaptive fill. 305 /// `fill-region-as-paragraph` with left justification and adaptive fill.
306 func fillRegionAsParagraph(_ fromOffset: Int, _ toOffset: Int, prefix fixedPrefix: String? = nil) { 306 func fillRegionAsParagraph(_ fromOffset: Int, _ toOffset: Int, prefix fixedPrefix: String? = nil) {
307 point = min(fromOffset, toOffset) 307 point = min(fromOffset, toOffset)
308 var to = max(fromOffset, toOffset) 308 let to = max(fromOffset, toOffset)
309 skipForward(Self.whitespace) 309 skipForward(Self.whitespace)
310 let fromPlusIndent = point 310 let fromPlusIndent = point
311 point = lineStart(point) 311 point = lineStart(point)
Sources/OrgCore/Commands/TagCommands.swift +1 −1
@@ -62,7 +62,7 @@ public struct SetTags: OrgCommand {
62 commitBuffer(context) { buffer in 62 commitBuffer(context) { buffer in
63 try buffer.saveExcursion { 63 try buffer.saveExcursion {
64 try buffer.backToHeading() 64 try buffer.backToHeading()
65 try buffer.saveExcursion { 65 buffer.saveExcursion {
66 let line = buffer.saveExcursion { buffer.lookingAt(Self.tagLine) } 66 let line = buffer.saveExcursion { buffer.lookingAt(Self.tagLine) }
67 let old = line.flatMap { $0[2] }.map { buffer.substring($0.lowerBound, $0.upperBound).split(separator: ":").map(String.init) } ?? [] 67 let old = line.flatMap { $0[2] }.map { buffer.substring($0.lowerBound, $0.upperBound).split(separator: ":").map(String.init) } ?? []
68 if tags != old { 68 if tags != old {
Sources/OrgCore/Config/Elisp.swift +1 −1
@@ -584,7 +584,7 @@ public final class Elisp {
584 guard let last = args.last else { return .nil } 584 guard let last = args.last else { return .nil }
585 var items: [Sexp] = [] 585 var items: [Sexp] = []
586 for arg in args.dropLast() { items += try sequence(arg) } 586 for arg in args.dropLast() { items += try sequence(arg) }
587 return try items.reversed().reduce(last) { cons($1, $0) } 587 return items.reversed().reduce(last) { cons($1, $0) }
588 } 588 }
589 lisp.define("length") { _, args in 589 lisp.define("length") { _, args in
590 try arity(args, 1...1, "length") 590 try arity(args, 1...1, "length")
Sources/OrgCore/Config/Lisp.swift +1 −1
@@ -198,7 +198,7 @@ public enum LispReader {
198 case "t": return 9 198 case "t": return 9
199 case "s": return 32 199 case "s": return 32
200 case "e": return 27 200 case "e": return 27
201 case "C", "M", "S", "s", "H", "A": 201 case "C", "M", "S", "H", "A":
202 if peek == "-" { _ = next(); return try character() } 202 if peek == "-" { _ = next(); return try character() }
203 return Int(e.value) 203 return Int(e.value)
204 default: return Int(e.value) 204 default: return Int(e.value)
Sources/OrgCore/Keymap/Vim.swift +1 −1
@@ -599,7 +599,7 @@ public struct Vim: Sendable {
599 } 599 }
600 guard let p = find(kind, last.char, buffer, c, count: n, repeating: true) else { return .invalid } 600 guard let p = find(kind, last.char, buffer, c, count: n, repeating: true) else { return .invalid }
601 return .moved(p, kind == "f" || kind == "t" ? .inclusive : .exclusive) 601 return .moved(p, kind == "f" || kind == "t" ? .inclusive : .exclusive)
602 case ("s", []), ("S", []) where !operatorPending: 602 case ("s", []) where !operatorPending, ("S", []) where !operatorPending:
603 // evil-snipe with `evil-snipe-scope` line. 603 // evil-snipe with `evil-snipe-scope` line.
604 guard keys.count >= 3 else { return .incomplete } 604 guard keys.count >= 3 else { return .incomplete }
605 let chars = keys[1].key + keys[2].key 605 let chars = keys[1].key + keys[2].key
Sources/Orgstar/AgendaView.swift +2 −1
@@ -738,7 +738,8 @@ struct AgendaRow: View {
738 guard let todo = item.todo, text.hasPrefix(todo + " ") else { return Text(text) } 738 guard let todo = item.todo, text.hasPrefix(todo + " ") else { return Text(text) }
739 let rest = String(text.dropFirst(todo.count)) 739 let rest = String(text.dropFirst(todo.count))
740 let rest_ = Text(rest).foregroundColor(item.isDone ? theme.color("comment") ?? .secondary : theme.color("foreground") ?? .primary) 740 let rest_ = Text(rest).foregroundColor(item.isDone ? theme.color("comment") ?? .secondary : theme.color("foreground") ?? .primary)
741 return Text(todo).foregroundColor(theme.keywordColor(todo, done: item.isDone)).bold() + rest_ 741 let todo_ = Text(todo).foregroundColor(theme.keywordColor(todo, done: item.isDone)).bold()
742 return Text("\(todo_)\(rest_)")
742 } 743 }
743} 744}
744 745
Sources/Orgstar/FastSelectionView.swift +1
@@ -1,4 +1,5 @@
1import OrgCore 1import OrgCore
2import OrgPresentation
2import SwiftUI 3import SwiftUI
3 4
4/// Fast TODO and tag selection in the echo area: each option with its key. TODO keywords take 5/// Fast TODO and tag selection in the echo area: each option with its key. TODO keywords take
Sources/Orgstar/Keys.swift +1
@@ -1,6 +1,7 @@
1import OrgApp 1import OrgApp
2import OrgCore 2import OrgCore
3import OrgEditorAppKit 3import OrgEditorAppKit
4import OrgPresentation
4import SwiftUI 5import SwiftUI
5 6
6struct KeyHint: Hashable { 7struct KeyHint: Hashable {