[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: |
Fri, 14 Jun 2019 11:14:53 +0000 |
On Fri, Jun 14, 2019 at 7:41 AM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Pip Cet <pipcet@gmail.com>
> > Date: Thu, 13 Jun 2019 21:37:40 +0000
> > Cc: 36190@debbugs.gnu.org
> >
> > +/* Signal a change immediately after it happens.
> > + BUFFER is the buffer in which the change happened.
> > + CHARPOS is the character position of the start of the changed text.
> > + LENDEL is the number of characters of the text before the change.
> > + (Not the whole buffer; just the part that was changed.)
> > + LENINS is the number of characters in that part of the text
> > + after the change. */
>
> I would just say "Like signal_after_change, but ..." and describe only
> the BUFFER argument.
>
> > +void
> > +signal_after_change_in_buffer (struct buffer *buffer, ptrdiff_t charpos,
> > ptrdiff_t lendel, ptrdiff_t lenins)
> > +{
> > + ptrdiff_t count = SPECPDL_INDEX ();
> > +
> > + record_unwind_current_buffer ();
> > + set_buffer_internal (buffer);
> > + signal_after_change (charpos, lendel, lenins);
> > + unbind_to (count, Qnil);
> > +}
>
> I still think we should explicitly detect the current_buffer case here
> and if so, avoid the calls to everything else except
> signal_after_change itself.
>
> But I indeed like this patch better, although the concerns over the
> performance hit are still present. Thanks.
Okay, I fixed those two issues. As for the performance problem, should
we amend the documentation to state that if many changes are made,
it's better to use `with-current-buffer' instead of repeatedly calling
put-text-property with a buffer argument?
0001-Switch-to-correct-buffer-in-put-text-property-etc.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, 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', 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 <=
- 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
- bug#36190: 27.0.50; `put-text-property' etc. with buffer argument calls current buffer's `after-change-functions', Eli Zaretskii, 2019/06/15
- bug#36190: 27.0.50; `put-text-property' etc. with buffer argument calls current buffer's `after-change-functions', Pip Cet, 2019/06/15
- 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/17
- bug#36190: 27.0.50; `put-text-property' etc. with buffer argument calls current buffer's `after-change-functions', Eli Zaretskii, 2019/06/17
- bug#36190: 27.0.50; `put-text-property' etc. with buffer argument calls current buffer's `after-change-functions', Pip Cet, 2019/06/18