Commit 7f42d1dc20
7f42d1dc20d9c2c1586923fca15530dc87b7abc6
parent: 237d0f6fe4
Verified · cmc
cmc <hello@cleberg.net> · 2026-11-22 02:23 UTC
Fix compiler warnings in the Mac and iOS builds
- Remove a drawer-insertion line whose condition compared a Bool to nil
and so never ran, and a constant that left two branches dead in LaTeX
image export.
- Isolation: AgendaScreen holds its model as a let; DocumentScanner.pdf,
the surface plot's interpolate and the timer's notification identifier
are nonisolated.
- Name the modules in AgendaItem's Identifiable conformance, drop
redundant internal(set), build the theme preview from attributed
strings instead of Text +, and write the overdue keys' optionals with
String(describing:).
Layout: unified · split
Sources/OrgApp/OverdueBadge.swift
+1 −1
| @@ -8,7 +8,7 @@ public enum OverdueBadge { |
| 8 | 8 | public static func counts(_ groups: [AgendaDayGroup], today: Int, days: Int) -> [Int] { |
| 9 | 9 | func key(_ row: AgendaRow) -> String? { |
| 10 | 10 | guard let item = row.item, !row.isDone, item.habit == nil, row.planningDay != nil else { return nil } |
| 11 | | return "\(item.path):\(item.headingOffset ?? item.markerOffset)" |
| 11 | return "\(String(describing: item.path)):\(String(describing: item.headingOffset ?? item.markerOffset))" |
| 12 | 12 | } |
| 13 | 13 | var overdue = Set(groups.first { $0.day == today }?.overdue.compactMap(key) ?? []) |
| 14 | 14 | var counts = [overdue.count] |
Sources/OrgApp/PlotChart.swift
+1 −1
| @@ -200,7 +200,7 @@ public struct PlotChart: View { |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /// The matrix's value at a fractional column and row, from its four neighbours. |
| 203 | | static func interpolate(_ m: [[Double]], _ x: Double, _ z: Double) -> Double { |
| 203 | nonisolated static func interpolate(_ m: [[Double]], _ x: Double, _ z: Double) -> Double { |
| 204 | 204 | guard !m.isEmpty, !m[0].isEmpty else { return 0 } |
| 205 | 205 | let c = min(max(x - 1, 0), Double(m[0].count - 1)), r = min(max(z - 1, 0), Double(m.count - 1)) |
| 206 | 206 | let c0 = Int(c), r0 = Int(r), c1 = min(c0 + 1, m[0].count - 1), r1 = min(r0 + 1, m.count - 1) |
Sources/OrgApp/TimerModel.swift
+1 −1
| @@ -13,7 +13,7 @@ public final class TimerModel { |
| 13 | 13 | /// The countdown's message when it ends, for the echo area. |
| 14 | 14 | @ObservationIgnored public var onDone: ((String) -> Void)? |
| 15 | 15 | @ObservationIgnored private var countdown: Task<Void, Never>? |
| 16 | | static let notification = "sh.krz.orgstar.org-timer" |
| 16 | nonisolated static let notification = "sh.krz.orgstar.org-timer" |
| 17 | 17 | |
| 18 | 18 | public init() {} |
| 19 | 19 | |
Sources/OrgCore/Commands/ElementCommands.swift
−1
| @@ -39,7 +39,6 @@ public struct InsertDrawer: OrgCommand { |
| 39 | 39 | buffer.insert("\n:END:") |
| 40 | 40 | if !buffer.eolp { buffer.insert("\n") } |
| 41 | 41 | buffer.point = buffer.lineStart(buffer.point) - 1 |
| 42 | | if buffer.lookingAtLine("^:END:") == nil { buffer.point = buffer.lineStart(max(0, buffer.point - 1)) - 1 } |
| 43 | 42 | } |
| 44 | 43 | } |
| 45 | 44 | } |
Sources/OrgCore/Export/LaTeXExport.swift
+1 −2
| @@ -1815,10 +1815,9 @@ final class LaTeXRenderer { |
| 1815 | 1815 | code = "\\includesvg" + code.dropFirst("\\includegraphics".count) |
| 1816 | 1816 | code = code.replacingOccurrences(of: ".svg}", with: "}") |
| 1817 | 1817 | } |
| 1818 | | let above = false |
| 1819 | 1818 | switch float { |
| 1820 | 1819 | case .env(let env): |
| 1821 | | return "\\begin{\(env)}\(placement)\n\(above ? caption : "")\(center ? "\\centering" : "")\n\(code)\n\(above ? "" : caption)\\end{\(env)}" |
| 1820 | return "\\begin{\(env)}\(placement)\n\(center ? "\\centering" : "")\n\(code)\n\(caption)\\end{\(env)}" |
| 1822 | 1821 | case .wrap: |
| 1823 | 1822 | return "\\begin{wrapfigure}\(placement)\n\(center ? "\\centering" : "")\n\(code)\n\(caption)\\end{wrapfigure}" |
| 1824 | 1823 | case .sideways: |
Sources/OrgstarMobile/AgendaScreen.swift
+3 −2
| @@ -11,7 +11,7 @@ import SwiftUI |
| 11 | 11 | struct AgendaScreen: View, Equatable { |
| 12 | 12 | let workspace: WorkspaceModel |
| 13 | 13 | let session: DocumentSession |
| 14 | | @Bindable var agenda: AgendaModel |
| 14 | let agenda: AgendaModel |
| 15 | 15 | let scheduler: ReminderScheduler |
| 16 | 16 | @State private var message: String? |
| 17 | 17 | @Environment(ClockModel.self) private var clock |
| @@ -1142,7 +1142,8 @@ struct DateSheet: View { |
| 1142 | 1142 | } |
| 1143 | 1143 | } |
| 1144 | 1144 | |
| 1145 | | extension AgendaItem: Identifiable { |
| 1145 | // Module names on both, so the Xcode target, where OrgCore is another package, doesn't warn. |
| 1146 | extension OrgCore.AgendaItem: Swift.Identifiable { |
| 1146 | 1147 | public var id: String { "\(path ?? "")|\(headingOffset ?? -1)|\(kind.rawValue)|\(text)" } |
| 1147 | 1148 | |
| 1148 | 1149 | /// An entry, not a time-grid line. |
Sources/OrgstarMobile/DocumentScanner.swift
+1 −1
| @@ -21,7 +21,7 @@ struct DocumentScanner: UIViewControllerRepresentable { |
| 21 | 21 | func makeCoordinator() -> Coordinator { Coordinator(scanned: scanned) } |
| 22 | 22 | |
| 23 | 23 | /// `pages` as a PDF, each page the size of its image in points. |
| 24 | | static func pdf(_ pages: [UIImage]) -> Data { |
| 24 | nonisolated static func pdf(_ pages: [UIImage]) -> Data { |
| 25 | 25 | UIGraphicsPDFRenderer(bounds: .zero).pdfData { context in |
| 26 | 26 | for page in pages { |
| 27 | 27 | let bounds = CGRect(origin: .zero, size: page.size) |
Sources/OrgstarMobile/MobileEditor.swift
+3 −3
| @@ -105,7 +105,7 @@ final class MobileEditor: NSObject, DocumentBuffer { |
| 105 | 105 | var knownTags: @Sendable () -> [String] = { [] } |
| 106 | 106 | |
| 107 | 107 | var theme: MobileTheme |
| 108 | | internal(set) var fold = FoldState() |
| 108 | var fold = FoldState() |
| 109 | 109 | var globalVisibility: GlobalVisibility? |
| 110 | 110 | let hidden = LockedRanges() |
| 111 | 111 | /// An arrow key moved the caret, and where it was before; the caret skips folds then. |
| @@ -125,9 +125,9 @@ final class MobileEditor: NSObject, DocumentBuffer { |
| 125 | 125 | /// The line last revealed while markup is hidden, to hide again when the caret leaves. |
| 126 | 126 | var revealedLine: NSRange? |
| 127 | 127 | /// `org-toggle-inline-images`: lines that are only an image link show the image. |
| 128 | | internal(set) var showsImages = false |
| 128 | var showsImages = false |
| 129 | 129 | /// `org-latex-preview`: LaTeX fragments show as typeset math. |
| 130 | | internal(set) var showsLatex = false |
| 130 | var showsLatex = false |
| 131 | 131 | /// The view width images were last sized for. |
| 132 | 132 | var imageWidth: CGFloat = 0 |
| 133 | 133 | /// The file's folder, for relative image paths. |
Sources/OrgstarMobile/ThemePickerScreen.swift
+11 −7
| @@ -41,14 +41,18 @@ struct ThemePickerScreen: View { |
| 41 | 41 | return Color(.sRGB, red: c.red, green: c.green, blue: c.blue, opacity: c.alpha) |
| 42 | 42 | } |
| 43 | 43 | let font = Font.system(.footnote, design: .monospaced) |
| 44 | func run(_ text: String, _ key: String, bold: Bool = false, underline: Bool = false) -> AttributedString { |
| 45 | var run = AttributedString(text) |
| 46 | run.foregroundColor = color(key) |
| 47 | if bold { run.inlinePresentationIntent = .stronglyEmphasized } |
| 48 | if underline { run.underlineStyle = .single } |
| 49 | return run |
| 50 | } |
| 44 | 51 | return VStack(alignment: .leading, spacing: 2) { |
| 45 | | (Text(verbatim: "* ").foregroundColor(color("heading-1")) + Text(verbatim: "TODO ").foregroundColor(color("todo")).bold() |
| 46 | | + Text(verbatim: "Plan the trip ").foregroundColor(color("heading-1")).bold() + Text(verbatim: ":travel:").foregroundColor(color("tags"))) |
| 47 | | (Text(verbatim: " SCHEDULED: ").foregroundColor(color("metadata")) + Text(verbatim: "<2026-10-20 Tue>").foregroundColor(color("timestamp"))) |
| 48 | | (Text(verbatim: " Book via ").foregroundColor(color("foreground")) + Text(verbatim: "the site").foregroundColor(color("link")).underline() |
| 49 | | + Text(verbatim: ", ").foregroundColor(color("foreground")) + Text(verbatim: "~code~").foregroundColor(color("code"))) |
| 50 | | (Text(verbatim: "** ").foregroundColor(color("heading-2")) + Text(verbatim: "DONE ").foregroundColor(color("done")).bold() |
| 51 | | + Text(verbatim: "Passport").foregroundColor(color("heading-2")).bold()) |
| 52 | Text(run("* ", "heading-1") + run("TODO ", "todo", bold: true) + run("Plan the trip ", "heading-1", bold: true) + run(":travel:", "tags")) |
| 53 | Text(run(" SCHEDULED: ", "metadata") + run("<2026-10-20 Tue>", "timestamp")) |
| 54 | Text(run(" Book via ", "foreground") + run("the site", "link", underline: true) + run(", ", "foreground") + run("~code~", "code")) |
| 55 | Text(run("** ", "heading-2") + run("DONE ", "done", bold: true) + run("Passport", "heading-2", bold: true)) |
| 52 | 56 | } |
| 53 | 57 | .font(font) |
| 54 | 58 | .padding(8) |