[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#36190: 27.0.50; `put-text-property' etc. with buffer argument calls
From: |
Pip Cet |
Subject: |
bug#36190: 27.0.50; `put-text-property' etc. with buffer argument calls current buffer's `after-change-functions' |
Date: |
Thu, 13 Jun 2019 18:48:23 +0000 |
On Thu, Jun 13, 2019 at 4:36 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Pip Cet <pipcet@gmail.com>
> > Date: Thu, 13 Jun 2019 13:48:40 +0000
> >
> > I've looked at the code, and it appears no particular provisions are
> > being made to make sure we switch to the modified buffer before
> > calling signal_after_change().
> >
> > As far as I can tell, this makes `put-text-property' with a buffer
> > argument pretty useless.
>
> Only if you have a buffer-local value of after-change-functions.
I'm not sure what you're saying. I'm seeing weird behavior in these cases:
- buffer-local value of after-change-functions
- global value of after-change functions (current-buffer is wrong!)
- overlay property modification-hooks
(let ((buffer1 (generate-new-buffer "A"))
(buffer2 (generate-new-buffer "B")))
(with-current-buffer buffer2
(insert "BBB"))
(with-current-buffer buffer1
(insert "AAA")
(overlay-put (make-overlay 1 4 buffer1) 'modification-hooks
(list (lambda (&rest args)
(message "%S"
args))))
(goto-char 2)
(insert "AAA")
(put-text-property 1 4 'read-only t buffer2)))
produces three calls to the lambda, but should produce only two. (The
last_overlay_modification_hooks logic is a bit weird, thus the second
insertion).
That seems pretty wrong to me. In which cases do you think we're
seeing the right behavior?
Here's a first patch, which adds a "buffer" argument to
signal_after_change, to be explicit about where the change happens. It
should be pretty cheap in the case where we don't switch buffers.
0001-Switch-to-modified-buffer-in-signal_after_change.patch
Description: Text Data
- bug#36190: 27.0.50; `put-text-property' etc. with buffer argument calls current buffer's `after-change-functions', Pip Cet, 2019/06/13
- bug#36190: 27.0.50; `put-text-property' etc. with buffer argument calls current buffer's `after-change-functions', Eli Zaretskii, 2019/06/13
- bug#36190: 27.0.50; `put-text-property' etc. with buffer argument calls current buffer's `after-change-functions',
Pip Cet <=
- bug#36190: 27.0.50; `put-text-property' etc. with buffer argument calls current buffer's `after-change-functions', Eli Zaretskii, 2019/06/13
- bug#36190: 27.0.50; `put-text-property' etc. with buffer argument calls current buffer's `after-change-functions', Eli Zaretskii, 2019/06/13
- bug#36190: 27.0.50; `put-text-property' etc. with buffer argument calls current buffer's `after-change-functions', Pip Cet, 2019/06/13
- bug#36190: 27.0.50; `put-text-property' etc. with buffer argument calls current buffer's `after-change-functions', Eli Zaretskii, 2019/06/13
- bug#36190: 27.0.50; `put-text-property' etc. with buffer argument calls current buffer's `after-change-functions', Pip Cet, 2019/06/13
- bug#36190: 27.0.50; `put-text-property' etc. with buffer argument calls current buffer's `after-change-functions', Pip Cet, 2019/06/13
- bug#36190: 27.0.50; `put-text-property' etc. with buffer argument calls current buffer's `after-change-functions', Eli Zaretskii, 2019/06/14
- bug#36190: 27.0.50; `put-text-property' etc. with buffer argument calls current buffer's `after-change-functions', Pip Cet, 2019/06/14
- bug#36190: 27.0.50; `put-text-property' etc. with buffer argument calls current buffer's `after-change-functions', Eli Zaretskii, 2019/06/14
- bug#36190: 27.0.50; `put-text-property' etc. with buffer argument calls current buffer's `after-change-functions', Pip Cet, 2019/06/15