From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#21824: 25.0.50; overlay modification-hooks called with wrong buffer Date: Wed, 04 Nov 2015 17:31:27 +0200 Message-ID: <83611hvl0w.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1446651210 22325 80.91.229.3 (4 Nov 2015 15:33:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 4 Nov 2015 15:33:30 +0000 (UTC) Cc: 21824@debbugs.gnu.org To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Nov 04 16:33:20 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Zu03i-0006YM-OH for geb-bug-gnu-emacs@m.gmane.org; Wed, 04 Nov 2015 16:33:10 +0100 Original-Received: from localhost ([::1]:55404 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zu03i-0005Ix-35 for geb-bug-gnu-emacs@m.gmane.org; Wed, 04 Nov 2015 10:33:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54727) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zu03e-0005IY-9A for bug-gnu-emacs@gnu.org; Wed, 04 Nov 2015 10:33:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zu03a-0005jd-88 for bug-gnu-emacs@gnu.org; Wed, 04 Nov 2015 10:33:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34545) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zu03a-0005jZ-5x for bug-gnu-emacs@gnu.org; Wed, 04 Nov 2015 10:33:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Zu03a-0003dg-31 for bug-gnu-emacs@gnu.org; Wed, 04 Nov 2015 10:33:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 04 Nov 2015 15:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21824 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21824-submit@debbugs.gnu.org id=B21824.144665113213922 (code B ref 21824); Wed, 04 Nov 2015 15:33:02 +0000 Original-Received: (at 21824) by debbugs.gnu.org; 4 Nov 2015 15:32:12 +0000 Original-Received: from localhost ([127.0.0.1]:53486 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zu02l-0003cT-Hc for submit@debbugs.gnu.org; Wed, 04 Nov 2015 10:32:11 -0500 Original-Received: from mtaout21.012.net.il ([80.179.55.169]:36317) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zu02i-0003cI-DQ for 21824@debbugs.gnu.org; Wed, 04 Nov 2015 10:32:09 -0500 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0NXA00100R2A3B00@a-mtaout21.012.net.il> for 21824@debbugs.gnu.org; Wed, 04 Nov 2015 17:31:28 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([84.94.185.246]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NXA0003ZR4GO0B0@a-mtaout21.012.net.il>; Wed, 04 Nov 2015 17:31:28 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:108430 Archived-At: > Date: Tue, 3 Nov 2015 22:06:20 -0500 > From: Noam Postavsky > > 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(# 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.