GNU bug report logs - #36190
27.0.50; `put-text-property' etc. with buffer argument calls current buffer's `after-change-functions'

Previous Next

Package: emacs;

Reported by: Pip Cet <pipcet <at> gmail.com>

Date: Thu, 13 Jun 2019 13:50:02 UTC

Severity: normal

Found in version 27.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#36190: closed (27.0.50; `put-text-property' etc. with buffer
 argument calls current buffer's `after-change-functions')
Date: Sat, 06 Jul 2019 16:23:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sat, 06 Jul 2019 19:22:32 +0300
with message-id <835zof875j.fsf <at> gnu.org>
and subject line Re: bug#36190: 27.0.50; `put-text-property' etc. with buffer argument calls current buffer's `after-change-functions'
has caused the debbugs.gnu.org bug report #36190,
regarding 27.0.50; `put-text-property' etc. with buffer argument calls current buffer's `after-change-functions'
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
36190: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=36190
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Pip Cet <pipcet <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; `put-text-property' etc. with buffer argument calls current
 buffer's `after-change-functions'
Date: Thu, 13 Jun 2019 13:48:40 +0000
In emacs -Q, evaluating:

(let ((buffer1 (generate-new-buffer "A"))
      (buffer2 (generate-new-buffer "B")))
  (with-current-buffer buffer2
    (insert "BBB"))
  (with-current-buffer buffer1
    (add-hook 'after-change-functions
          (lambda (beg end len)
        (message "%S %S %S"
             beg end len))
          nil t)
    (put-text-property 1 4 'read-only t buffer2)))

results in a "1 4 3" message. I would have expected no message, as
buffer2 was modified and buffer1, whose after-change-functions I'd
set, wasn't.

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. Am I missing something? Is this expected
behavior somehow?


[Message part 3 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: Pip Cet <pipcet <at> gmail.com>
Cc: 36190-done <at> debbugs.gnu.org
Subject: Re: bug#36190: 27.0.50; `put-text-property' etc. with buffer argument
 calls current buffer's `after-change-functions'
Date: Sat, 06 Jul 2019 19:22:32 +0300
> From: Pip Cet <pipcet <at> gmail.com>
> Date: Sat, 6 Jul 2019 15:27:41 +0000
> Cc: 36190 <at> debbugs.gnu.org
> 
> > LGTM, with a couple of minor comments below.  Feel free to push after
> > fixing those.
> 
> I don't have push access, so I hope it's okay just to send the new patch.

Thanks, pushed.  Please in the future mention the bug number in the
log message, and be sure NOT to end with a period the header line of
the log message, per CONTRIBUTE.


This bug report was last modified 6 years and 16 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.