Noticed this a few times. When I run query-replace, it functions as usual. However, when I’m done with the query-replace, it seems to break org-fold. I can’t fold/unfold headings anymore. I had the same issue the other day with replace-string as well. Killing buffer and coming back fixes it. ------------------------------------------------------------------------ Emacs : GNU Emacs 29.1 (build 1, aarch64-apple-darwin21.6.0, Carbon Version 165 AppKit 2113.6) of 2023-08-08 Package: Org mode version 9.6.6 (release_9.6.6 @ /Applications/Emacs.app/Contents/Resources/lisp/org/) current state: ============== (setq org-agenda-prefix-format '((agenda . " %?-10t %s ") (timeline . " % s") (todo . " %s ") (tags . " %i ") (search . " %i %-12:c")) org-archive-location "~/Emacs/Archive.org::" org-log-note-headings '((note . "%t")) org-link-elisp-confirm-function nil org-agenda-skip-deadline-prewarning-if-scheduled t org-hide-emphasis-markers t org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn ENTRY)"] org-download-file-format-function 'org-download-file-format-default org-attach-id-to-path-function-list '(org-attach-id-ts-folder-format) org-agenda-custom-commands '(("i" "INBOX + AGENDA" ((todo "NEXT" ((org-agenda-overriding-header "Next")) (org-agenda-skip-function '(org-agenda-skip-entry-if 'date 'timestamp 'deadline 'scheduled) ) (org-agenda-block-separator nil)) (tags-todo "inbox" ((org-agenda-overriding-header "Inbox") (org-agenda-skip-function '(org-agenda-skip-entry-if 'timestamp 'deadline 'scheduled 'todo '("PROJECT" "NEXT" "WAITING" "DONE" "CANCELLED")) ) (org-agenda-block-separator nil)) ) (agenda "") (todo "PROJECT" ((org-agenda-overriding-header "Projects") (org-agenda-skip-function '(org-agenda-skip-entry-if 'tags '("tickler"))) (org-agenda-block-separator 61)) ) (tags-todo "@pam" ((org-agenda-overriding-header "@Pam") (org-agenda-block-separator 61) (org-agenda-skip-function '(org-agenda-skip-entry-if 'deadline 'scheduled 'todo '("PROJECT" "NEXT" "WAITING" "DONE" "CANCELLED")) ) ) ) (tags-todo "@work" ((org-agenda-overriding-header "@Work") (org-agenda-block-separator nil) (org-agenda-skip-function '(org-agenda-skip-entry-if 'deadline 'scheduled 'todo '("PROJECT" "NEXT" "WAITING" "DONE" "CANCELLED")) ) ) ) (tags-todo "@home" ((org-agenda-overriding-header "@Home") (org-agenda-block-separator nil) (org-agenda-skip-function '(org-agenda-skip-entry-if 'deadline 'scheduled 'todo '("PROJECT" "NEXT" "WAITING" "DONE" "CANCELLED")) ) ) ) (todo "WAITING" ((org-agenda-overriding-header "@Waiting/@Calendar") (org-agenda-block-separator nil)) ) ) ) ) org-agenda-skip-scheduled-if-done t org-agenda-files '("~/Emacs/Todo.org" "~/Emacs/Journal.org" "~/Emacs/Notes.org" "~/Emacs/.emacs.d/config.org" "~/Emacs/calendar-beorg.org") org-capture-templates '(("t" "Todo" entry (file+olp+datetree "~/Dropbox/Emacs/Todo.org") "* TODO %^{Headline}\n%?" :clock-in nil :clock-resume nil) ("0" "Quick Capture - Todo" entry (file+olp+datetree "~/Dropbox/Emacs/Todo.org") "* TODO %^{Headline}" :clock-in nil :clock-resume nil :immediate-finish 1) ("l" "Log (Clocks In)" entry (file+olp+datetree "~/Dropbox/Emacs/Todo.org") "* %^{Headline}\n%?" :clock-in t :clock-resume t) ("p" "Project" entry (file+headline "~/Dropbox/Emacs/Todo.org" "PROJECTS") "* PROJECT %^{Headline}\n%?" :clock-in nil :clock-resume nil) ("n" "Note" entry (file+headline "~/Dropbox/Emacs/Notes.org" "NOTES TO PROCESS") "* %^{Headline}\n%?" :clock-in nil :clock-resume nil) ("j" "Journal" entry (file+olp+datetree "~/Dropbox/Emacs/Journal.org") "* %^{Headline}\n%?" :clock-in nil :clock-resume nil) ) org-persist-after-read-hook '(org-element--cache-persist-after-read) org-refile-targets '((org-agenda-files :maxlevel . 9)) org-export-before-parsing-hook '(org-attach-expand-links) org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-download-method 'attach org-archive-hook '(org-attach-archive-delete-maybe) org-speed-commands '(("a" . org-attach-reveal-in-emacs) ("A" . org-archive-subtree-default-with-confirmation) ("&" . org-mark-ring-goto) ("o" . jqg/speed-link-o) ("z" . org-add-note) ("Outline Navigation") ("n" org-speed-move-safe 'org-next-visible-heading) ("p" org-speed-move-safe 'org-previous-visible-heading) ("f" org-speed-move-safe 'org-forward-heading-same-level) ("b" org-speed-move-safe 'org-backward-heading-same-level) ("F" . org-next-block) ("B" . org-previous-block) ("u" org-speed-move-safe 'outline-up-heading) ("j" . org-goto) ("g" org-refile '(4)) ("Outline Visibility") ("c" . org-cycle) ("C" . org-shifttab) (" " . org-display-outline-path) ("s" . org-toggle-narrow-to-subtree) ("k" . org-cut-subtree) ("=" . org-columns) ("Outline Structure Editing") ("U" . org-metaup) ("D" . org-metadown) ("r" . org-metaright) ("l" . org-metaleft) ("R" . org-shiftmetaright) ("L" . org-shiftmetaleft) ("i" progn (forward-char 1) (call-interactively 'org-insert-heading-respect-content)) ("^" . org-sort) ("w" . org-refile) ("a" . org-archive-subtree-default-with-confirmation) ("@" . org-mark-subtree) ("#" . org-toggle-comment) ("Clock Commands") ("I" . org-clock-in) ("O" . org-clock-out) ("Meta Data Editing") ("t" . org-todo) ("," org-priority) ("0" org-priority 32) ("1" org-priority 65) ("2" org-priority 66) ("3" org-priority 67) (":" . org-set-tags-command) ("e" . org-set-effort) ("E" . org-inc-effort) ("W" lambda (m) (interactive "sMinutes before warning: ") (org-entry-put (point) "APPT_WARNTIME" m)) ("Agenda Views etc") ("v" . org-agenda) ("/" . org-sparse-tree) ("Misc") ("o" . org-open-at-point) ("?" . org-speed-command-help) ("<" org-agenda-set-restriction-lock 'subtree) (">" org-agenda-remove-restriction-lock)) org-file-apps '((auto-mode . emacs) (directory . emacs) ("\\.mm\\'" . default) ("\\.x?html?\\'" . default) ("\\.pdf\\'" . default) ("\\.m4a\\'" . default) ("\\.m4v\\'" . default) ("\\.mp3\\'" . default) ("\\.wav\\'" . default) ("\\.jpg\\'" . default) ("\\.jpeg\\'" . default) ("\\.png\\'" . default) ("\\.tiff\\'" . default) ("\\.docx\\'" . default)) org-columns-default-format "%50ITEM(Task) %10CLOCKSUM %16TIMESTAMP_IA" org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-show-empty-lines org-cycle-optimize-window-after-visibility-change org-cycle-display-inline-images) org-persist-before-read-hook '(org-element--cache-persist-before-read) org-image-actual-width 400 org-attach-use-inheritance nil org-mode-hook '((lambda nil (org-bullets-mode 1)) org-clock-load #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-fold-show-all append local] 5] #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec org-babel-hide-all-hashes) org-follow-link-hook '(recenter-top-bottom) org-babel-load-languages '((shell . t)) org-agenda-skip-deadline-if-done t org-id-ts-format "%Y%m%d%H%M%S" org-agenda-start-with-log-mode t org-agenda-time-grid '((daily today required-time) nil "......" "----------------") org-agenda-span 'day org-download-timestamp "%Y%m%d%H%M%S_" org-download-abbreviate-filename-function 'expand-file-name org-present-mode-hook '((lambda nil (olivetti-set-width 20) (hide-mode-line-mode 1) (org-present-big) (org-display-inline-images)) ) org-present-mode-quit-hook '((lambda nil (olivetti-set-width 79) (hide-mode-line-mode 0) (org-present-small)) ) org-download-annotate-function 'dummy-org-download-annotate-function outline-isearch-open-invisible-function 'outline-isearch-open-invisible org-agenda-sorting-strategy '((agenda scheduled-up time-up deadline-up) (todo alpha-up) (tags alpha-up) (search category-up tag-up)) org-startup-indented t org-fold-catch-invisible-edits 'error org-use-speed-commands t org-agenda-before-write-hook '(org-agenda-add-entry-text) org-agenda-after-show-hook '((lambda nil (org-narrow-to-subtree) (org-fold-show-children)) ) org-complete-tags-always-offer-all-agenda-tags t org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-agenda-window-setup 'current-window org-cycle-separator-lines 0 org-todo-keywords '((sequence "TODO(t)" "PROJECT(p)" "NEXT(n)" "WAITING(w)" "|" "DONE" "CANCELLED") ) org-id-link-to-org-use-id 'create-if-interactive org-structure-template-alist '(("a" . "export ascii") ("c" . "center") ("C" . "comment") ("e" . "example") ("E" . "export") ("h" . "export html") ("l" . "export latex") ("q" . "quote") ("s" . "src") ("v" . "verse") ("sl" . "src emacs-lisp")) org-blocker-hook '(org-block-todo-from-children-or-siblings-or-parent) org-speed-command-hook '(org-speed-command-activate org-babel-speed-command-activate) org-enforce-todo-dependencies t org-bullets-bullet-list '("►") org-todo-repeat-hook '(org-reset-checkbox-state-subtree) org-confirm-babel-evaluate nil org-fold-core-isearch-open-function 'org-fold--isearch-reveal org-clock-persist t org-persist-before-write-hook '(org-element--cache-persist-before-write) org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-link-shell-confirm-function nil org-babel-pre-tangle-hook '(save-buffer) org-agenda-loop-over-headlines-in-active-region nil org-fontify-quote-and-verse-blocks t org-agenda-start-on-weekday t org-attach-id-dir "~/Emacs/Files" org-attach-method 'mv org-occur-hook '(org-first-headline-recenter) org-metadown-hook '(org-babel-pop-to-session-maybe) org-link-parameters '(("eww" :follow org-eww-open :store org-eww-store-link) ("rmail" :follow org-rmail-open :store org-rmail-store-link) ("mhe" :follow org-mhe-open :store org-mhe-store-link) ("irc" :follow org-irc-visit :store org-irc-store-link :export org-irc-export) ("info" :follow org-info-open :export org-info-export :store org-info-store-link :insert-description org-info-description-as-command) ("gnus" :follow org-gnus-open :store org-gnus-store-link) ("docview" :follow org-docview-open :export org-docview-export :store org-docview-store-link) ("bibtex" :follow org-bibtex-open :store org-bibtex-store-link) ("bbdb" :follow org-bbdb-open :export org-bbdb-export :complete org-bbdb-complete-link :store org-bbdb-store-link) ("w3m" :store org-w3m-store-link) ("doi" :follow org-link-doi-open :export org-link-doi-export) ("attachment" :follow org-attach-follow :complete org-attach-complete-link) ("id" :follow org-id-open) ("file+sys") ("file+emacs") ("shell" :follow org-link--open-shell) ("news" :follow #[514 "\301\300\302Q\"\207" ["news" browse-url ":"] 6 "\n\n(fn URL ARG)"] ) ("mailto" :follow #[514 "\301\300\302Q\"\207" ["mailto" browse-url ":"] 6 "\n\n(fn URL ARG)"] ) ("https" :follow #[514 "\301\300\302Q\"\207" ["https" browse-url ":"] 6 "\n\n(fn URL ARG)"] ) ("http" :follow #[514 "\301\300\302Q\"\207" ["http" browse-url ":"] 6 "\n\n(fn URL ARG)"] ) ("ftp" :follow #[514 "\301\300\302Q\"\207" ["ftp" browse-url ":"] 6 "\n\n(fn URL ARG)"] ) ("help" :follow org-link--open-help :store org-link--store-help) ("file" :complete org-link-complete-file) ("elisp" :follow org-link--open-elisp)) org-metaup-hook '(org-babel-load-in-session-maybe) org-agenda-remove-tags t org-download-heading-lvl nil org-startup-with-inline-images t org-blank-before-new-entry '((heading) (plain-list-item)) org-download-link-format-function 'jqg/org-download-link-format-function-default org-agenda-dim-blocked-tasks nil org-link-frame-setup '((vm . vm-visit-folder-other-frame) (vm-imap . vm-visit-imap-folder-other-frame) (gnus . org-gnus-no-new-news) (file . find-file) (wl . wl-other-frame) (dir . dired-other-window)) org-return-follows-link t org-tags-column 0 org-id-method 'ts org-clock-history-length 35 org-download-image-dir "~/Emacs/Files/" org-attach-store-link-p 'file org-footnote-section nil )