all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@users.sourceforge.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 21824@debbugs.gnu.org
Subject: bug#21824: 25.0.50; overlay modification-hooks called with wrong buffer
Date: Thu, 5 Nov 2015 22:14:28 -0500	[thread overview]
Message-ID: <CAM-tV-8Ke8wpYWXm8ENuHV2UdWWUAW_3PY9NOY_bwgHBy9UrQA@mail.gmail.com> (raw)
In-Reply-To: <8337wktols.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1200 bytes --]

Okay, turned out flycheck was basically irrelevant except that it
calls message a lot. And highlight-parentheses' only significance is
that it makes overlays all over the place. I have a simple reproducer,
run as

     emacs -Q -l bug-21824.el -f 21824-trigger

The required circumstances appear to be that after a modification-hook
has been run and there is an overlay in the *Messages* buffer, the
message coalescing (the "[2 times]" thing) wrongly causes runs the
modification-hook of the overlay in the 1st buffer, but with
parameters from the  *Messages* buffer modification.

A sample backtrace (I put a call to `debug' when the current-buffer is
incorrect).

Debugger entered: (#<overlay from 2 to 5 in foo.cpp> t 223 223 10
#<buffer *Messages*>)
  (if (eq (current-buffer) (overlay-buffer overlay)) (message
"21842-mod-overlay(%s %s %s %s %s), buf = %s" overlay afterp beg end
len (current-buffer)) (setq 21842-repeat-message) (debug nil overlay
afterp beg end len (current-buffer)))
  21824-mod-overlay(#<overlay from 2 to 5 in foo.cpp> t 223 223 10)
  message("a message")
  21824-trigger()
  command-line-1(("-l" "bug-21824.el" "-f" "21824-trigger"))
  command-line()
  normal-top-level()

[-- Attachment #2: bug-21824.el --]
[-- Type: application/octet-stream, Size: 945 bytes --]

;;; emacs -Q -l bug-21824.el -f 21824-trigger

(defun 21824-mod-overlay (overlay afterp beg end &optional len)
  (if (eq (current-buffer) (overlay-buffer overlay))
      (message "21842-mod-overlay(%s %s %s %s %s), buf = %s"
               overlay afterp beg end len (current-buffer))
    (setq 21842-repeat-message)
    (debug nil overlay afterp beg end len (current-buffer))))

(defun 21824-trigger ()
  (switch-to-buffer "foo.cpp")
  (view-echo-area-messages)
  (erase-buffer)
  (insert "xyy")
  (search-backward "yy")
  (let* ((beg (match-beginning 0))
         (end (match-end 0))
         (mod-hook-ov (make-overlay beg end nil nil t)))
    (overlay-put mod-hook-ov 'face 'highlight)
    (overlay-put mod-hook-ov 'modification-hooks '(21824-mod-overlay))
    (goto-char (1- end))
    (insert "y")) ; trigger modification-hooks

  (with-current-buffer "*Messages*"
    (make-overlay 1 2))

  (message "a message")
  (message "a message"))


  reply	other threads:[~2015-11-06  3:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-04  3:06 bug#21824: 25.0.50; overlay modification-hooks called with wrong buffer Noam Postavsky
2015-11-04 15:31 ` Eli Zaretskii
2015-11-05  0:19   ` Noam Postavsky
2015-11-05  3:33     ` Noam Postavsky
2015-11-05 16:09       ` Eli Zaretskii
2015-11-06  3:14         ` Noam Postavsky [this message]
2015-11-06 15:23           ` Eli Zaretskii
2015-11-06 15:37             ` Eli Zaretskii
2015-11-07  2:24             ` Noam Postavsky
2015-11-07  8:28               ` Eli Zaretskii
2015-11-07 16:22                 ` Noam Postavsky
2015-11-07 18:07                   ` Eli Zaretskii
2015-11-08  1:43                     ` Noam Postavsky
2015-11-08  3:41                       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAM-tV-8Ke8wpYWXm8ENuHV2UdWWUAW_3PY9NOY_bwgHBy9UrQA@mail.gmail.com \
    --to=npostavs@users.sourceforge.net \
    --cc=21824@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.