Commit 7b8e9c5338

7b8e9c5338e64edcb9d405f5449784741a5bdfa2

parent: 9e1739554b

Verified · cmc

cmc <hello@cleberg.net> · 2026-11-21 09:56 UTC

Keep relative org-agenda-files entries on iOS import

Layout: unified · split

Sources/OrgApp/EmacsImport.swift +8 −2
@@ -1096,8 +1096,9 @@ extension EmacsImport {
10961096 }
10971097
10981098 /// `org-agenda-files` (one path a line) with each path below a folder in `chosenFolders` moved
1099 /// to the folder chosen for it. Paths with no chosen folder that don't exist here are left
1100 /// out; nil when none remain. With `keepingOriginals`, for a config.toml the Mac reads too,
1099 /// to the folder chosen for it. Relative paths are kept as written; they count from the first
1100 /// folder, standing in for `org-directory`. Other paths with no chosen folder that don't exist
1101 /// here are left out; nil when none remain. With `keepingOriginals`, for a config.toml the Mac reads too,
11011102 /// the Mac's paths are all kept, a moved one beside its new path; each device skips the paths
11021103 /// it doesn't have.
11031104 static func agendaFiles(_ list: String, chosenFolders: [String: URL], keepingOriginals: Bool = false) -> String? {
@@ -1105,6 +1106,11 @@ extension EmacsImport {
11051106 let folders = chosenFolders.map { (standard($0.key), $0.value.standardizedFileURL.path) }.sorted { $0.0.count > $1.0.count }
11061107 var here: [String] = [], all: [String] = []
11071108 for path in list.split(separator: "\n").map(String.init) {
1109 guard OrgPaths.expandingTilde(path).hasPrefix("/") else {
1110 here.append(path)
1111 all.append(path)
1112 continue
1113 }
11081114 let full = standard(path)
11091115 if let (mac, device) = folders.first(where: { full == $0.0 || full.hasPrefix($0.0 + "/") }) {
11101116 let moved = device + full.dropFirst(mac.count)
Tests/OrgAppTests/EmacsImportFoldersTests.swift +4
@@ -52,6 +52,10 @@ struct EmacsImportFoldersTests {
5252 // A config.toml the Mac reads too keeps the Mac's paths beside the device's.
5353 let shared = EmacsImport.agendaFiles("\(mac)/inbox.org\n\(other)/b.org", chosenFolders: [mac: picked.url], keepingOriginals: true)
5454 #expect(shared == "\(mac)/inbox.org\n\(dir)/inbox.org\n\(other)/b.org")
55
56 // Relative paths count from org-directory, so they're kept as written.
57 #expect(EmacsImport.agendaFiles("work.org", chosenFolders: ["~/org": picked.url, "": picked.url]) == "work.org")
58 #expect(EmacsImport.agendaFiles("work.org\n\(mac)/inbox.org", chosenFolders: [mac: picked.url]) == "work.org\n\(dir)/inbox.org")
5559 }
5660
5761 @Test func withoutChosenFoldersAddsWhatsWritten() async throws {
docs/manual/guide/14-ios.org +1 −1
@@ -393,7 +393,7 @@ Import from Emacs reads an Emacs or Doom configuration folder, such as a synced
393393
394394With a configuration folder, settings and structure templates are written to its =config.toml=, and capture templates, key bindings and agenda views to its =capture.toml=, =keymap.toml= and =views.toml=, so the Mac reads them too. Without one, settings are kept on the device.
395395
396Folders from =org-directory= and =org-agenda-files= name the Mac's paths, so the screen lists them under Folders on this device. Tap each one and choose the folder on this device that holds the same files, such as its synced copy in iCloud Drive. Import adds the chosen folders to the Folders tab; folders not chosen aren't added, and the summary says so. =org-agenda-files= entries in a chosen folder point to the same files in the folder chosen for it, and entries in folders not chosen are left out. With a configuration folder, =config.toml= keeps the Mac's entries as well, beside the device's; each device skips the files it doesn't have.
396Folders from =org-directory= and =org-agenda-files= name the Mac's paths, so the screen lists them under Folders on this device. Tap each one and choose the folder on this device that holds the same files, such as its synced copy in iCloud Drive. Import adds the chosen folders to the Folders tab; folders not chosen aren't added, and the summary says so. =org-agenda-files= entries in a chosen folder point to the same files in the folder chosen for it, and entries in folders not chosen are left out. Relative entries are kept as written and count from the first folder, as Emacs counts them from =org-directory=. With a configuration folder, =config.toml= keeps the Mac's entries as well, beside the device's; each device skips the files it doesn't have.
397397
398398The Agenda, TODO Dependencies, Calendar and Reminders sections are the only places the app changes a setting itself, besides Import from Emacs:
399399