Commit 715375a900
Verified · cmc
Layout: unified · split
Sources/OrgApp/Dailies.swift added +97
| @@ -0,0 +1,97 @@ | |||
| 1 | import Foundation | ||
| 2 | import OrgCore | ||
| 3 | |||
| 4 | /// org-roam-dailies (org-roam 2.3): a file a day in `org-roam-dailies-directory` under | ||
| 5 | /// `org-roam-directory`, named and started as its default capture template does, | ||
| 6 | /// `%<%Y-%m-%d>.org` with `#+title: %<%Y-%m-%d>`, and an ID like any new org-roam file. | ||
| 7 | public struct Dailies: Sendable, Equatable { | ||
| 8 | public struct Failure: Error, Equatable, CustomStringConvertible { | ||
| 9 | public let description: String | ||
| 10 | public init(_ description: String) { self.description = description } | ||
| 11 | } | ||
| 12 | |||
| 13 | /// The folder the daily files are in. | ||
| 14 | public var directory: String | ||
| 15 | /// The file name, with `%<…>` for the date. | ||
| 16 | public var file: String | ||
| 17 | /// What a new file starts with. | ||
| 18 | public var head: String | ||
| 19 | /// What Capture to Daily adds, an org-capture template. | ||
| 20 | public var entry: String | ||
| 21 | |||
| 22 | public init(directory: String, file: String = "%<%Y-%m-%d>.org", head: String = "#+title: %<%Y-%m-%d>\n", entry: String = "* %?") { | ||
| 23 | self.directory = directory | ||
| 24 | self.file = file | ||
| 25 | self.head = head | ||
| 26 | self.entry = entry | ||
| 27 | } | ||
| 28 | |||
| 29 | /// The settings' dailies: `org-roam-directory`, by default the first folder, and | ||
| 30 | /// `org-roam-dailies-directory` in it. Nil without a folder. | ||
| 31 | public static func configured(roots: [String], defaults: UserDefaults = .standard) -> Dailies? { | ||
| 32 | let roam = OrgPreferences.roamDirectory(defaults) | ||
| 33 | guard let base = roam.isEmpty ? roots.first : OrgAttach.expand(roam, in: roots.first ?? NSHomeDirectory()) else { return nil } | ||
| 34 | return Dailies(directory: OrgAttach.expand(OrgPreferences.dailiesDirectory(defaults), in: base), | ||
| 35 | file: OrgPreferences.dailiesFile(defaults), head: OrgPreferences.dailiesHead(defaults), entry: OrgPreferences.dailiesEntry(defaults)) | ||
| 36 | } | ||
| 37 | |||
| 38 | /// `format-time-string` for each `%<format>`, in the local time zone. | ||
| 39 | public static func expandTime(_ template: String, _ day: Date) -> String { | ||
| 40 | template.replacing(/%<([^>]*)>/) { strftime(String($0.1), day) } | ||
| 41 | } | ||
| 42 | |||
| 43 | static func strftime(_ format: String, _ date: Date) -> String { | ||
| 44 | var time = time_t(date.timeIntervalSince1970) | ||
| 45 | var parts = tm() | ||
| 46 | localtime_r(&time, &parts) | ||
| 47 | var buffer = [CChar](repeating: 0, count: 256) | ||
| 48 | let count = Darwin.strftime(&buffer, buffer.count, format, &parts) | ||
| 49 | return String(decoding: buffer[..<count].map { UInt8(bitPattern: $0) }, as: UTF8.self) | ||
| 50 | } | ||
| 51 | |||
| 52 | public func path(for day: Date) -> String { | ||
| 53 | OrgAttach.expand(Self.expandTime(file, day).trimmingCharacters(in: .whitespaces), in: directory) | ||
| 54 | } | ||
| 55 | |||
| 56 | /// The file's text when it's new: the head, ending in a newline, under a property drawer | ||
| 57 | /// with the ID, as `org-entry-put` puts it at the start. | ||
| 58 | public func newText(_ day: Date, id: String) -> String { | ||
| 59 | var text = Self.expandTime(head, day) | ||
| 60 | if !text.hasSuffix("\n") { text += "\n" } | ||
| 61 | return OrgAttach.ensuringID(text, at: 0) { id }.text | ||
| 62 | } | ||
| 63 | |||
| 64 | /// The daily file for `day`, made when missing. True when it's new. | ||
| 65 | @discardableResult | ||
| 66 | public func ensure(_ day: Date, id: () -> String = { UUID().uuidString.lowercased() }) throws -> (path: String, created: Bool) { | ||
| 67 | let path = path(for: day) | ||
| 68 | guard !FileManager.default.fileExists(atPath: path) else { return (path, false) } | ||
| 69 | try FileManager.default.createDirectory(atPath: (path as NSString).deletingLastPathComponent, withIntermediateDirectories: true) | ||
| 70 | try newText(day, id: id()).write(toFile: path, atomically: true, encoding: .utf8) | ||
| 71 | return (path, true) | ||
| 72 | } | ||
| 73 | |||
| 74 | /// `org-roam-dailies--list-files`: the org files in the folder and below, without hidden, | ||
| 75 | /// backup and auto-save files, sorted. | ||
| 76 | public func files() -> [String] { | ||
| 77 | let paths = (FileManager.default.enumerator(atPath: directory)?.allObjects as? [String]) ?? [] | ||
| 78 | return paths.compactMap { relative -> String? in | ||
| 79 | let name = (relative as NSString).lastPathComponent | ||
| 80 | guard (relative as NSString).pathExtension == "org", !relative.split(separator: "/").contains(where: { $0.hasPrefix(".") }), | ||
| 81 | !name.hasPrefix("#"), !name.hasSuffix("~") else { return nil } | ||
| 82 | return (directory as NSString).appendingPathComponent(relative) | ||
| 83 | }.sorted() | ||
| 84 | } | ||
| 85 | |||
| 86 | /// `org-roam-dailies-goto-next-note` from the daily file at `path`, `n` notes on | ||
| 87 | /// (back for negative `n`). | ||
| 88 | public func neighbor(of path: String, by n: Int) throws -> String { | ||
| 89 | func real(_ p: String) -> String { URL(fileURLWithPath: p).resolvingSymlinksInPath().path } | ||
| 90 | guard real(path).hasPrefix(real(directory) + "/") else { throw Failure("Not in a daily-note") } | ||
| 91 | let all = files() | ||
| 92 | guard let position = all.map(real).firstIndex(of: real(path)) else { throw Failure("Can't find current note file - have you saved it yet?") } | ||
| 93 | if n >= 0, position == all.count - 1 { throw Failure("Already at newest note") } | ||
| 94 | if n < 0, position == 0 { throw Failure("Already at oldest note") } | ||
| 95 | return all[min(max(position + n, 0), all.count - 1)] | ||
| 96 | } | ||
| 97 | } | ||
Sources/OrgApp/EmacsImport.swift +13
| @@ -548,6 +548,19 @@ public struct EmacsImport: Sendable { | |||
| 548 | add(name, .string(format)) | 548 | add(name, .string(format)) |
| 549 | case "org-timer-default-timer": | 549 | case "org-timer-default-timer": |
| 550 | if let text = value.string { add(name, .string(text)) } else if let number = value.integer { add(name, .string(String(number))) } else { note("not a string or number") } | 550 | if let text = value.string { add(name, .string(text)) } else if let number = value.integer { add(name, .string(String(number))) } else { note("not a string or number") } |
| 551 | case "org-roam-directory", "org-roam-dailies-directory": | ||
| 552 | guard let dir = value.string else { return note("not a string") } | ||
| 553 | add(name, .string(dir)) | ||
| 554 | case "org-roam-dailies-capture-templates": | ||
| 555 | // The first template's entry and its `(file+head NAME HEAD)` target. | ||
| 556 | guard let first = value.elements?.first?.elements, first.count >= 4, let entry = first[3].string, | ||
| 557 | let at = first.firstIndex(of: .symbol(":target")), at + 1 < first.count, let target = first[at + 1].elements, | ||
| 558 | target.count == 3, target[0].symbol == "file+head", let file = target[1].string, let head = target[2].string else { | ||
| 559 | return note("not a template with a (file+head NAME HEAD) target") | ||
| 560 | } | ||
| 561 | add("org-roam-dailies-file", .string(file)) | ||
| 562 | add("org-roam-dailies-head", .string(head)) | ||
| 563 | add("org-roam-dailies-entry", .string(entry)) | ||
| 551 | case "org-attach-id-dir": | 564 | case "org-attach-id-dir": |
| 552 | guard let dir = value.string else { return note("not a string") } | 565 | guard let dir = value.string else { return note("not a string") } |
| 553 | add(name, .string(dir)) | 566 | add(name, .string(dir)) |
Sources/OrgApp/OrgPreferences.swift +8
| @@ -147,6 +147,14 @@ public enum OrgPreferences { | |||
| 147 | options.userFullName = NSFullUserName() | 147 | options.userFullName = NSFullUserName() |
| 148 | return options | 148 | return options |
| 149 | } | 149 | } |
| 150 | /// `org-roam-directory`; empty for the first folder. | ||
| 151 | public static func roamDirectory(_ defaults: UserDefaults = .standard) -> String { string("roamDirectory", defaults) } | ||
| 152 | /// `org-roam-dailies-directory`, relative to `org-roam-directory` unless absolute. | ||
| 153 | public static func dailiesDirectory(_ defaults: UserDefaults = .standard) -> String { string("dailiesDirectory", defaults).nonEmpty ?? "daily/" } | ||
| 154 | /// The daily capture template's file name, head and entry. | ||
| 155 | public static func dailiesFile(_ defaults: UserDefaults = .standard) -> String { string("dailiesFile", defaults).nonEmpty ?? "%<%Y-%m-%d>.org" } | ||
| 156 | public static func dailiesHead(_ defaults: UserDefaults = .standard) -> String { string("dailiesHead", defaults).nonEmpty ?? "#+title: %<%Y-%m-%d>\n" } | ||
| 157 | public static func dailiesEntry(_ defaults: UserDefaults = .standard) -> String { string("dailiesEntry", defaults).nonEmpty ?? "* %?" } | ||
| 150 | /// `org-attach-id-dir`, relative to an org file's folder unless absolute. | 158 | /// `org-attach-id-dir`, relative to an org file's folder unless absolute. |
| 151 | public static func attachIDDir(_ defaults: UserDefaults = .standard) -> String { | 159 | public static func attachIDDir(_ defaults: UserDefaults = .standard) -> String { |
| 152 | let dir = string("attachIDDir", defaults) | 160 | let dir = string("attachIDDir", defaults) |
Sources/OrgApp/RoamActions.swift added +146
| @@ -0,0 +1,146 @@ | |||
| 1 | import Foundation | ||
| 2 | import OrgCore | ||
| 3 | import OrgIndex | ||
| 4 | |||
| 5 | /// The `app.dailies.` and `app.node.` commands: org-roam's daily notes, and finding and | ||
| 6 | /// linking ID nodes, with the platform's questions and file opening. | ||
| 7 | @MainActor | ||
| 8 | public struct RoamActions { | ||
| 9 | public var session: DocumentSession | ||
| 10 | /// The sidebar folders, the first being `org-roam-directory` unless it's set. | ||
| 11 | public var roots: () -> [String] | ||
| 12 | /// Headings and files with IDs. | ||
| 13 | public var nodes: () -> [IndexStore.Node] | ||
| 14 | public var show: (String) -> Void | ||
| 15 | public var ask: (Prompt, @escaping (String?) -> Void) -> Void | ||
| 16 | /// Opens a file with the caret at an offset. | ||
| 17 | public var open: (_ path: String, _ offset: Int) -> Void | ||
| 18 | /// Puts a link at the caret, in place of the selection, which describes it; without one, | ||
| 19 | /// the title does. | ||
| 20 | public var insertLink: (_ link: String, _ title: String) -> Void | ||
| 21 | /// The index reads new files. | ||
| 22 | public var refresh: () -> Void | ||
| 23 | |||
| 24 | public init( | ||
| 25 | session: DocumentSession, roots: @escaping () -> [String], nodes: @escaping () -> [IndexStore.Node], show: @escaping (String) -> Void, | ||
| 26 | ask: @escaping (Prompt, @escaping (String?) -> Void) -> Void, open: @escaping (String, Int) -> Void, | ||
| 27 | insertLink: @escaping (String, String) -> Void, refresh: @escaping () -> Void | ||
| 28 | ) { | ||
| 29 | self.session = session | ||
| 30 | self.roots = roots | ||
| 31 | self.nodes = nodes | ||
| 32 | self.show = show | ||
| 33 | self.ask = ask | ||
| 34 | self.open = open | ||
| 35 | self.insertLink = insertLink | ||
| 36 | self.refresh = refresh | ||
| 37 | } | ||
| 38 | |||
| 39 | private var dailies: Dailies? { Dailies.configured(roots: roots()) } | ||
| 40 | |||
| 41 | private func day(_ offset: Int, from now: Date = Date()) -> Date { | ||
| 42 | Calendar.current.date(byAdding: .day, value: offset, to: now) ?? now | ||
| 43 | } | ||
| 44 | |||
| 45 | public func run(_ id: String) { | ||
| 46 | switch id { | ||
| 47 | case "app.dailies.today": goto(day(0)) | ||
| 48 | case "app.dailies.yesterday": goto(day(-1)) | ||
| 49 | case "app.dailies.tomorrow": goto(day(1)) | ||
| 50 | case "app.dailies.capture-today": capture(day(0)) | ||
| 51 | case "app.dailies.capture-yesterday": capture(day(-1)) | ||
| 52 | case "app.dailies.capture-tomorrow": capture(day(1)) | ||
| 53 | case "app.dailies.date", "app.dailies.capture-date": | ||
| 54 | let goto = id == "app.dailies.date" | ||
| 55 | ask(Prompt(key: "date", message: goto ? "Find daily-note: " : "Capture to daily-note: ", date: Prompt.DateRead(defaultDate: nil))) { answer in | ||
| 56 | guard let answer else { return } | ||
| 57 | let now = Date() | ||
| 58 | let read = ReadDate.read(answer, default: nil, now: now, calendar: .current) | ||
| 59 | guard let chosen = Calendar.current.date(from: read.components(.current)) else { return } | ||
| 60 | // The time of day stays now's, as `org-read-date` with `to-time` keeps it. | ||
| 61 | let time = Calendar.current.dateComponents([.hour, .minute, .second], from: now) | ||
| 62 | let date = Calendar.current.date(bySettingHour: read.timeGiven ? read.hour : time.hour!, minute: read.timeGiven ? read.minute : time.minute!, | ||
| 63 | second: read.timeGiven ? 0 : time.second!, of: chosen) ?? chosen | ||
| 64 | if goto { self.goto(date) } else { capture(date) } | ||
| 65 | } | ||
| 66 | case "app.dailies.next", "app.dailies.previous": | ||
| 67 | guard let dailies else { return show("No folder for daily notes") } | ||
| 68 | guard let path = session.path else { return show("Not in a daily-note") } | ||
| 69 | do { | ||
| 70 | let note = try dailies.neighbor(of: path, by: id == "app.dailies.next" ? 1 : -1) | ||
| 71 | open(note, 0) | ||
| 72 | } catch { | ||
| 73 | show("\(error)") | ||
| 74 | } | ||
| 75 | case "app.node.find": | ||
| 76 | chooseNode("Node: ") { node in open(node.location.path, node.location.start) } | ||
| 77 | case "app.node.insert": | ||
| 78 | chooseNode("Node: ") { node in insertLink("id:" + node.id, node.title) } | ||
| 79 | default: | ||
| 80 | show("Unknown command \(id)") | ||
| 81 | } | ||
| 82 | } | ||
| 83 | |||
| 84 | /// `org-roam-dailies-goto-*`: the day's file, made if missing. | ||
| 85 | func goto(_ day: Date) { | ||
| 86 | guard let dailies else { return show("No folder for daily notes") } | ||
| 87 | do { | ||
| 88 | let (path, created) = try dailies.ensure(day) | ||
| 89 | if created { refresh() } | ||
| 90 | open(path, (session.text(of: path).map { ($0 as NSString).length }) ?? 0) | ||
| 91 | } catch { | ||
| 92 | show("Can't make the daily note: \(error.localizedDescription)") | ||
| 93 | } | ||
| 94 | } | ||
| 95 | |||
| 96 | /// `org-roam-dailies-capture-*`: the entry template filed at the end of the day's file, | ||
| 97 | /// which opens with the caret at `%?`. | ||
| 98 | func capture(_ day: Date) { | ||
| 99 | guard let dailies else { return show("No folder for daily notes") } | ||
| 100 | let context = CaptureContext(now: day, file: session.path ?? "", userName: NSFullUserName()) | ||
| 101 | let questions = Capture.questions(dailies.entry, context: context) | ||
| 102 | func ask(_ answers: [String]) { | ||
| 103 | guard answers.count < questions.count else { return file(answers) } | ||
| 104 | let question = questions[answers.count] | ||
| 105 | self.ask(Prompt(key: "q\(answers.count)", message: question.prompt + ": ", initial: question.defaultValue, requireMatch: false)) { answer in | ||
| 106 | if let answer { ask(answers + [answer]) } | ||
| 107 | } | ||
| 108 | } | ||
| 109 | func file(_ answers: [String]) { | ||
| 110 | do { | ||
| 111 | let (path, created) = try dailies.ensure(day) | ||
| 112 | if created { refresh() } | ||
| 113 | guard let text = session.text(of: path) else { return show("Can't read \((path as NSString).lastPathComponent)") } | ||
| 114 | let filled: (text: String, cursor: Int) | ||
| 115 | switch Capture.fill(dailies.entry, context: context, answers: answers) { | ||
| 116 | case .success(let result): filled = result | ||
| 117 | case .failure(.message(let message)): return show(message) | ||
| 118 | } | ||
| 119 | let template = CaptureTemplate(key: "d", name: "daily", target: .file(path), template: dailies.entry) | ||
| 120 | switch Capture.placement(filled.text, template: template, in: text, now: day) { | ||
| 121 | case .failure(.message(let message)): show(message) | ||
| 122 | case .success(let placed): | ||
| 123 | if case .failed(let message) = session.perform(ReplaceText(old: text, new: placed.text), path: path, at: 0, expect: nil) { return show(message) } | ||
| 124 | open(path, placed.start + filled.cursor) | ||
| 125 | } | ||
| 126 | } catch { | ||
| 127 | show("Can't make the daily note: \(error.localizedDescription)") | ||
| 128 | } | ||
| 129 | } | ||
| 130 | ask([]) | ||
| 131 | } | ||
| 132 | |||
| 133 | /// `org-roam-node-read`: a node by its title, with its file's name when titles repeat. | ||
| 134 | private func chooseNode(_ message: String, _ then: @escaping (IndexStore.Node) -> Void) { | ||
| 135 | let all = nodes() | ||
| 136 | guard !all.isEmpty else { return show("No headings or files have IDs") } | ||
| 137 | let counts = Dictionary(all.map { ($0.title, 1) }, uniquingKeysWith: +) | ||
| 138 | let labels = all.map { node in | ||
| 139 | counts[node.title, default: 0] > 1 ? "\(node.title) (\((node.location.path as NSString).lastPathComponent))" : node.title | ||
| 140 | } | ||
| 141 | ask(Prompt(key: "node", message: message, choices: labels)) { answer in | ||
| 142 | guard let answer, let index = labels.firstIndex(of: answer) else { return } | ||
| 143 | then(all[index]) | ||
| 144 | } | ||
| 145 | } | ||
| 146 | } | ||
Sources/OrgApp/UserConfig.swift +10
| @@ -147,6 +147,16 @@ public enum UserConfig { | |||
| 147 | comment: "show image links as images when a file opens; #+STARTUP: (no)inlineimages overrides", legacy: ""), | 147 | comment: "show image links as images when a file opens; #+STARTUP: (no)inlineimages overrides", legacy: ""), |
| 148 | Setting(section: "", key: "org-startup-with-latex-preview", defaultsKey: "startupWithLatexPreview", kind: .bool, fallback: .bool(false), | 148 | Setting(section: "", key: "org-startup-with-latex-preview", defaultsKey: "startupWithLatexPreview", kind: .bool, fallback: .bool(false), |
| 149 | comment: "show LaTeX fragments as typeset math when a file opens; #+STARTUP: (no)latexpreview overrides", legacy: ""), | 149 | comment: "show LaTeX fragments as typeset math when a file opens; #+STARTUP: (no)latexpreview overrides", legacy: ""), |
| 150 | Setting(section: "", key: "org-roam-directory", defaultsKey: "roamDirectory", kind: .string, fallback: .string(""), | ||
| 151 | comment: "the folder org-roam notes are in; empty for the first folder", legacy: ""), | ||
| 152 | Setting(section: "", key: "org-roam-dailies-directory", defaultsKey: "dailiesDirectory", kind: .string, fallback: .string("daily/"), | ||
| 153 | comment: "the folder daily notes are in, relative to org-roam-directory", legacy: ""), | ||
| 154 | Setting(section: "", key: "org-roam-dailies-file", defaultsKey: "dailiesFile", kind: .string, fallback: .string("%<%Y-%m-%d>.org"), | ||
| 155 | comment: "a daily note's file name; %<...> formats the date as format-time-string does", legacy: ""), | ||
| 156 | Setting(section: "", key: "org-roam-dailies-head", defaultsKey: "dailiesHead", kind: .string, fallback: .string("#+title: %<%Y-%m-%d>\n"), | ||
| 157 | comment: "what a new daily note starts with, under its ID", legacy: ""), | ||
| 158 | Setting(section: "", key: "org-roam-dailies-entry", defaultsKey: "dailiesEntry", kind: .string, fallback: .string("* %?"), | ||
| 159 | comment: "the capture template Capture to Daily Note files", legacy: ""), | ||
| 150 | Setting(section: "", key: "org-timer-format", defaultsKey: "timerFormat", kind: .string, fallback: .string("%s "), | 160 | Setting(section: "", key: "org-timer-format", defaultsKey: "timerFormat", kind: .string, fallback: .string("%s "), |
| 151 | comment: "how Insert Timer Value writes the timer; %s is h:mm:ss", legacy: ""), | 161 | comment: "how Insert Timer Value writes the timer; %s is h:mm:ss", legacy: ""), |
| 152 | Setting(section: "", key: "org-timer-default-timer", defaultsKey: "timerDefault", kind: .string, fallback: .string("0"), | 162 | Setting(section: "", key: "org-timer-default-timer", defaultsKey: "timerDefault", kind: .string, fallback: .string("0"), |
Sources/OrgApp/WorkspaceModel.swift +5
| @@ -368,6 +368,11 @@ public final class WorkspaceModel { | |||
| 368 | } | 368 | } |
| 369 | } | 369 | } |
| 370 | 370 | ||
| 371 | /// Headings and files with IDs (org-roam's nodes). | ||
| 372 | public func nodes(overlay: [String: FileRecord] = [:]) -> [IndexStore.Node] { | ||
| 373 | (try? index.nodes(overlay: overlay)) ?? [] | ||
| 374 | } | ||
| 375 | |||
| 371 | public func search(_ query: String, overlay: [String: FileRecord] = [:]) -> [HeadingLocation] { | 376 | public func search(_ query: String, overlay: [String: FileRecord] = [:]) -> [HeadingLocation] { |
| 372 | (try? index.search(query, overlay: overlay)) ?? [] | 377 | (try? index.search(query, overlay: overlay)) ?? [] |
| 373 | } | 378 | } |
Sources/OrgCore/Keymap/PresetDoom.swift +52
| @@ -220,6 +220,58 @@ extension KeymapPreset { | |||
| 220 | command = "org.edit-special" | 220 | command = "org.edit-special" |
| 221 | mode = "normal" | 221 | mode = "normal" |
| 222 | [[bind]] | 222 | [[bind]] |
| 223 | keys = "SPC n r f" | ||
| 224 | command = "app.node.find" | ||
| 225 | mode = "normal" | ||
| 226 | [[bind]] | ||
| 227 | keys = "SPC n r i" | ||
| 228 | command = "app.node.insert" | ||
| 229 | mode = "normal" | ||
| 230 | [[bind]] | ||
| 231 | keys = "SPC n r d t" | ||
| 232 | command = "app.dailies.today" | ||
| 233 | mode = "normal" | ||
| 234 | [[bind]] | ||
| 235 | keys = "SPC n r d y" | ||
| 236 | command = "app.dailies.yesterday" | ||
| 237 | mode = "normal" | ||
| 238 | [[bind]] | ||
| 239 | keys = "SPC n r d m" | ||
| 240 | command = "app.dailies.tomorrow" | ||
| 241 | mode = "normal" | ||
| 242 | [[bind]] | ||
| 243 | keys = "SPC n r d d" | ||
| 244 | command = "app.dailies.date" | ||
| 245 | mode = "normal" | ||
| 246 | [[bind]] | ||
| 247 | keys = "SPC n r d n" | ||
| 248 | command = "app.dailies.capture-today" | ||
| 249 | mode = "normal" | ||
| 250 | [[bind]] | ||
| 251 | keys = "SPC n r d T" | ||
| 252 | command = "app.dailies.capture-today" | ||
| 253 | mode = "normal" | ||
| 254 | [[bind]] | ||
| 255 | keys = "SPC n r d Y" | ||
| 256 | command = "app.dailies.capture-yesterday" | ||
| 257 | mode = "normal" | ||
| 258 | [[bind]] | ||
| 259 | keys = "SPC n r d M" | ||
| 260 | command = "app.dailies.capture-tomorrow" | ||
| 261 | mode = "normal" | ||
| 262 | [[bind]] | ||
| 263 | keys = "SPC n r d D" | ||
| 264 | command = "app.dailies.capture-date" | ||
| 265 | mode = "normal" | ||
| 266 | [[bind]] | ||
| 267 | keys = "SPC n r d f" | ||
| 268 | command = "app.dailies.next" | ||
| 269 | mode = "normal" | ||
| 270 | [[bind]] | ||
| 271 | keys = "SPC n r d b" | ||
| 272 | command = "app.dailies.previous" | ||
| 273 | mode = "normal" | ||
| 274 | [[bind]] | ||
| 223 | keys = "SPC m a a" | 275 | keys = "SPC m a a" |
| 224 | command = "app.attach.attach" | 276 | command = "app.attach.attach" |
| 225 | mode = "normal" | 277 | mode = "normal" |
Sources/OrgCore/Keymap/PresetEmacs.swift +33
| @@ -194,6 +194,39 @@ extension KeymapPreset { | |||
| 194 | keys = "C-c C-x C-l" | 194 | keys = "C-c C-x C-l" |
| 195 | command = "org.latex-preview" | 195 | command = "org.latex-preview" |
| 196 | [[bind]] | 196 | [[bind]] |
| 197 | keys = "C-c n f" | ||
| 198 | command = "app.node.find" | ||
| 199 | [[bind]] | ||
| 200 | keys = "C-c n i" | ||
| 201 | command = "app.node.insert" | ||
| 202 | [[bind]] | ||
| 203 | keys = "C-c n j" | ||
| 204 | command = "app.dailies.capture-today" | ||
| 205 | [[bind]] | ||
| 206 | keys = "C-c n d d" | ||
| 207 | command = "app.dailies.today" | ||
| 208 | [[bind]] | ||
| 209 | keys = "C-c n d y" | ||
| 210 | command = "app.dailies.yesterday" | ||
| 211 | [[bind]] | ||
| 212 | keys = "C-c n d t" | ||
| 213 | command = "app.dailies.tomorrow" | ||
| 214 | [[bind]] | ||
| 215 | keys = "C-c n d n" | ||
| 216 | command = "app.dailies.capture-today" | ||
| 217 | [[bind]] | ||
| 218 | keys = "C-c n d f" | ||
| 219 | command = "app.dailies.next" | ||
| 220 | [[bind]] | ||
| 221 | keys = "C-c n d b" | ||
| 222 | command = "app.dailies.previous" | ||
| 223 | [[bind]] | ||
| 224 | keys = "C-c n d c" | ||
| 225 | command = "app.dailies.date" | ||
| 226 | [[bind]] | ||
| 227 | keys = "C-c n d v" | ||
| 228 | command = "app.dailies.capture-date" | ||
| 229 | [[bind]] | ||
| 197 | keys = "C-c C-x 0" | 230 | keys = "C-c C-x 0" |
| 198 | command = "org.timer.start" | 231 | command = "org.timer.start" |
| 199 | [[bind]] | 232 | [[bind]] |
Sources/OrgCore/Links/LinkStore.swift +1 −1
| @@ -156,7 +156,7 @@ extension Links { | |||
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | /// `org-link-make-string`. | 158 | /// `org-link-make-string`. |
| 159 | static func makeString(_ link: String, _ description: String?) -> String { | 159 | public static func makeString(_ link: String, _ description: String?) -> String { |
| 160 | let zeroWidthSpace = "\u{200B}" | 160 | let zeroWidthSpace = "\u{200B}" |
| 161 | let description = description.flatMap { d -> String? in | 161 | let description = description.flatMap { d -> String? in |
| 162 | guard d.contains(where: { !$0.isWhitespace }) else { return nil } | 162 | guard d.contains(where: { !$0.isWhitespace }) else { return nil } |
Sources/OrgEditorAppKit/EditorCommands.swift +12
| @@ -108,6 +108,18 @@ public enum EditorCommands { | |||
| 108 | EditorCommand(id: "app.table-import", title: "Import Table from File…", action: .app), | 108 | EditorCommand(id: "app.table-import", title: "Import Table from File…", action: .app), |
| 109 | EditorCommand(id: "app.table-export", title: "Export Table to File…", action: .app), | 109 | EditorCommand(id: "app.table-export", title: "Export Table to File…", action: .app), |
| 110 | EditorCommand(id: "app.plot", title: "Plot Table", action: .app), | 110 | EditorCommand(id: "app.plot", title: "Plot Table", action: .app), |
| 111 | EditorCommand(id: "app.dailies.today", title: "Go to Today's Daily Note", action: .app), | ||
| 112 | EditorCommand(id: "app.dailies.yesterday", title: "Go to Yesterday's Daily Note", action: .app), | ||
| 113 | EditorCommand(id: "app.dailies.tomorrow", title: "Go to Tomorrow's Daily Note", action: .app), | ||
| 114 | EditorCommand(id: "app.dailies.date", title: "Go to Daily Note for Date…", action: .app), | ||
| 115 | EditorCommand(id: "app.dailies.capture-today", title: "Capture to Today's Daily Note", action: .app), | ||
| 116 | EditorCommand(id: "app.dailies.capture-yesterday", title: "Capture to Yesterday's Daily Note", action: .app), | ||
| 117 | EditorCommand(id: "app.dailies.capture-tomorrow", title: "Capture to Tomorrow's Daily Note", action: .app), | ||
| 118 | EditorCommand(id: "app.dailies.capture-date", title: "Capture to Daily Note for Date…", action: .app), | ||
| 119 | EditorCommand(id: "app.dailies.next", title: "Next Daily Note", action: .app), | ||
| 120 | EditorCommand(id: "app.dailies.previous", title: "Previous Daily Note", action: .app), | ||
| 121 | EditorCommand(id: "app.node.find", title: "Find Node…", action: .app), | ||
| 122 | EditorCommand(id: "app.node.insert", title: "Insert Node Link…", action: .app), | ||
| 111 | EditorCommand(id: "app.attach.attach", title: "Attach File…", action: .app), | 123 | EditorCommand(id: "app.attach.attach", title: "Attach File…", action: .app), |
| 112 | EditorCommand(id: "app.attach.move", title: "Attach File by Moving…", action: .app), | 124 | EditorCommand(id: "app.attach.move", title: "Attach File by Moving…", action: .app), |
| 113 | EditorCommand(id: "app.attach.link", title: "Attach File as Hard Link…", action: .app), | 125 | EditorCommand(id: "app.attach.link", title: "Attach File as Hard Link…", action: .app), |
Sources/OrgIndex/FileRecord.swift +12 −3
| @@ -110,6 +110,10 @@ public struct FileRecord: Sendable, Equatable { | |||
| 110 | public let headings: [HeadingRecord] | 110 | public let headings: [HeadingRecord] |
| 111 | /// Links before the first heading, the file's own. | 111 | /// Links before the first heading, the file's own. |
| 112 | public let links: [LinkRow] | 112 | public let links: [LinkRow] |
| 113 | /// The `ID` in the property drawer before the first heading: the file as an org-roam node. | ||
| 114 | public let fileID: String? | ||
| 115 | /// `#+TITLE`, joined with spaces when there are several. | ||
| 116 | public let title: String? | ||
| 113 | 117 | ||
| 114 | public static func hash(_ bytes: [UInt8]) -> String { | 118 | public static func hash(_ bytes: [UInt8]) -> String { |
| 115 | SHA256.hash(data: Data(bytes)).map { String(format: "%02x", $0) }.joined() | 119 | SHA256.hash(data: Data(bytes)).map { String(format: "%02x", $0) }.joined() |
| @@ -126,7 +130,7 @@ public struct FileRecord: Sendable, Equatable { | |||
| 126 | var resolved = settings | 130 | var resolved = settings |
| 127 | resolved.org = settings.org.resolvingSetupFiles(in: source.text, path: path, read: OrgSettings.readFile) | 131 | resolved.org = settings.org.resolvingSetupFiles(in: source.text, path: path, read: OrgSettings.readFile) |
| 128 | self.settingsVersion = Self.settingsVersion(settings, text: source.text, setupKeywords: resolved.org.setupKeywords) | 132 | self.settingsVersion = Self.settingsVersion(settings, text: source.text, setupKeywords: resolved.org.setupKeywords) |
| 129 | (headings, links) = kind == .conflict ? ([], []) : Self.rows(source.text, settings: resolved) | 133 | (headings, links, fileID, title) = kind == .conflict ? ([], [], nil, nil) : Self.rows(source.text, settings: resolved) |
| 130 | } | 134 | } |
| 131 | 135 | ||
| 132 | /// The settings version a file's rows are built under: the index's, with the keywords of | 136 | /// The settings version a file's rows are built under: the index's, with the keywords of |
| @@ -160,11 +164,13 @@ public struct FileRecord: Sendable, Equatable { | |||
| 160 | self.settingsVersion = settings.version | 164 | self.settingsVersion = settings.version |
| 161 | headings = [] | 165 | headings = [] |
| 162 | links = [] | 166 | links = [] |
| 167 | fileID = nil | ||
| 168 | title = nil | ||
| 163 | } | 169 | } |
| 164 | 170 | ||
| 165 | public static func unreadHash(size: Int, mtime: Double) -> String { "unread:\(size):\(mtime)" } | 171 | public static func unreadHash(size: Int, mtime: Double) -> String { "unread:\(size):\(mtime)" } |
| 166 | 172 | ||
| 167 | static func rows(_ text: String, settings: IndexSettings) -> (headings: [HeadingRecord], links: [LinkRow]) { | 173 | static func rows(_ text: String, settings: IndexSettings) -> (headings: [HeadingRecord], links: [LinkRow], fileID: String?, title: String?) { |
| 168 | let model = DocumentModel(tree: OrgParser.parse(text, defaults: settings.org), settings: settings.semantic) | 174 | let model = DocumentModel(tree: OrgParser.parse(text, defaults: settings.org), settings: settings.semantic) |
| 169 | let utf16 = text.utf16 | 175 | let utf16 = text.utf16 |
| 170 | func slice(_ range: Range<Int>) -> String { | 176 | func slice(_ range: Range<Int>) -> String { |
| @@ -203,7 +209,10 @@ public struct FileRecord: Sendable, Equatable { | |||
| 203 | links: heading.links.map(linkRow) | 209 | links: heading.links.map(linkRow) |
| 204 | ) | 210 | ) |
| 205 | } | 211 | } |
| 206 | return (headings, model.links.map(linkRow)) | 212 | let fileID = model.property("ID", of: nil)?.value.trimmingCharacters(in: .whitespaces) |
| 213 | let zeroth = model.headings.first.map { slice(0..<$0.sectionRange.lowerBound) } ?? text | ||
| 214 | let titles = zeroth.matches(of: /(?im)^[ \t]*#\+title:[ \t]*(.*?)[ \t]*$/).map { String($0.1) } | ||
| 215 | return (headings, model.links.map(linkRow), fileID?.isEmpty == false ? fileID : nil, titles.isEmpty ? nil : titles.joined(separator: " ")) | ||
| 207 | } | 216 | } |
| 208 | 217 | ||
| 209 | static func linkRow(_ target: String) -> LinkRow { | 218 | static func linkRow(_ target: String) -> LinkRow { |
Sources/OrgIndex/IndexStore.swift +51 −5
| @@ -154,6 +154,15 @@ public final class IndexStore: Sendable { | |||
| 154 | UPDATE files SET settings_version = -1; | 154 | UPDATE files SET settings_version = -1; |
| 155 | """) | 155 | """) |
| 156 | } | 156 | } |
| 157 | migrator.registerMigration("v3") { db in | ||
| 158 | // File-level IDs and titles, for org-roam file nodes; files are read again to fill them. | ||
| 159 | try db.execute(sql: """ | ||
| 160 | ALTER TABLE files ADD COLUMN org_id TEXT; | ||
| 161 | ALTER TABLE files ADD COLUMN title TEXT; | ||
| 162 | CREATE INDEX files_org_id ON files(org_id); | ||
| 163 | UPDATE files SET settings_version = -1; | ||
| 164 | """) | ||
| 165 | } | ||
| 157 | return migrator | 166 | return migrator |
| 158 | } | 167 | } |
| 159 | 168 | ||
| @@ -187,11 +196,11 @@ public final class IndexStore: Sendable { | |||
| 187 | try db.execute(sql: "DELETE FROM files WHERE path = ?", arguments: [record.path]) | 196 | try db.execute(sql: "DELETE FROM files WHERE path = ?", arguments: [record.path]) |
| 188 | try db.execute( | 197 | try db.execute( |
| 189 | sql: """ | 198 | sql: """ |
| 190 | INSERT INTO files (path, root, kind, size, mtime, hash, settings_version, parsed_at) | 199 | INSERT INTO files (path, root, kind, size, mtime, hash, settings_version, parsed_at, org_id, title) |
| 191 | VALUES (?, ?, ?, ?, ?, ?, ?, ?) | 200 | VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) |
| 192 | """, | 201 | """, |
| 193 | arguments: [record.path, record.root, record.kind.rawValue, record.size, record.mtime, record.hash, | 202 | arguments: [record.path, record.root, record.kind.rawValue, record.size, record.mtime, record.hash, |
| 194 | record.settingsVersion, Date().timeIntervalSince1970] | 203 | record.settingsVersion, Date().timeIntervalSince1970, record.fileID, record.title] |
| 195 | ) | 204 | ) |
| 196 | let fileID = db.lastInsertedRowID | 205 | let fileID = db.lastInsertedRowID |
| 197 | for link in record.links { | 206 | for link in record.links { |
| @@ -333,10 +342,47 @@ public final class IndexStore: Sendable { | |||
| 333 | arguments: [id] | 342 | arguments: [id] |
| 334 | ).map(location) | 343 | ).map(location) |
| 335 | } | 344 | } |
| 345 | let files = try database.read { db in | ||
| 346 | try Row.fetchAll(db, sql: "SELECT path, hash FROM files WHERE org_id = ? ORDER BY path", arguments: [id]) | ||
| 347 | .map { HeadingLocation.file($0["path"], contentHash: $0["hash"]) } | ||
| 348 | } | ||
| 349 | let live = overlay.values.sorted { $0.path < $1.path }.flatMap { record in | ||
| 350 | (record.fileID == id ? [HeadingLocation.file(record.path, contentHash: record.hash)] : []) | ||
| 351 | + record.headings.filter { $0.orgID == id }.map { location(record, $0) } | ||
| 352 | } | ||
| 353 | return (files + indexed).filter { overlay[$0.path] == nil } + live | ||
| 354 | } | ||
| 355 | |||
| 356 | /// A heading or file with an ID: an org-roam node. | ||
| 357 | public struct Node: Sendable, Hashable { | ||
| 358 | public let id: String | ||
| 359 | public let title: String | ||
| 360 | public let location: HeadingLocation | ||
| 361 | } | ||
| 362 | |||
| 363 | /// Every heading and file with an ID, files first, unsaved buffers' in place of their | ||
| 364 | /// files'. A file's title is its `#+TITLE`, else its name without `.org`. | ||
| 365 | public func nodes(overlay: [String: FileRecord] = [:]) throws -> [Node] { | ||
| 366 | func fileTitle(_ path: String, _ title: String?) -> String { title ?? ((path as NSString).lastPathComponent as NSString).deletingPathExtension } | ||
| 367 | let indexed = try database.read { db in | ||
| 368 | let files = try Row.fetchAll(db, sql: "SELECT path, hash, org_id, title FROM files WHERE org_id IS NOT NULL AND kind = 'org' ORDER BY path").map { row in | ||
| 369 | Node(id: row["org_id"], title: fileTitle(row["path"], row["title"]), location: .file(row["path"], contentHash: row["hash"])) | ||
| 370 | } | ||
| 371 | let headings = try Row.fetchAll( | ||
| 372 | db, | ||
| 373 | sql: """ | ||
| 374 | SELECT f.path, f.hash, h.ordinal, h.title, h.start_offset, h.org_id | ||
| 375 | FROM headings h JOIN files f ON f.id = h.file_id | ||
| 376 | WHERE h.org_id IS NOT NULL AND f.kind = 'org' ORDER BY f.path, h.ordinal | ||
| 377 | """ | ||
| 378 | ).map { Node(id: $0["org_id"], title: $0["title"], location: location($0)) } | ||
| 379 | return files + headings | ||
| 380 | } | ||
| 336 | let live = overlay.values.sorted { $0.path < $1.path }.flatMap { record in | 381 | let live = overlay.values.sorted { $0.path < $1.path }.flatMap { record in |
| 337 | record.headings.filter { $0.orgID == id }.map { location(record, $0) } | 382 | (record.fileID.map { [Node(id: $0, title: fileTitle(record.path, record.title), location: .file(record.path, contentHash: record.hash))] } ?? []) |
| 383 | + record.headings.compactMap { heading in heading.orgID.map { Node(id: $0, title: heading.title, location: location(record, heading)) } } | ||
| 338 | } | 384 | } |
| 339 | return indexed.filter { overlay[$0.path] == nil } + live | 385 | return indexed.filter { overlay[$0.location.path] == nil } + live |
| 340 | } | 386 | } |
| 341 | 387 | ||
| 342 | /// Every link and the heading it's in, or the file for links before its first heading, | 388 | /// Every link and the heading it's in, or the file for links before its first heading, |
Sources/Orgstar/BacklinksPane.swift +3 −1
| @@ -59,7 +59,9 @@ struct BacklinksPane: View { | |||
| 59 | return | 59 | return |
| 60 | } | 60 | } |
| 61 | let overlay = workspace.overlay(session.openDocuments) | 61 | let overlay = workspace.overlay(session.openDocuments) |
| 62 | toFile = workspace.backlinks(to: Backlinks.Target(path: path), overlay: overlay) | 62 | // The file's own ID, as an org-roam file node. |
| 63 | let fileID = session.document.map { DocumentModel(tree: $0.tree).property("ID", of: nil)?.value } | ||
| 64 | toFile = workspace.backlinks(to: Backlinks.Target(path: path, id: fileID ?? nil), overlay: overlay) | ||
| 63 | guard let heading, let tree = session.document?.tree, | 65 | guard let heading, let tree = session.document?.tree, |
| 64 | let info = DocumentModel(tree: tree).headings.first(where: { $0.headingRange.lowerBound == heading.start }) else { | 66 | let info = DocumentModel(tree: tree).headings.first(where: { $0.headingRange.lowerBound == heading.start }) else { |
| 65 | toHeading = [] | 67 | toHeading = [] |
Sources/Orgstar/ContentView.swift +21
| @@ -672,6 +672,25 @@ struct ContentView: View { | |||
| 672 | } | 672 | } |
| 673 | } | 673 | } |
| 674 | 674 | ||
| 675 | /// org-roam's daily notes and nodes. | ||
| 676 | private var roamActions: RoamActions { | ||
| 677 | RoamActions( | ||
| 678 | session: session, roots: { [workspace] in workspace.rootPaths }, | ||
| 679 | nodes: { [workspace, session] in workspace.nodes(overlay: workspace.overlay(session.openDocuments)) }, | ||
| 680 | show: { [commands] in commands.show($0) }, ask: { [commands] in commands.ask($0, reply: $1) }, | ||
| 681 | open: { [commands] path, offset in commands.jump(path: path, offset: offset) }, | ||
| 682 | insertLink: { [commands] link, title in | ||
| 683 | guard let editor = commands.editor else { return commands.show("No file is open") } | ||
| 684 | let context = editor.context() | ||
| 685 | let range = context.selection.first ?? context.caret..<context.caret | ||
| 686 | let selected = (context.text as NSString).substring(with: NSRange(range)) | ||
| 687 | let text = Links.makeString(link, selected.isEmpty ? title : selected) | ||
| 688 | let end = range.lowerBound + (text as NSString).length | ||
| 689 | editor.perform(PrecomputedEdit(EditResult(baseRevision: context.revision, edits: [TextEdit(range: range, replacement: text)], selection: [end..<end]))) | ||
| 690 | }, | ||
| 691 | refresh: { [workspace] in Task { await workspace.refresh() } }) | ||
| 692 | } | ||
| 693 | |||
| 675 | /// org-attach's commands for the entry at the caret. | 694 | /// org-attach's commands for the entry at the caret. |
| 676 | private var attachActions: AttachActions { | 695 | private var attachActions: AttachActions { |
| 677 | AttachActions( | 696 | AttachActions( |
| @@ -1116,6 +1135,8 @@ struct ContentView: View { | |||
| 1116 | crypt(id) | 1135 | crypt(id) |
| 1117 | case let id where id.hasPrefix("app.attach."): | 1136 | case let id where id.hasPrefix("app.attach."): |
| 1118 | attachActions.run(id) | 1137 | attachActions.run(id) |
| 1138 | case let id where id.hasPrefix("app.dailies.") || id.hasPrefix("app.node."): | ||
| 1139 | roamActions.run(id) | ||
| 1119 | default: | 1140 | default: |
| 1120 | if let editor = commands.editor { editor.run(id) } else { commands.show("No file is open") } | 1141 | if let editor = commands.editor { editor.run(id) } else { commands.show("No file is open") } |
| 1121 | } | 1142 | } |
Sources/OrgstarMobile/BacklinksScreen.swift added +63
| @@ -0,0 +1,63 @@ | |||
| 1 | #if os(iOS) | ||
| 2 | import OrgApp | ||
| 3 | import OrgCore | ||
| 4 | import OrgIndex | ||
| 5 | import SwiftUI | ||
| 6 | |||
| 7 | /// Headings that link to the heading at the caret, and to the file, as the Mac's backlinks | ||
| 8 | /// pane lists them. | ||
| 9 | struct BacklinksScreen: View { | ||
| 10 | let workspace: WorkspaceModel | ||
| 11 | let session: DocumentSession | ||
| 12 | let path: String | ||
| 13 | let caret: Int | ||
| 14 | let open: (HeadingLocation) -> Void | ||
| 15 | @State private var heading: (title: String, links: [HeadingLocation])? | ||
| 16 | @State private var toFile: [HeadingLocation] = [] | ||
| 17 | @Environment(\.dismiss) private var dismiss | ||
| 18 | |||
| 19 | var body: some View { | ||
| 20 | NavigationStack { | ||
| 21 | List { | ||
| 22 | if let heading { | ||
| 23 | Section("Links to \(heading.title.isEmpty ? "(untitled)" : heading.title)") { rows(heading.links) } | ||
| 24 | } | ||
| 25 | Section("Links to this file") { rows(toFile) } | ||
| 26 | } | ||
| 27 | .navigationTitle("Backlinks") | ||
| 28 | .navigationBarTitleDisplayMode(.inline) | ||
| 29 | .toolbar { ToolbarItem(placement: .cancellationAction) { Button("Done") { dismiss() } } } | ||
| 30 | } | ||
| 31 | .task { refresh() } | ||
| 32 | } | ||
| 33 | |||
| 34 | @ViewBuilder | ||
| 35 | private func rows(_ locations: [HeadingLocation]) -> some View { | ||
| 36 | if locations.isEmpty { | ||
| 37 | Text("None").foregroundStyle(.secondary) | ||
| 38 | } | ||
| 39 | ForEach(locations, id: \.self) { location in | ||
| 40 | Button { | ||
| 41 | dismiss() | ||
| 42 | open(location) | ||
| 43 | } label: { | ||
| 44 | VStack(alignment: .leading, spacing: 2) { | ||
| 45 | Text(location.title.isEmpty ? "(untitled)" : location.title).lineLimit(1).foregroundStyle(.primary) | ||
| 46 | Text((location.path as NSString).lastPathComponent).font(.caption).foregroundStyle(.secondary) | ||
| 47 | } | ||
| 48 | } | ||
| 49 | } | ||
| 50 | } | ||
| 51 | |||
| 52 | private func refresh() { | ||
| 53 | let overlay = workspace.overlay(session.openDocuments) | ||
| 54 | guard let document = session.openDocuments.first(where: { $0.path == path })?.document else { return } | ||
| 55 | let model = DocumentModel(tree: document.tree) | ||
| 56 | toFile = workspace.backlinks(to: Backlinks.Target(path: path, id: model.property("ID", of: nil)?.value), overlay: overlay) | ||
| 57 | guard let info = model.headings.last(where: { $0.headingRange.lowerBound <= caret }) else { return heading = nil } | ||
| 58 | let customID = info.properties.last { $0.key.uppercased() == "CUSTOM_ID" }?.value | ||
| 59 | let target = Backlinks.Target(path: path, title: info.title, id: info.id, customID: customID) | ||
| 60 | heading = (info.title, workspace.backlinks(to: target, excluding: info.headingRange.lowerBound, overlay: overlay)) | ||
| 61 | } | ||
| 62 | } | ||
| 63 | #endif | ||
Sources/OrgstarMobile/EditorScreen.swift +49
| @@ -62,6 +62,7 @@ struct EditorScreen: View { | |||
| 62 | case columns(ColumnView.View) | 62 | case columns(ColumnView.View) |
| 63 | case plot(TablePlot.Plot) | 63 | case plot(TablePlot.Plot) |
| 64 | case crypt(CryptRequest) | 64 | case crypt(CryptRequest) |
| 65 | case backlinks | ||
| 65 | 66 | ||
| 66 | var id: String { | 67 | var id: String { |
| 67 | switch self { | 68 | switch self { |
| @@ -74,6 +75,7 @@ struct EditorScreen: View { | |||
| 74 | case .columns: "columns" | 75 | case .columns: "columns" |
| 75 | case .plot: "plot" | 76 | case .plot: "plot" |
| 76 | case .crypt(let request): request.id.uuidString | 77 | case .crypt(let request): request.id.uuidString |
| 78 | case .backlinks: "backlinks" | ||
| 77 | } | 79 | } |
| 78 | } | 80 | } |
| 79 | } | 81 | } |
| @@ -111,6 +113,18 @@ struct EditorScreen: View { | |||
| 111 | Label("Show Markup", systemImage: "chevron.left.forwardslash.chevron.right") | 113 | Label("Show Markup", systemImage: "chevron.left.forwardslash.chevron.right") |
| 112 | } | 114 | } |
| 113 | RecentClockMenu(clock: clock) { editor?.run($0) } | 115 | RecentClockMenu(clock: clock) { editor?.run($0) } |
| 116 | Button("Backlinks", systemImage: "arrow.uturn.backward.circle") { sheet = .backlinks } | ||
| 117 | Menu("Daily Notes", systemImage: "calendar") { | ||
| 118 | Button("Today", systemImage: "calendar") { roamActions.run("app.dailies.today") } | ||
| 119 | Button("Yesterday", systemImage: "chevron.backward") { roamActions.run("app.dailies.yesterday") } | ||
| 120 | Button("Tomorrow", systemImage: "chevron.forward") { roamActions.run("app.dailies.tomorrow") } | ||
| 121 | Button("Date…", systemImage: "calendar.badge.clock") { roamActions.run("app.dailies.date") } | ||
| 122 | Button("Capture to Today", systemImage: "square.and.pencil") { roamActions.run("app.dailies.capture-today") } | ||
| 123 | Button("Previous Daily Note", systemImage: "arrow.left") { roamActions.run("app.dailies.previous") } | ||
| 124 | Button("Next Daily Note", systemImage: "arrow.right") { roamActions.run("app.dailies.next") } | ||
| 125 | } | ||
| 126 | Button("Find Node…", systemImage: "point.3.connected.trianglepath.dotted") { roamActions.run("app.node.find") } | ||
| 127 | Button("Insert Node Link…", systemImage: "link") { roamActions.run("app.node.insert") } | ||
| 114 | Menu("Attachments", systemImage: "paperclip") { | 128 | Menu("Attachments", systemImage: "paperclip") { |
| 115 | Button("Attach File…", systemImage: "doc.badge.plus") { attaching = .cp } | 129 | Button("Attach File…", systemImage: "doc.badge.plus") { attaching = .cp } |
| 116 | Button("Attach Photo or Video…", systemImage: "photo.badge.plus") { attachingPhotos = true } | 130 | Button("Attach Photo or Video…", systemImage: "photo.badge.plus") { attachingPhotos = true } |
| @@ -203,6 +217,10 @@ struct EditorScreen: View { | |||
| 203 | PlotScreen(plot: plot) | 217 | PlotScreen(plot: plot) |
| 204 | case .crypt(let request): | 218 | case .crypt(let request): |
| 205 | CryptScreen(request: request, session: session, editor: editor) { message = $0 } | 219 | CryptScreen(request: request, session: session, editor: editor) { message = $0 } |
| 220 | case .backlinks: | ||
| 221 | BacklinksScreen(workspace: workspace, session: session, path: path, caret: editor?.editContext().caret ?? 0) { location in | ||
| 222 | if location.path == path { editor?.reveal(location.start) } else { model.openRequest = .heading(location) } | ||
| 223 | } | ||
| 206 | } | 224 | } |
| 207 | } | 225 | } |
| 208 | .fileImporter(isPresented: $importingTable, allowedContentTypes: [.commaSeparatedText, .tabSeparatedText, .plainText]) { result in | 226 | .fileImporter(isPresented: $importingTable, allowedContentTypes: [.commaSeparatedText, .tabSeparatedText, .plainText]) { result in |
| @@ -325,6 +343,10 @@ struct EditorScreen: View { | |||
| 325 | crypt(id) | 343 | crypt(id) |
| 326 | } else if id.hasPrefix("app.attach.") { | 344 | } else if id.hasPrefix("app.attach.") { |
| 327 | attachActions.run(id) | 345 | attachActions.run(id) |
| 346 | } else if id.hasPrefix("app.dailies.") || id.hasPrefix("app.node.") { | ||
| 347 | roamActions.run(id) | ||
| 348 | } else if id == "app.backlinks" { | ||
| 349 | sheet = .backlinks | ||
| 328 | } else if id == "app.toggle-markup" { | 350 | } else if id == "app.toggle-markup" { |
| 329 | model.showMarkup.toggle() | 351 | model.showMarkup.toggle() |
| 330 | } else if MobileEditor.linkCommands.contains(id) { | 352 | } else if MobileEditor.linkCommands.contains(id) { |
| @@ -355,6 +377,27 @@ extension EditorScreen { | |||
| 355 | } | 377 | } |
| 356 | } | 378 | } |
| 357 | 379 | ||
| 380 | /// org-roam's daily notes and nodes. | ||
| 381 | private var roamActions: RoamActions { | ||
| 382 | RoamActions( | ||
| 383 | session: session, roots: { workspace.rootPaths }, | ||
| 384 | nodes: { workspace.nodes(overlay: workspace.overlay(session.openDocuments)) }, | ||
| 385 | show: { message = $0 }, ask: { prompt = PromptRequest(prompt: $0, reply: $1) }, | ||
| 386 | open: { file, offset in | ||
| 387 | if file == path { editor?.reveal(offset) } else { model.openRequest = .offset(file, offset) } | ||
| 388 | }, | ||
| 389 | insertLink: { link, title in | ||
| 390 | guard let editor else { return } | ||
| 391 | let context = editor.editContext() | ||
| 392 | let range = context.selection.first ?? context.caret..<context.caret | ||
| 393 | let selected = (context.text as NSString).substring(with: NSRange(range)) | ||
| 394 | let text = Links.makeString(link, selected.isEmpty ? title : selected) | ||
| 395 | let end = range.lowerBound + (text as NSString).length | ||
| 396 | _ = editor.perform(PrecomputedEdit(EditResult(baseRevision: context.revision, edits: [TextEdit(range: range, replacement: text)], selection: [end..<end]))) | ||
| 397 | }, | ||
| 398 | refresh: { Task { await workspace.refresh() } }) | ||
| 399 | } | ||
| 400 | |||
| 358 | /// org-attach's commands for the entry at the caret. | 401 | /// org-attach's commands for the entry at the caret. |
| 359 | private var attachActions: AttachActions { | 402 | private var attachActions: AttachActions { |
| 360 | AttachActions( | 403 | AttachActions( |
| @@ -747,6 +790,12 @@ struct CommandPalette: View { | |||
| 747 | ("app.table-import", "Import Table from File…"), ("app.table-export", "Export Table to File…"), ("app.plot", "Plot Table"), | 790 | ("app.table-import", "Import Table from File…"), ("app.table-export", "Export Table to File…"), ("app.plot", "Plot Table"), |
| 748 | ("app.crypt.encrypt-entry", "Encrypt Entry…"), ("app.crypt.open-entry", "Decrypt Entry…"), ("app.crypt.decrypt-entry", "Decrypt Entry in File…"), | 791 | ("app.crypt.encrypt-entry", "Encrypt Entry…"), ("app.crypt.open-entry", "Decrypt Entry…"), ("app.crypt.decrypt-entry", "Decrypt Entry in File…"), |
| 749 | ("app.crypt.encrypt-entries", "Encrypt Tagged Entries…"), ("app.crypt.forget-passphrase", "Forget Encryption Passphrase"), | 792 | ("app.crypt.encrypt-entries", "Encrypt Tagged Entries…"), ("app.crypt.forget-passphrase", "Forget Encryption Passphrase"), |
| 793 | ("app.backlinks", "Show Backlinks"), ("app.node.find", "Find Node…"), ("app.node.insert", "Insert Node Link…"), | ||
| 794 | ("app.dailies.today", "Go to Today's Daily Note"), ("app.dailies.yesterday", "Go to Yesterday's Daily Note"), | ||
| 795 | ("app.dailies.tomorrow", "Go to Tomorrow's Daily Note"), ("app.dailies.date", "Go to Daily Note for Date…"), | ||
| 796 | ("app.dailies.capture-today", "Capture to Today's Daily Note"), ("app.dailies.capture-yesterday", "Capture to Yesterday's Daily Note"), | ||
| 797 | ("app.dailies.capture-tomorrow", "Capture to Tomorrow's Daily Note"), ("app.dailies.capture-date", "Capture to Daily Note for Date…"), | ||
| 798 | ("app.dailies.next", "Next Daily Note"), ("app.dailies.previous", "Previous Daily Note"), | ||
| 750 | ("app.attach.attach", "Attach File…"), ("app.attach.url", "Attach File from URL…"), ("app.attach.new", "New Attachment…"), | 799 | ("app.attach.attach", "Attach File…"), ("app.attach.url", "Attach File from URL…"), ("app.attach.new", "New Attachment…"), |
| 751 | ("app.attach.open", "Open Attachment…"), ("app.attach.reveal", "Show Attachment Folder"), ("app.attach.delete", "Delete Attachment…"), | 800 | ("app.attach.open", "Open Attachment…"), ("app.attach.reveal", "Show Attachment Folder"), ("app.attach.delete", "Delete Attachment…"), |
| 752 | ("app.attach.delete-all", "Delete All Attachments…"), ("app.attach.sync", "Sync Attachments"), | 801 | ("app.attach.delete-all", "Delete All Attachments…"), ("app.attach.sync", "Sync Attachments"), |
Sources/OrgstarMobile/FoldersScreen.swift +17
| @@ -15,6 +15,7 @@ struct FoldersScreen: View { | |||
| 15 | @State private var creating: NewItem? | 15 | @State private var creating: NewItem? |
| 16 | /// The added folder whose deletion from disk is being confirmed. | 16 | /// The added folder whose deletion from disk is being confirmed. |
| 17 | @State private var deletingRoot: String? | 17 | @State private var deletingRoot: String? |
| 18 | @Environment(MobileModel.self) private var model | ||
| 18 | 19 | ||
| 19 | var body: some View { | 20 | var body: some View { |
| 20 | List { | 21 | List { |
| @@ -70,6 +71,13 @@ struct FoldersScreen: View { | |||
| 70 | Button("Add Folder", systemImage: "folder.badge.plus") { importing = true } | 71 | Button("Add Folder", systemImage: "folder.badge.plus") { importing = true } |
| 71 | } | 72 | } |
| 72 | if !workspace.rootPaths.isEmpty { | 73 | if !workspace.rootPaths.isEmpty { |
| 74 | ToolbarItem(placement: .primaryAction) { | ||
| 75 | Menu("Daily Notes", systemImage: "calendar") { | ||
| 76 | Button("Today", systemImage: "calendar") { dailies("app.dailies.today") } | ||
| 77 | Button("Yesterday", systemImage: "chevron.backward") { dailies("app.dailies.yesterday") } | ||
| 78 | Button("Tomorrow", systemImage: "chevron.forward") { dailies("app.dailies.tomorrow") } | ||
| 79 | } | ||
| 80 | } | ||
| 73 | ToolbarItem(placement: .primaryAction) { | 81 | ToolbarItem(placement: .primaryAction) { |
| 74 | Menu("New", systemImage: "plus") { | 82 | Menu("New", systemImage: "plus") { |
| 75 | // One added folder takes them directly; several each get a submenu. | 83 | // One added folder takes them directly; several each get a submenu. |
| @@ -98,6 +106,15 @@ struct FoldersScreen: View { | |||
| 98 | } | 106 | } |
| 99 | } | 107 | } |
| 100 | } | 108 | } |
| 109 | extension FoldersScreen { | ||
| 110 | /// A daily note, opened in the reader. | ||
| 111 | private func dailies(_ id: String) { | ||
| 112 | RoamActions(session: session, roots: { workspace.rootPaths }, nodes: { [] }, show: { workspace.lastError = $0 }, ask: { $1(nil) }, | ||
| 113 | open: { path, offset in model.openRequest = .offset(path, offset) }, insertLink: { _, _ in }, | ||
| 114 | refresh: { Task { await workspace.refresh() } }).run(id) | ||
| 115 | } | ||
| 116 | } | ||
| 117 | |||
| 101 | /// A subfolder's own list, asking about its own changes. | 118 | /// A subfolder's own list, asking about its own changes. |
| 102 | private struct FolderPage: View { | 119 | private struct FolderPage: View { |
| 103 | let workspace: WorkspaceModel | 120 | let workspace: WorkspaceModel |
Sources/OrgstarMobile/MobileEditor.swift +2 −1
| @@ -304,7 +304,8 @@ final class MobileEditor: NSObject, DocumentBuffer { | |||
| 304 | "app.clock.goto-recent", "app.clock.default", "app.clock.resolve", "app.toggle-markup": return onAppCommand != nil | 304 | "app.clock.goto-recent", "app.clock.default", "app.clock.resolve", "app.toggle-markup": return onAppCommand != nil |
| 305 | case "app.refile.goto", "app.table-import", "app.crypt.encrypt-entries", "app.crypt.forget-passphrase", "app.attach.attach", "app.attach.url", | 305 | case "app.refile.goto", "app.table-import", "app.crypt.encrypt-entries", "app.crypt.forget-passphrase", "app.attach.attach", "app.attach.url", |
| 306 | "app.attach.new", "app.attach.open", "app.attach.reveal", "app.attach.delete", "app.attach.delete-all", "app.attach.sync", | 306 | "app.attach.new", "app.attach.open", "app.attach.reveal", "app.attach.delete", "app.attach.delete-all", "app.attach.sync", |
| 307 | "app.attach.set-directory", "app.attach.unset-directory": return onAppCommand != nil | 307 | "app.attach.set-directory", "app.attach.unset-directory", "app.backlinks", "app.node.find", "app.node.insert": return onAppCommand != nil |
| 308 | case _ where id.hasPrefix("app.dailies."): return onAppCommand != nil | ||
| 308 | case "app.crypt.encrypt-entry": return onAppCommand != nil && OrgCrypt.heading(context.text, at: context.caret) != nil && OrgCrypt.encryptedRange(context.text, at: context.caret) == nil | 309 | case "app.crypt.encrypt-entry": return onAppCommand != nil && OrgCrypt.heading(context.text, at: context.caret) != nil && OrgCrypt.encryptedRange(context.text, at: context.caret) == nil |
| 309 | case "app.crypt.open-entry", "app.crypt.decrypt-entry": return onAppCommand != nil && OrgCrypt.encryptedRange(context.text, at: context.caret) != nil | 310 | case "app.crypt.open-entry", "app.crypt.decrypt-entry": return onAppCommand != nil && OrgCrypt.encryptedRange(context.text, at: context.caret) != nil |
| 310 | case "app.table-export", "app.plot": return onAppCommand != nil && ImportTable.exportText(context.text, at: context.caret, path: "") != nil | 311 | case "app.table-export", "app.plot": return onAppCommand != nil && ImportTable.exportText(context.text, at: context.caret, path: "") != nil |
Tests/OrgAppTests/DailiesTests.swift added +89
| @@ -0,0 +1,89 @@ | |||
| 1 | import Foundation | ||
| 2 | import OrgCore | ||
| 3 | import OrgDocument | ||
| 4 | import OrgIndex | ||
| 5 | import Testing | ||
| 6 | @testable import OrgApp | ||
| 7 | |||
| 8 | struct DailiesTests { | ||
| 9 | /// Sun 2026-10-11 12:00 local time. | ||
| 10 | static var day: Date { Calendar.current.date(from: DateComponents(year: 2026, month: 10, day: 11, hour: 12))! } | ||
| 11 | |||
| 12 | static func emacs(_ form: String) throws -> String { | ||
| 13 | let process = Process() | ||
| 14 | process.executableURL = URL(fileURLWithPath: "/usr/bin/env") | ||
| 15 | process.arguments = [ProcessInfo.processInfo.environment["ORGSTAR_EMACS"] ?? "emacs", "-Q", "--batch", "--eval", form] | ||
| 16 | let pipe = Pipe() | ||
| 17 | process.standardOutput = pipe | ||
| 18 | process.standardError = FileHandle.nullDevice | ||
| 19 | try process.run() | ||
| 20 | let data = pipe.fileHandleForReading.readDataToEndOfFile() | ||
| 21 | process.waitUntilExit() | ||
| 22 | return String(decoding: data, as: UTF8.self) | ||
| 23 | } | ||
| 24 | |||
| 25 | /// A new daily note's text: the head under the ID drawer `org-entry-put` makes, and the | ||
| 26 | /// file name, as org-roam-capture fills them. | ||
| 27 | @Test(.enabled(if: ProcessInfo.processInfo.environment["ORGSTAR_SKIP_ORACLE"] == nil)) | ||
| 28 | func newNotesMatchEmacs() throws { | ||
| 29 | let seconds = Int(Self.day.timeIntervalSince1970) | ||
| 30 | let heads = ["#+title: %<%Y-%m-%d>\n", "#+title: %<%A, %d %B %Y>", "#+title: Day %<%j>\n#+filetags: :daily:\n"] | ||
| 31 | for head in heads { | ||
| 32 | let theirs = try Self.emacs(""" | ||
| 33 | (progn (require 'org) | ||
| 34 | (let ((head (replace-regexp-in-string "%<\\\\([^>]*\\\\)>" (lambda (m) (format-time-string (match-string 1 m) (seconds-to-time \(seconds)))) \(head.debugDescription) t t))) | ||
| 35 | (with-temp-buffer (org-mode) (insert head) (unless (bolp) (insert "\\n")) | ||
| 36 | (org-entry-put (point-min) "ID" "abc") (princ (buffer-string))))) | ||
| 37 | """) | ||
| 38 | #expect(Dailies(directory: "/n", head: head).newText(Self.day, id: "abc") == theirs, "\(head)") | ||
| 39 | } | ||
| 40 | let name = try Self.emacs("(princ (format-time-string \"%Y-%m-%d.org\" (seconds-to-time \(seconds))))") | ||
| 41 | #expect((Dailies(directory: "/n/daily").path(for: Self.day) as NSString).lastPathComponent == name) | ||
| 42 | } | ||
| 43 | |||
| 44 | @Test func nextAndPreviousNotes() throws { | ||
| 45 | let folder = FileManager.default.temporaryDirectory.appendingPathComponent("orgstar-daily-\(UUID().uuidString)").resolvingSymlinksInPath() | ||
| 46 | defer { try? FileManager.default.removeItem(at: folder) } | ||
| 47 | let dailies = Dailies(directory: folder.path) | ||
| 48 | for offset in [-3, -1, 0] { try dailies.ensure(Calendar.current.date(byAdding: .day, value: offset, to: Self.day)!) } | ||
| 49 | try "x".write(to: folder.appendingPathComponent(".hidden.org"), atomically: true, encoding: .utf8) | ||
| 50 | let today = dailies.path(for: Self.day) | ||
| 51 | #expect(dailies.files().map { ($0 as NSString).lastPathComponent } == ["2026-10-08.org", "2026-10-10.org", "2026-10-11.org"]) | ||
| 52 | #expect(try (dailies.neighbor(of: today, by: -1) as NSString).lastPathComponent == "2026-10-10.org") | ||
| 53 | #expect(throws: Dailies.Failure("Already at newest note")) { try dailies.neighbor(of: today, by: 1) } | ||
| 54 | #expect(throws: Dailies.Failure("Not in a daily-note")) { try dailies.neighbor(of: "/elsewhere/x.org", by: 1) } | ||
| 55 | // A new note isn't written over. | ||
| 56 | #expect(try dailies.ensure(Self.day).created == false) | ||
| 57 | } | ||
| 58 | |||
| 59 | @MainActor | ||
| 60 | @Test func captureFilesTheEntryAtTheEnd() throws { | ||
| 61 | let folder = FileManager.default.temporaryDirectory.appendingPathComponent("orgstar-daily-\(UUID().uuidString)").resolvingSymlinksInPath() | ||
| 62 | defer { try? FileManager.default.removeItem(at: folder) } | ||
| 63 | let session = DocumentSession(recovery: FileRecoveryStore(directory: folder.appendingPathComponent(".r"))) | ||
| 64 | var opened: (String, Int)? | ||
| 65 | let actions = RoamActions(session: session, roots: { [folder.path] }, nodes: { [] }, show: { Issue.record("\($0)") }, ask: { $1(nil) }, | ||
| 66 | open: { opened = ($0, $1) }, insertLink: { _, _ in }, refresh: {}) | ||
| 67 | actions.capture(Self.day) | ||
| 68 | let path = folder.appendingPathComponent("daily/2026-10-11.org").path | ||
| 69 | let text = try String(contentsOfFile: path, encoding: .utf8) | ||
| 70 | #expect(text.hasPrefix(":PROPERTIES:\n:ID: ")) | ||
| 71 | #expect(text.hasSuffix(":END:\n#+title: 2026-10-11\n* \n")) | ||
| 72 | #expect(opened?.0 == path && opened?.1 == (text as NSString).length - 1) | ||
| 73 | } | ||
| 74 | } | ||
| 75 | |||
| 76 | struct NodeIndexTests { | ||
| 77 | @Test func filesAndHeadingsWithIDsAreNodes() throws { | ||
| 78 | let store = try IndexStore() | ||
| 79 | let settings = IndexSettings() | ||
| 80 | let text = ":PROPERTIES:\n:ID: file-1\n:END:\n#+title: Daily\n* Task\n:PROPERTIES:\n:ID: h-1\n:END:\n* Plain\n" | ||
| 81 | try store.write(FileRecord(path: "/n/2026-10-11.org", root: "/n", kind: .org, bytes: Array(text.utf8), mtime: 1, settings: settings)) | ||
| 82 | try store.write(FileRecord(path: "/n/untitled.org", root: "/n", kind: .org, bytes: Array(":PROPERTIES:\n:ID: f2\n:END:\n".utf8), mtime: 1, settings: settings)) | ||
| 83 | let nodes = try store.nodes() | ||
| 84 | #expect(nodes.map(\.id) == ["file-1", "f2", "h-1"]) | ||
| 85 | #expect(nodes.map(\.title) == ["Daily", "untitled", "Task"]) | ||
| 86 | #expect(try store.headings(withID: "file-1").map(\.ordinal) == [HeadingLocation.fileOrdinal]) | ||
| 87 | #expect(try store.headings(withID: "h-1").map(\.title) == ["Task"]) | ||
| 88 | } | ||
| 89 | } | ||
Tests/OrgAppTests/EmacsImportTests.swift +19 −2
| @@ -143,7 +143,8 @@ struct EmacsImportTests { | |||
| 143 | let folders = result.items.compactMap { if case .folder(let f) = $0.change { f } else { nil } } | 143 | let folders = result.items.compactMap { if case .folder(let f) = $0.change { f } else { nil } } |
| 144 | #expect(folders == ["~/notes/", "~/work"]) | 144 | #expect(folders == ["~/notes/", "~/work"]) |
| 145 | #expect(result.unreadable.map(\.name) == ["fill-column"]) | 145 | #expect(result.unreadable.map(\.name) == ["fill-column"]) |
| 146 | #expect(Set(result.unsupported.map(\.name)) == ["org-support-shift-select", "doom-theme", "org-roam-directory", | 146 | #expect(s["org-roam-directory"] == .string("~/notes/roam")) |
| 147 | #expect(Set(result.unsupported.map(\.name)) == ["org-support-shift-select", "doom-theme", | ||
| 147 | "capture \"x\"", "SPC z t → tr/report", "C-c l", "agenda command \"f\""]) | 148 | "capture \"x\"", "SPC z t → tr/report", "C-c l", "agenda command \"f\""]) |
| 148 | #expect(result.skipped == 1) | 149 | #expect(result.skipped == 1) |
| 149 | #expect(result.doomDefaultsLeftOut == 1) | 150 | #expect(result.doomDefaultsLeftOut == 1) |
| @@ -182,6 +183,22 @@ struct EmacsImportTests { | |||
| 182 | #expect(s["org-icalendar-combined-agenda-file"] == .string("~/cal/org.ics")) | 183 | #expect(s["org-icalendar-combined-agenda-file"] == .string("~/cal/org.ics")) |
| 183 | } | 184 | } |
| 184 | 185 | ||
| 186 | @Test func readsDailies() throws { | ||
| 187 | let folder = FileManager.default.temporaryDirectory.appendingPathComponent("orgstar-import-\(UUID().uuidString)") | ||
| 188 | try FileManager.default.createDirectory(at: folder, withIntermediateDirectories: true) | ||
| 189 | defer { try? FileManager.default.removeItem(at: folder) } | ||
| 190 | try #""" | ||
| 191 | (setq org-roam-dailies-directory "journal/") | ||
| 192 | (setq org-roam-dailies-capture-templates | ||
| 193 | '(("d" "default" entry "* %<%H:%M> %?" :target (file+head "%<%Y-%m-%d>.org" "#+title: %<%A %d %B>\n")))) | ||
| 194 | """#.write(to: folder.appendingPathComponent("init.el"), atomically: true, encoding: .utf8) | ||
| 195 | let s = settings(EmacsImport.scan(EmacsImport.files(in: folder))) | ||
| 196 | #expect(s["org-roam-dailies-directory"] == .string("journal/")) | ||
| 197 | #expect(s["org-roam-dailies-file"] == .string("%<%Y-%m-%d>.org")) | ||
| 198 | #expect(s["org-roam-dailies-head"] == .string("#+title: %<%A %d %B>\n")) | ||
| 199 | #expect(s["org-roam-dailies-entry"] == .string("* %<%H:%M> %?")) | ||
| 200 | } | ||
| 201 | |||
| 185 | @Test func readsPublishingProjects() async throws { | 202 | @Test func readsPublishingProjects() async throws { |
| 186 | let folder = FileManager.default.temporaryDirectory.appendingPathComponent("orgstar-import-\(UUID().uuidString)") | 203 | let folder = FileManager.default.temporaryDirectory.appendingPathComponent("orgstar-import-\(UUID().uuidString)") |
| 187 | try FileManager.default.createDirectory(at: folder, withIntermediateDirectories: true) | 204 | try FileManager.default.createDirectory(at: folder, withIntermediateDirectories: true) |
| @@ -283,7 +300,7 @@ struct EmacsImportTests { | |||
| 283 | let keymap = folder.appendingPathComponent("keymap.toml") | 300 | let keymap = folder.appendingPathComponent("keymap.toml") |
| 284 | #expect(KeymapLoader.load(.doom, userFile: keymap).problems.isEmpty) | 301 | #expect(KeymapLoader.load(.doom, userFile: keymap).problems.isEmpty) |
| 285 | #expect(KeymapLoader.load(.doom, userFile: keymap).keymap.keyLabels(for: "app.agenda", modes: ["normal"]).contains("C-c a")) | 302 | #expect(KeymapLoader.load(.doom, userFile: keymap).keymap.keyLabels(for: "app.agenda", modes: ["normal"]).contains("C-c a")) |
| 286 | #expect(summary.hasPrefix("Imported 46 settings, 3 capture templates, 3 key bindings, 2 structure templates, 3 agenda views."), "\(summary)") | 303 | #expect(summary.hasPrefix("Imported 47 settings, 3 capture templates, 3 key bindings, 2 structure templates, 3 agenda views."), "\(summary)") |
| 287 | let views = AgendaViewLoader.load(userFile: folder.appendingPathComponent("views.toml")) | 304 | let views = AgendaViewLoader.load(userFile: folder.appendingPathComponent("views.toml")) |
| 288 | #expect(views.problems.isEmpty, "\(views.problems)") | 305 | #expect(views.problems.isEmpty, "\(views.problems)") |
| 289 | #expect(views.views.dropFirst(3).map(\.name) == ["Daily", "Work", "Stuck"]) | 306 | #expect(views.views.dropFirst(3).map(\.name) == ["Daily", "Work", "Stuck"]) |
docs/manual/guide/03-keys.org +19
| @@ -1037,6 +1037,25 @@ The Emacs keys also work with Control on the last key (=C-c C-a C-a=), as in Org | |||
| 1037 | | Set Attachment Folder… (=app.attach.set-directory=) | =C-c C-a s= | — | =SPC m a s= (N) | Sets the entry's =DIR= property (=org-attach-set-directory=). | | 1037 | | Set Attachment Folder… (=app.attach.set-directory=) | =C-c C-a s= | — | =SPC m a s= (N) | Sets the entry's =DIR= property (=org-attach-set-directory=). | |
| 1038 | | Unset Attachment Folder (=app.attach.unset-directory=) | =C-c C-a S= | — | — | Removes =DIR= (=org-attach-unset-directory=). | | 1038 | | Unset Attachment Folder (=app.attach.unset-directory=) | =C-c C-a S= | — | — | Removes =DIR= (=org-attach-unset-directory=). | |
| 1039 | 1039 | ||
| 1040 | ** Notes and daily notes | ||
| 1041 | |||
| 1042 | See [[file:09-links.org][Links]]. | ||
| 1043 | |||
| 1044 | | Command | Emacs | Mac | Doom | What it does | | ||
| 1045 | |-+-+-+-+-| | ||
| 1046 | | Find Node… (=app.node.find=) | =C-c n f= | — | =SPC n r f= (N) | Opens a heading or file with an ID, chosen by title (=org-roam-node-find=). | | ||
| 1047 | | Insert Node Link… (=app.node.insert=) | =C-c n i= | — | =SPC n r i= (N) | Inserts an =id:= link to a node (=org-roam-node-insert=). | | ||
| 1048 | | Go to Today's Daily Note (=app.dailies.today=) | =C-c n d d= | — | =SPC n r d t= (N) | =org-roam-dailies-goto-today=. | | ||
| 1049 | | Go to Yesterday's Daily Note (=app.dailies.yesterday=) | =C-c n d y= | — | =SPC n r d y= (N) | =org-roam-dailies-goto-yesterday=. | | ||
| 1050 | | Go to Tomorrow's Daily Note (=app.dailies.tomorrow=) | =C-c n d t= | — | =SPC n r d m= (N) | =org-roam-dailies-goto-tomorrow=. | | ||
| 1051 | | Go to Daily Note for Date… (=app.dailies.date=) | =C-c n d c= | — | =SPC n r d d= (N) | =org-roam-dailies-goto-date=. | | ||
| 1052 | | Capture to Today's Daily Note (=app.dailies.capture-today=) | =C-c n j=, =C-c n d n= | — | =SPC n r d n=, =SPC n r d T= (N) | =org-roam-dailies-capture-today=. | | ||
| 1053 | | Capture to Yesterday's Daily Note (=app.dailies.capture-yesterday=) | — | — | =SPC n r d Y= (N) | =org-roam-dailies-capture-yesterday=. | | ||
| 1054 | | Capture to Tomorrow's Daily Note (=app.dailies.capture-tomorrow=) | — | — | =SPC n r d M= (N) | =org-roam-dailies-capture-tomorrow=. | | ||
| 1055 | | Capture to Daily Note for Date… (=app.dailies.capture-date=) | =C-c n d v= | — | =SPC n r d D= (N) | =org-roam-dailies-capture-date=. | | ||
| 1056 | | Next Daily Note (=app.dailies.next=) | =C-c n d f= | — | =SPC n r d f= (N) | =org-roam-dailies-goto-next-note=. | | ||
| 1057 | | Previous Daily Note (=app.dailies.previous=) | =C-c n d b= | — | =SPC n r d b= (N) | =org-roam-dailies-goto-previous-note=. | | ||
| 1058 | |||
| 1040 | ** Unbound commands | 1059 | ** Unbound commands |
| 1041 | 1060 | ||
| 1042 | No preset binds these. Run them from the palette or a menu, or bind them in =keymap.toml=. | 1061 | No preset binds these. Run them from the palette or a menu, or bind them in =keymap.toml=. |
docs/manual/guide/09-links.org +43 −5
| @@ -122,8 +122,9 @@ a search option after =::= works the same way. | |||
| 122 | ** id links | 122 | ** id links |
| 123 | 123 | ||
| 124 | =id:= links are resolved through the index, so the target heading must be in a file | 124 | =id:= links are resolved through the index, so the target heading must be in a file |
| 125 | under one of your sidebar folders. A link to an ID that isn't indexed shows =No heading | 125 | under one of your sidebar folders. An =ID= in the property drawer before a file's first |
| 126 | has the ID= followed by the ID. | 126 | heading names the file, as org-roam's file nodes do, and the link opens the file. A link |
| 127 | to an ID that isn't indexed shows =No heading has the ID= followed by the ID. | ||
| 127 | 128 | ||
| 128 | ** Timestamps | 129 | ** Timestamps |
| 129 | 130 | ||
| @@ -275,7 +276,7 @@ The pane looks at every org file in your sidebar folders, including unsaved chan | |||
| 275 | in open buffers. A link counts when following it would lead to the heading or the | 276 | in open buffers. A link counts when following it would lead to the heading or the |
| 276 | file: | 277 | file: |
| 277 | 278 | ||
| 278 | - =id:= links to the heading's =ID=; | 279 | - =id:= links to the heading's =ID=, or to the file's own =ID= for the file section; |
| 279 | - =file:= links and plain paths (=./=, =../=, =/=, =~/=) to the file, with no search | 280 | - =file:= links and plain paths (=./=, =../=, =/=, =~/=) to the file, with no search |
| 280 | option for the file section, or with =::*Title=, =::#custom-id= or =::Title= for a | 281 | option for the file section, or with =::*Title=, =::#custom-id= or =::Title= for a |
| 281 | heading; | 282 | heading; |
| @@ -284,6 +285,42 @@ file: | |||
| 284 | Links to targets, names and line numbers are not counted. A heading's links to itself | 285 | Links to targets, names and line numbers are not counted. A heading's links to itself |
| 285 | are left out. | 286 | are left out. |
| 286 | 287 | ||
| 288 | * Nodes and daily notes | ||
| 289 | |||
| 290 | orgstar works with notes kept the org-roam way: headings and files with an =ID= are | ||
| 291 | /nodes/, linked with =id:= links, and a daily note is a file a day. It reads them from | ||
| 292 | the index, without org-roam's database. | ||
| 293 | |||
| 294 | | Command | Emacs | Doom | What it does | | ||
| 295 | |-+-+-+-| | ||
| 296 | | Find Node… | =C-c n f= | =SPC n r f= | Asks for a node by title and opens it (=org-roam-node-find=). | | ||
| 297 | | Insert Node Link… | =C-c n i= | =SPC n r i= | Asks for a node and inserts =[[id:…][Title]]=; with a selection, the selection is the description (=org-roam-node-insert=). | | ||
| 298 | | Go to Today's, Yesterday's, Tomorrow's Daily Note | =C-c n d d=, =y=, =t= | =SPC n r d t=, =y=, =m= | Opens the day's note, making it if missing (=org-roam-dailies-goto-today= and the others). | | ||
| 299 | | Go to Daily Note for Date… | =C-c n d c= | =SPC n r d d= | Asks for a date, then opens its note. | | ||
| 300 | | Capture to Today's Daily Note (and Yesterday's, Tomorrow's, for Date…) | =C-c n j=, =C-c n d n=, =C-c n d v= | =SPC n r d n=, =T=, =Y=, =M=, =D= | Files the entry template at the end of the day's note and opens it at =%?= (=org-roam-dailies-capture-today= and the others). | | ||
| 301 | | Next Daily Note, Previous Daily Note | =C-c n d f=, =b= | =SPC n r d f=, =b= | From a daily note, opens the next or previous one there is (=org-roam-dailies-goto-next-note=). | | ||
| 302 | |||
| 303 | The keys are the ones org-roam's manual suggests for Emacs and Doom's. Titles that | ||
| 304 | repeat show their file's name. A file node's title is its =#+TITLE=, or its name. | ||
| 305 | |||
| 306 | Daily notes are in =org-roam-dailies-directory= (=daily/=) under =org-roam-directory=, | ||
| 307 | which is the first sidebar folder unless set. A new note is named and started as | ||
| 308 | org-roam's default daily template does it, with an =ID= like every new org-roam file: | ||
| 309 | |||
| 310 | #+BEGIN_SRC org | ||
| 311 | ,:PROPERTIES: | ||
| 312 | ,:ID: 5f0c1e2a-… | ||
| 313 | ,:END: | ||
| 314 | ,#+title: 2026-10-11 | ||
| 315 | #+END_SRC | ||
| 316 | |||
| 317 | =org-roam-dailies-file= (="%<%Y-%m-%d>.org"=), =org-roam-dailies-head= | ||
| 318 | (="#+title: %<%Y-%m-%d>\n"=) and =org-roam-dailies-entry= (="* %?"=) change the file name, | ||
| 319 | what a new note starts with, and what capturing adds; =%<…>= formats the note's date as | ||
| 320 | =format-time-string= does. The entry is an org-capture template; its date escapes | ||
| 321 | (=%t=, =%U= and the like) use the note's day. Import from Emacs reads them from the first of | ||
| 322 | =org-roam-dailies-capture-templates=. See [[file:13-configuration.org][Configuration]]. | ||
| 323 | |||
| 287 | * Inline images | 324 | * Inline images |
| 288 | 325 | ||
| 289 | =org-toggle-inline-images= shows image links as images. | 326 | =org-toggle-inline-images= shows image links as images. |
| @@ -365,8 +402,9 @@ web, mail and other files go to the system. The iOS editor shows inline images a | |||
| 365 | Mac does; the reader doesn't. In the editor, Store Link, Store ID Link and Insert Link… | 402 | Mac does; the reader doesn't. In the editor, Store Link, Store ID Link and Insert Link… |
| 366 | are in Commands, and on a hardware keyboard the Emacs keys run them; they work as | 403 | are in Commands, and on a hardware keyboard the Emacs keys run them; they work as |
| 367 | described above, and stored links last until the app quits. =org-protocol://store-link= | 404 | described above, and stored links last until the app quits. =org-protocol://store-link= |
| 368 | links opened on the device are stored and copied too. The backlinks pane is Mac only. | 405 | links opened on the device are stored and copied too. More ▸ Backlinks lists the same |
| 369 | See [[file:14-ios.org][iOS]]. | 406 | links as the Mac's backlinks pane, for the heading at the caret and the file. See |
| 407 | [[file:14-ios.org][iOS]]. | ||
| 370 | 408 | ||
| 371 | * Code references | 409 | * Code references |
| 372 | 410 | ||
docs/manual/guide/13-configuration.org +8
| @@ -161,6 +161,7 @@ These settings have no control in the Settings window. Some are in the View menu | |||
| 161 | | =org-use-tag-inheritance=, =org-tags-exclude-from-inheritance=, =org-tag-alist= | | | 161 | | =org-use-tag-inheritance=, =org-tags-exclude-from-inheritance=, =org-tag-alist= | | |
| 162 | | =org-track-ordered-property-with-tag= | | | 162 | | =org-track-ordered-property-with-tag= | | |
| 163 | | =org-timer-format=, =org-timer-default-timer= | | | 163 | | =org-timer-format=, =org-timer-default-timer= | | |
| 164 | | =org-roam-directory=, =org-roam-dailies-directory=, =org-roam-dailies-file=, =org-roam-dailies-head=, =org-roam-dailies-entry= | | | ||
| 164 | | =org-attach-id-dir=, =org-attach-use-inheritance= | | | 165 | | =org-attach-id-dir=, =org-attach-use-inheritance= | | |
| 165 | | =org-crypt-tag-matcher= | | | 166 | | =org-crypt-tag-matcher= | | |
| 166 | | =org-agenda-start-on-weekday= | | | 167 | | =org-agenda-start-on-weekday= | | |
| @@ -211,6 +212,11 @@ A key you remove from the file goes back to its default. A key that isn't in the | |||
| 211 | | =org-tags-exclude-from-inheritance= | string | =""= | Tags that never inherit, separated by spaces. Read at launch. Mirrors =org-tags-exclude-from-inheritance=. | | 212 | | =org-tags-exclude-from-inheritance= | string | =""= | Tags that never inherit, separated by spaces. Read at launch. Mirrors =org-tags-exclude-from-inheritance=. | |
| 212 | | =org-tag-alist= | string | =""= | The tags Set Tags offers in files without =#+TAGS=, in =#+TAGS= syntax with keys and groups, rows separated by =\n=. Mirrors =org-tag-alist=. | | 213 | | =org-tag-alist= | string | =""= | The tags Set Tags offers in files without =#+TAGS=, in =#+TAGS= syntax with keys and groups, rows separated by =\n=. Mirrors =org-tag-alist=. | |
| 213 | | =org-track-ordered-property-with-tag= | string | ="nil"= | A tag that Toggle ORDERED Property adds and removes with the property: ="t"= for the tag =ORDERED=, or a tag name. Mirrors =org-track-ordered-property-with-tag=. | | 214 | | =org-track-ordered-property-with-tag= | string | ="nil"= | A tag that Toggle ORDERED Property adds and removes with the property: ="t"= for the tag =ORDERED=, or a tag name. Mirrors =org-track-ordered-property-with-tag=. | |
| 215 | | =org-roam-directory= | string | =""= | The folder org-roam notes are in; empty for the first sidebar folder. Mirrors =org-roam-directory=. | | ||
| 216 | | =org-roam-dailies-directory= | string | ="daily/"= | The folder daily notes are in, relative to =org-roam-directory=. Mirrors =org-roam-dailies-directory=. | | ||
| 217 | | =org-roam-dailies-file= | string | ="%<%Y-%m-%d>.org"= | A daily note's file name; =%<…>= formats its date. | | ||
| 218 | | =org-roam-dailies-head= | string | ="#+title: %<%Y-%m-%d>\n"= | What a new daily note starts with, under its =ID=. | | ||
| 219 | | =org-roam-dailies-entry= | string | ="* %?"= | The capture template Capture to Daily Note files. See [[file:09-links.org][Links]]. | | ||
| 214 | | =org-timer-format= | string | ="%s "= | What Insert Timer Value writes, with =%s= for the =h:mm:ss= value. Mirrors =org-timer-format=. | | 220 | | =org-timer-format= | string | ="%s "= | What Insert Timer Value writes, with =%s= for the =h:mm:ss= value. Mirrors =org-timer-format=. | |
| 215 | | =org-timer-default-timer= | string | ="0"= | The countdown Set Countdown Timer… offers, in minutes or =h:mm:ss=; ="0"= offers none. Mirrors =org-timer-default-timer=. | | 221 | | =org-timer-default-timer= | string | ="0"= | The countdown Set Countdown Timer… offers, in minutes or =h:mm:ss=; ="0"= offers none. Mirrors =org-timer-default-timer=. | |
| 216 | | =org-attach-id-dir= | string | ="data/"= | The folder ID-based attachment folders go in, relative to the org file's folder unless absolute. See [[file:04-outlines.org][Outlines]]. Mirrors =org-attach-id-dir=. | | 222 | | =org-attach-id-dir= | string | ="data/"= | The folder ID-based attachment folders go in, relative to the org file's folder unless absolute. See [[file:04-outlines.org][Outlines]]. Mirrors =org-attach-id-dir=. | |
| @@ -573,6 +579,8 @@ Only variables whose names start with =org-=, =appt-=, =display-line-numbers=, = | |||
| 573 | | =org-agenda-log-mode-items= | The symbols =closed=, =clock= and =state= of the list, separated by spaces | | 579 | | =org-agenda-log-mode-items= | The symbols =closed=, =clock= and =state= of the list, separated by spaces | |
| 574 | | =org-agenda-todo-ignore-scheduled=, =-deadlines=, =-timestamp= | The symbol or number as a string; =org-agenda-todo-ignore-with-date= and =org-agenda-tags-todo-honor-ignore-options= as booleans | | 580 | | =org-agenda-todo-ignore-scheduled=, =-deadlines=, =-timestamp= | The symbol or number as a string; =org-agenda-todo-ignore-with-date= and =org-agenda-tags-todo-honor-ignore-options= as booleans | |
| 575 | | =org-track-ordered-property-with-tag= | A tag name as given; =t= becomes ="t"=, =nil= ="nil"= | | 581 | | =org-track-ordered-property-with-tag= | A tag name as given; =t= becomes ="t"=, =nil= ="nil"= | |
| 582 | | =org-roam-directory=, =org-roam-dailies-directory= | The same keys, when the value is a string or a form that makes one | | ||
| 583 | | =org-roam-dailies-capture-templates= | =org-roam-dailies-file=, =-head= and =-entry=, from the first template's =(file+head NAME HEAD)= target and template | | ||
| 576 | | =org-timer-format=, =org-timer-default-timer= | The same keys; a number becomes a string | | 584 | | =org-timer-format=, =org-timer-default-timer= | The same keys; a number becomes a string | |
| 577 | | =org-attach-id-dir= | The same key, when the value is a string or an =expand-file-name= form | | 585 | | =org-attach-id-dir= | The same key, when the value is a string or an =expand-file-name= form | |
| 578 | | =org-attach-use-inheritance= | =selective=, or =t= / =nil= as ="t"= / ="nil"= | | 586 | | =org-attach-use-inheritance= | =selective=, or =t= / =nil= as ="t"= / ="nil"= | |
docs/manual/guide/14-ios.org +4 −1
| @@ -133,6 +133,8 @@ Cancel answers nothing, as =C-g= does. | |||
| 133 | 133 | ||
| 134 | =C-c '= on a block, and =C-c `= on a table field, open the text in a sheet of its own; Save puts it back. A src block's code is colored as its language, as in the editor. | 134 | =C-c '= on a block, and =C-c `= on a table field, open the text in a sheet of its own; Save puts it back. A src block's code is colored as its language, as in the editor. |
| 135 | 135 | ||
| 136 | More ▸ Backlinks lists the links to the heading at the caret and to the file; More ▸ Daily Notes, Find Node… and Insert Node Link… work with org-roam-style notes, and the Folders tab's calendar menu opens today's, yesterday's and tomorrow's note. See [[file:09-links.org][Links]]. | ||
| 137 | |||
| 136 | The org-timer commands are in Commands; a running timer shows above the text. See [[file:06-dates-and-clocking.org][Dates and clocking]]. | 138 | The org-timer commands are in Commands; a running timer shows above the text. See [[file:06-dates-and-clocking.org][Dates and clocking]]. |
| 137 | 139 | ||
| 138 | More ▸ Attachments has the org-attach commands and Attach Photo or Video…; files shared to orgstar can be attached to an entry. See [[file:04-outlines.org][Outlines]]. | 140 | More ▸ Attachments has the org-attach commands and Attach Photo or Video…; files shared to orgstar can be attached to an entry. See [[file:04-outlines.org][Outlines]]. |
| @@ -355,6 +357,7 @@ These settings from =config.toml= apply on iOS: | |||
| 355 | - =[theme]= (=font=, =font-size=, =line-spacing=, =heading-size-step=, =theme-file= and colours), =[theme.light]=, =[theme.dark]=, =[theme.todo]=, =[theme.category]= | 357 | - =[theme]= (=font=, =font-size=, =line-spacing=, =heading-size-step=, =theme-file= and colours), =[theme.light]=, =[theme.dark]=, =[theme.todo]=, =[theme.category]= |
| 356 | - =org-log-done=, =org-log-reschedule=, =org-log-redeadline=, =org-log-into-drawer= | 358 | - =org-log-done=, =org-log-reschedule=, =org-log-redeadline=, =org-log-into-drawer= |
| 357 | - =org-enforce-todo-dependencies=, =org-enforce-todo-checkbox-dependencies=, =org-track-ordered-property-with-tag=, =org-agenda-dim-blocked-tasks= | 359 | - =org-enforce-todo-dependencies=, =org-enforce-todo-checkbox-dependencies=, =org-track-ordered-property-with-tag=, =org-agenda-dim-blocked-tasks= |
| 360 | - =org-roam-directory=, =org-roam-dailies-directory=, =org-roam-dailies-file=, =org-roam-dailies-head=, =org-roam-dailies-entry= | ||
| 358 | - =org-crypt-tag-matcher=, =org-attach-id-dir=, =org-attach-use-inheritance=, =org-timer-format=, =org-timer-default-timer= | 361 | - =org-crypt-tag-matcher=, =org-attach-id-dir=, =org-attach-use-inheritance=, =org-timer-format=, =org-timer-default-timer= |
| 359 | - =org-archive-location=, =[org-structure-template-alist]= | 362 | - =org-archive-location=, =[org-structure-template-alist]= |
| 360 | - =org-use-tag-inheritance=, =org-tags-exclude-from-inheritance=, =org-tag-alist= | 363 | - =org-use-tag-inheritance=, =org-tags-exclude-from-inheritance=, =org-tag-alist= |
| @@ -379,7 +382,7 @@ Quick Look in the Files app shows org files as the HTML export renders them. | |||
| 379 | - ODT, LaTeX, ASCII and LaTeX-made PDF export, and publishing. | 382 | - ODT, LaTeX, ASCII and LaTeX-made PDF export, and publishing. |
| 380 | - Idle detection while a clock runs. | 383 | - Idle detection while a clock runs. |
| 381 | - Import from Emacs. | 384 | - Import from Emacs. |
| 382 | - The Columns inspector, the backlinks pane, and the buffer list and tab bar. The board and column view are there (see [[file:07-agenda.org][The agenda]] and [[file:04-outlines.org][Outlines]]). | 385 | - The Columns inspector, and the buffer list and tab bar. The board and column view are there (see [[file:07-agenda.org][The agenda]] and [[file:04-outlines.org][Outlines]]). |
| 383 | - The global capture hotkey and the Settings window. | 386 | - The global capture hotkey and the Settings window. |
| 384 | - Explicit saving. | 387 | - Explicit saving. |
| 385 | 388 | ||
docs/manual/guide/15-alongside-emacs.org +1
| @@ -248,6 +248,7 @@ Other: | |||
| 248 | - =display-line-numbers-type= has no relative or visual mode. | 248 | - =display-line-numbers-type= has no relative or visual mode. |
| 249 | - The agenda's text search (see [[file:07-agenda.org][The agenda]]) covers the agenda files only: =org-agenda-text-search-extra-files= and =org-agenda-search-view-max-outline-level= aren't supported. It runs from the view menu rather than the dispatcher's =s= and =S=, and the search view's =[=, =]=, ={= and =}= keys, which add words and regexps to the search, aren't supported. | 249 | - The agenda's text search (see [[file:07-agenda.org][The agenda]]) covers the agenda files only: =org-agenda-text-search-extra-files= and =org-agenda-search-view-max-outline-level= aren't supported. It runs from the view menu rather than the dispatcher's =s= and =S=, and the search view's =[=, =]=, ={= and =}= keys, which add words and regexps to the search, aren't supported. |
| 250 | - In regexps, =\<=, =\>= and =\b= use Org's word syntax but don't find a word boundary where the script changes between two word characters, as Emacs does (for example between an emoji and a letter). | 250 | - In regexps, =\<=, =\>= and =\b= use Org's word syntax but don't find a word boundary where the script changes between two word characters, as Emacs does (for example between an emoji and a letter). |
| 251 | - org-roam: nodes come from orgstar's index, not org-roam's database, so =ROAM_ALIASES=, =ROAM_REFS=, =ROAM_EXCLUDE=, node tags in the chooser and the graph aren't supported. Insert Node Link… and Find Node… don't make new nodes from a title that isn't found. Daily notes use the first of =org-roam-dailies-capture-templates=, without choosing among several, and the date prompt prefers future dates, where org-roam prefers past ones. Capturing to a daily note files the entry at once rather than in a capture buffer. | ||
| 251 | - org-timer: =org-timer-display= is always the mode line. The timer's =C-u= forms are separate commands bound to =C-u C-c C-x 0=, =C-u C-u C-c C-x 0= and =C-u C-c C-x ,=; Set Countdown Timer… has no prefix-argument forms. | 252 | - org-timer: =org-timer-display= is always the mode line. The timer's =C-u= forms are separate commands bound to =C-u C-c C-x 0=, =C-u C-u C-c C-x 0= and =C-u C-c C-x ,=; Set Countdown Timer… has no prefix-argument forms. |
| 252 | - Radio lists are Org 9.8's =#+ATTR_ORG: :radio= checkbox lists. The =#+ORGLST= radio lists of Org 9.1 and earlier, removed in Org 9.2, aren't supported, nor is =org-list-checkbox-radio-mode=. | 253 | - Radio lists are Org 9.8's =#+ATTR_ORG: :radio= checkbox lists. The =#+ORGLST= radio lists of Org 9.1 and earlier, removed in Org 9.2, aren't supported, nor is =org-list-checkbox-radio-mode=. |
| 253 | - org-attach: =org-attach-method= is always =cp= for Attach File… (the other methods have their own commands), =org-attach-auto-tag= is always =ATTACH=, =org-attach-preferred-new-method= is always =id=, and =org-attach-id-to-path-function-list= is Org's default. The dispatcher's =b=, =O= and =F= keys and =org-attach-archive-delete= aren't supported. Delete All Attachments… asks once and deletes the folder with what's in it. | 254 | - org-attach: =org-attach-method= is always =cp= for Attach File… (the other methods have their own commands), =org-attach-auto-tag= is always =ATTACH=, =org-attach-preferred-new-method= is always =id=, and =org-attach-id-to-path-function-list= is Org's default. The dispatcher's =b=, =O= and =F= keys and =org-attach-archive-delete= aren't supported. Delete All Attachments… asks once and deletes the folder with what's in it. |