[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [BUG] org-copy-subtree in a file with local variables marks buffer a
From: |
Ihor Radchenko |
Subject: |
Re: [BUG] org-copy-subtree in a file with local variables marks buffer as modified [9.5.3 (release_9.5.3-6-gef41f3 @ /home/ignacio/repos/emacs/lisp/org/)] |
Date: |
Tue, 14 Jun 2022 12:17:54 +0800 |
Ignacio Casso <ignaciocasso@hotmail.com> writes:
> I've written a patch proposal. It deals with buffer-modified-p and undo
> history, but not the other two points you mention. I have tested it and
> it works, but I had never dealt before with `buffer-undo-list' so maybe
> there are some cases that I have not considered and for which this patch
> could be problematic. Let me know what you think:
Thanks!
> - (delete-and-extract-region (point) (point-max)))))))
> + (undo-boundary)
> + (setq buffer-undo-list
> + (seq-drop-while 'identity buffer-undo-list)))))))
This looks fragile and can be disasterous when buffer-undo-list is
large.
Maybe just use with-silent-modifications or some ideas from there (for
example, wrapping modifications inside let-bound (buffer-undo-list t))?
We should not inhibit modification hooks though. Otherwise, it will mess
up with caching code.
Best,
Ihor