Ignacio Casso San Román <[email protected]> writes: > (with-current-buffer (marker-buffer ,marker) > (save-excursion > (goto-char ,marker) > ,@body)) > ``` > > do instead > > ``` > (with-current-buffer (marker-buffer ,marker) > (with-current-buffer (clone-indirect-buffer "unique-name" nil t) > (goto-char ,marker) > ,@body) > (kill-buffer "unique-name")) > ``` > > We could also detect when the buffer is visible and only apply the > workaround then.
That will cause bugs: 1. Indirect buffer does not contain the original buffer overlays, so folding state will not be preserved 2. Indirect buffer has its buffer-file-name set to nil, which is not expected by some code 3. You are passing DISPLAY-FLAG, that will unconditionally display the cloned buffer, which can trigger similar errors. Cloning buffer is also not a cheap operation. So, performance will degrade. -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>
