Replace across files; rename a tag or TODO keyword everywhere !487

merged merged by cmc on 2026-11-26 08:18 UTC · krz/orgstar:m5-replace into main

Discussion

cmc 2026-11-26 08:17 UTC

Closes #151.

  • Replace in Files… (Mac, Edit ▸ Find, ⌥⇧⌘F, palette): one folder or all folders, plain text or ICU regexp (the find bar's and :s's dialect; \1/$1, \&), case-fold-search with search-upper-case and case-replace as replace-match does. Preview by file and line, each match or file can be unticked. Search runs off the main actor, shows progress, can be stopped. Org files plus .txt/.md/.markdown.
  • Rename Tag… / Rename TODO Keyword… (Mac Org ▸ TODO and Tags and palette; iOS Commands): only heading tags, #+TAGS, #+FILETAGS; only heading keywords and #+TODO/#+SEQ_TODO/#+TYP_TODO. Tags realigned as org-set-tags (and after a keyword change, as org-todo). Existing name merges; done/not-done crossing refused with the file named. Optional change of org-tag-alist/org-todo-keywords in config.toml. Headings keep their keyword where the new one wouldn't be a keyword (file defines it, setup file in scope, or config renamed).
  • Applying: DocumentSession.applyChanges. Open buffer: one undoable edit, saved per save mode. Not open (or open without an editor): old text kept in recovery as replace ("Before a change across files"), then written through Saver. A file changed since the search is left alone.
  • Skipped: .gpg files; PGP armored blocks under headings tagged org-crypt-tag-matcher (own or inherited).
  • Tests: Tests/OrgCoreTests/ReplaceTests.swift (Emacs oracle: perform-replace case rules and groups, org-set-tags alignment, keyword parsing and org-align-tags after rename), Tests/OrgAppTests/ReplaceInFilesTests.swift (files not open, open buffer with unsaved edits and undo, unticked, stale file, cancel, config, refusals).
  • Manual: 02-the-editor (Replacing in many files), 05-todos-and-tags, 14-ios. 43 strings in the catalog with de, es, fr, ja, pt-BR.
  • swift test, both Xcode builds green. Mac sheets checked by snapshot; iOS screen checked only by build (needs a simulator or device).
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form