all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Noam Postavsky <npostavs@users.sourceforge.net>
Cc: 21824@debbugs.gnu.org
Subject: bug#21824: 25.0.50; overlay modification-hooks called with wrong buffer
Date: Wed, 04 Nov 2015 17:31:27 +0200	[thread overview]
Message-ID: <83611hvl0w.fsf@gnu.org> (raw)
In-Reply-To: <CAM-tV-995+M5xjjKQUDNYnJNg=KUWKCMoFtPvoVNn-peLamiBg@mail.gmail.com>

> Date: Tue, 3 Nov 2015 22:06:20 -0500
> From: Noam Postavsky <npostavs@users.sourceforge.net>
> 
> The circumstances that trigger this seem to be a combination of
> overlays and timers. Attached is an init.el file that installs several
> packages needed to trigger the problem. I have not yet managed to find
> a simpler way of reproducing this. After installing the packages, and
> running M-x irony-install-server (requires libclang)

Thanks.  Unfortunately, I don't really have enough time at the moment
to install all of that, certainly not libclang.  Is it okay if I ask
questions and make observations, and you then try digging into this
problem, find the answers, and post them here?

> the problem can be triggered by a C++ mode buffer with the following
> contents:

> void func(int x);
> int main() {
>   fun|
> }

> where | represents the cursor. Press TAB y C-f C-b C-f C-b, this
> results in a (wrong-type-argument overlayp nil) which is due to
> yas--on-field-overlay-modification being called with *Messages* as the
> current buffer, rather than the C++ buffer where the yasnippet's
> overlay is in. The begin and end positions passed correspond to
> *Messages* buffer positions (i.e. they are too big to be from the C++
> buffer). According to the lisp backtrace (see below), it seems to be
> triggered by a call to `message' via a timer.

I see that yas-global-mode is turned on, which (AFAIU) means yasnippet
tries to do its thing in every buffer, including *Messages*, right?

That in turn means every modification of the *Messages* buffer will,
quite correctly, call yas--on-field-overlay-modification, provided
that the buffer has overlays in it.  Normally, *Messages* doesn't have
any overlays, but in this case it evidently did, or Emacs somehow
thought it did, which might be part of the problem.

A call to 'message' switches to the *Messages* buffer as part of doing
its job, which explains why yas--on-field-overlay-modification is
called with buffer positions from *Messages* -- assuming there are
overlays there, this all is expected behavior.

So far so good, and now we come to the problematic part.
yas--on-field-overlay-modification is called thusly:

   yas--on-field-overlay-modification(#<overlay from 41 to 42 in foo.cpp> t 3008 3008 33)

IOW, the overlay it is called with belongs to buffer foo.cpp, not to
*Messages*.  So the question now becomes: how come an overlay whose
buffer is foo.cpp winds up in *Messages*?  Can you try finding out?
(Is that even possible?)

After this error happens, what does the following produce if invoked
with *Messages* being the current buffer:

  M-: (overlays-in (point-min) (point-max)) RET

Maybe instrument yas--on-field-overlay-modification to show the
current buffer when it is called, and see if it is invoked with
*Messages* as the current buffer in this scenario.

Thanks.





  reply	other threads:[~2015-11-04 15:31 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 [this message]
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
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=83611hvl0w.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=21824@debbugs.gnu.org \
    --cc=npostavs@users.sourceforge.net \
    /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.