From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Bastian Beischer Newsgroups: gmane.emacs.bugs Subject: bug#28645: Status: 26.0.50; semantic-ia-fast-jump jumps to a random place in buffer Date: Mon, 16 Oct 2017 12:21:06 +0200 Message-ID: References: <873770y3f9.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c09d95e5985b5055ba75d18" X-Trace: blaine.gmane.org 1508149338 6805 195.159.176.226 (16 Oct 2017 10:22:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 16 Oct 2017 10:22:18 +0000 (UTC) Cc: bug#28645 <28645@debbugs.gnu.org> To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 16 12:22:12 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e42XD-0000XR-Ki for geb-bug-gnu-emacs@m.gmane.org; Mon, 16 Oct 2017 12:22:11 +0200 Original-Received: from localhost ([::1]:60305 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e42XF-0005v2-Pu for geb-bug-gnu-emacs@m.gmane.org; Mon, 16 Oct 2017 06:22:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35059) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e42X9-0005uw-2i for bug-gnu-emacs@gnu.org; Mon, 16 Oct 2017 06:22:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e42X4-0002iA-2A for bug-gnu-emacs@gnu.org; Mon, 16 Oct 2017 06:22:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33848) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e42X3-0002i4-VT for bug-gnu-emacs@gnu.org; Mon, 16 Oct 2017 06:22:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e42X3-0003O7-PN for bug-gnu-emacs@gnu.org; Mon, 16 Oct 2017 06:22:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Bastian Beischer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 16 Oct 2017 10:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28645 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 28645-submit@debbugs.gnu.org id=B28645.150814927412963 (code B ref 28645); Mon, 16 Oct 2017 10:22:01 +0000 Original-Received: (at 28645) by debbugs.gnu.org; 16 Oct 2017 10:21:14 +0000 Original-Received: from localhost ([127.0.0.1]:42529 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e42WI-0003N1-8m for submit@debbugs.gnu.org; Mon, 16 Oct 2017 06:21:14 -0400 Original-Received: from mail-qt0-f177.google.com ([209.85.216.177]:51546) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e42WG-0003Mn-Te for 28645@debbugs.gnu.org; Mon, 16 Oct 2017 06:21:13 -0400 Original-Received: by mail-qt0-f177.google.com with SMTP id q4so30509398qtq.8 for <28645@debbugs.gnu.org>; Mon, 16 Oct 2017 03:21:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=OJfUCgDsoM9IbTOJx0eWghlTp7EGcpfcTlChAE6S4Mw=; b=VQQkiEOx1PMizAusaeBKzYFWwLPbEo2TF8FslGwi+GajieSqrWgAjp9FwvtC04nstt WCkXpAhR5XMvhxXP6X7rgV+5b6kirmAc3TJvcz7St3DL2JbxtNSNdnUtEsdEYGGRzdtj OhS/QlWKR5amCj1y2ymjNm+27lFDx+ar23Crl7RfpxZNTV+FANEOGT3apokhqjk+LVeT YXK8fwHopDdTnCS+/E4vpl6NaKki+C5vGaPbCM/OtaL6UGZXTaSqNqaM4wyqXPHsodZT cFyM3sNbxjZ3CqhdK/q8NXGZ0CdVitnGrVHMZr2E1O5qGpxMs8xvouFsEDyk5lkXSJ3Z cDFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=OJfUCgDsoM9IbTOJx0eWghlTp7EGcpfcTlChAE6S4Mw=; b=nN7MdP4HxOBIRXJpcX+PCoZUSA5MuwHcY7SlmpHGbjNVt5wIHylEQYHEL4c0Q4sG4d 8rDQURIa2gB+TFwpc1rVtupxrhJqlHfq9J3MiNhnzIvChV3qZh5yVaP9iqJ4/BDOTGS2 30OIIikKWb748L7/z4/9SV9kFAQG1KNAwDKoJAmava+tbtoR+2N+Kn9exRum7FHtiviW Y7LRWZpLMkLSYE/1mYusgrfOxObILyQ2I+2Ghm5wy/MZQSO/vLfBS2wqdQMNMWQ2RFqv ek5KIjkYupRp4rRZAArOOylHz4T74lqDyk0Vd1rSJR6FadlnAqcBcYExPw9oYmQuW+kF gO7A== X-Gm-Message-State: AMCzsaVVng/a0LGlL/oSOl8Wg6YJCnvNPRxWUey+p0HaJsy85/oaByHC fM6tPk4vYISA3fzR4Mo/HB2U0hZjt/fWWyUWcsc= X-Google-Smtp-Source: ABhQp+REYrd5kE2EjDeYTo7eOazhECZ54I3vJDSveFfGe9gmqdI0zdjDqZ3AIxRGbFlNmZA62gVqQfuAfd7I7ogMYvI= X-Received: by 10.37.223.6 with SMTP id w6mr44852ybg.145.1508149267365; Mon, 16 Oct 2017 03:21:07 -0700 (PDT) Original-Received: by 10.129.99.11 with HTTP; Mon, 16 Oct 2017 03:21:06 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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" Xref: news.gmane.org gmane.emacs.bugs:138509 Archived-At: --94eb2c09d95e5985b5055ba75d18 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hey Dmitry, On Mon, Oct 16, 2017 at 1:06 AM, Dmitry Gutov wrote: > Hey Bastian, > > On 10/3/17 12:40 PM, Bastian Beischer wrote: > > $ grep -n -e 'switch-to-buffer' lisp/cedet >> ./semantic/decorate/include.el:470: (switch-to-buffer >> (get-file-buffer file))) >> ./semantic/imenu.el:180: (switch-to-buffer ob)) >> ./semantic/debug.el:156: (switch-to-buffer (oref iface data-buffer)= ) >> ./semantic/debug.el:160: (switch-to-buffer (oref iface parser-buffer)) >> ./semantic/debug.el:166: (switch-to-buffer (oref iface source-buffer)) >> ./semantic/debug.el:453: (switch-to-buffer buf)) >> ./semantic/debug.el:467: (switch-to-buffer buf)) >> ./semantic/bovine/c.el:980: (switch-to-buffer (get-buffer-create >> "*MODE HACK TEST*")) >> ./semantic/bovine/c.el:992: (switch-to-buffer-other-window >> ./semantic/complete.el:1533: (switch-to-buffer-other-window buf t) >> ./semantic/complete.el:2123: (switch-to-buffer (current-buffer)) >> ./semantic/symref/list.el:182: (switch-to-buffer-other-window buff) >> ./semantic/symref/list.el:314: (switch-to-buffer-other-window buff) >> ./semantic/symref/list.el:328: (switch-to-buffer-other-window buff) >> ./semantic/symref/list.el:344: (switch-to-buffer-other-window buff) >> ./semantic/symref/list.el:420: (switch-to-buffer-other-window >> (semantic-tag-buffer tag)) >> ./semantic/symref/list.el:440: (switch-to-buffer >> (current-buffer)) >> ./semantic/sb.el:320: (switch-to-buffer (current-buffer)) >> ./semantic/analyze/refs.el:351: (switch-to-buffer (current-buffer)) >> ./semantic/mru-bookmark.el:116: (switch-to-buffer (current-buffer)) >> ./semantic/texi.el:630:;; (switch-to-buffer docbuff)) >> ./semantic/texi.el:675: (switch-to-buffer (semantic-tag-buffer (car >> tags))) >> ./semantic/senator.el:533: (switch-to-buffer (current-buffer)) >> ./semantic/senator.el:537: (switch-to-buffer result) >> ./semantic/senator.el:741: (switch-to-buffe= r >> (semantic-tag-buffer v)) >> ./semantic.el:1081: `global-semantic-mru-bookmark-mode' - Provide >> `switch-to-buffer'-like >> ./srecode/getset.el:263: (switch-to-buffer (current-buffer)) >> ./ede/custom.el:103: (switch-to-buffer (get-buffer-create "*EDE sort >> targets*")) >> ./ede/shell.el:44: (switch-to-buffer-other-window buff t)) >> >> I was able to reproduce the bug in "semantic-complete-jump" and >> "semantic-analyze-proto-impl-toggle", for example. >> > > With Martin's explanation, I guess we should replace all of these uses > with pop-to-buffer-same-window. > > Could you try out this kind of change and see if it fixes the problems yo= u > are still seeing, without introducing any obvious new ones? > =E2=80=8BI replaced =E2=80=8Bswitch-to-buffer with pop-to-buffer-same-windo= w in those functions which I'm using regularly and it fixes the problem. The CEDET functions where I made the replacements and checked them are: semantic-analyze-proto-impl-toggle semantic-complete-jump semantic-decoration-include-visit semantic-ia--fast-jump-helper semantic-mrub-vist senator-jump senator-jump-regexp =E2=80=8Bsenator-go-to-up-reference =E2=80=8BI didn't make any other replacements because: a) For some of them I'm not sure if 'pop-to-buffer-same-window' or 'pop-to-buffer' =E2=80=8Bshould be used. b) I'm not using any of the other functions with matches so I wouldn't be able to test the change. Also, searching for 'switch-to-buffer' in non-CEDET related lisp files in the emacs sources reveals more places which need to be fixed, but I didn't go that far. However, probably somebody (tm) should check them all one-by-one :-( I also think that the advice not to use switch-to-buffer and instead use pop-to-buffer(-same-window) should get a prominent entry in NEWS so that third-parties can check their code and make the changes there, too. For example, SLIME has this open issue: https://github.com/slime/slime/issues/391 https://lists.gnu.org/archive/html/emacs-devel/2017-06/msg00227.html and others are probably also affected. Cheers Bastian --94eb2c09d95e5985b5055ba75d18 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hey Dmitry,

On Mon, Oct 16, 2017 at 1:06 AM, Dmitry Gutov <dgutov@y= andex.ru> wrote:
Hey Bastian,

On 10/3/17 12:40 PM, Bastian Beischer wrote:

$ grep -n -e 'switch-to-buffer' lisp/cedet
./semantic/decorate/include.el:470:=C2=A0 =C2=A0 =C2=A0(switch-to-buff= er (get-file-buffer file)))
./semantic/imenu.el:180:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 (switch-to-buffer ob))
./semantic/debug.el:156:=C2=A0 =C2=A0 =C2=A0 (switch-to-buffer (oref iface = data-buffer))
./semantic/debug.el:160:=C2=A0 (switch-to-buffer (oref iface parser-buffer)= )
./semantic/debug.el:166:=C2=A0 (switch-to-buffer (oref iface source-buffer)= )
./semantic/debug.el:453:=C2=A0 =C2=A0 =C2=A0 (switch-to-buffer buf))
./semantic/debug.el:467:=C2=A0 =C2=A0 =C2=A0 (switch-to-buffer buf))
./semantic/bovine/c.el:980:=C2=A0 =C2=A0 =C2=A0(switch-to-buffer (get-buffe= r-create "*MODE HACK TEST*"))
./semantic/bovine/c.el:992:=C2=A0 =C2=A0 (switch-to-buffer-other-window
./semantic/complete.el:1533:=C2=A0 =C2=A0 (switch-to-buffer-other-window bu= f t)
./semantic/complete.el:2123:=C2=A0 =C2=A0 =C2=A0 (switch-to-buffer (current= -buffer))
./semantic/symref/list.el:182:=C2=A0 =C2=A0 (switch-to-buffer-other-wi= ndow buff)
./semantic/symref/list.el:314:=C2=A0 =C2=A0 (switch-to-buffer-other-wi= ndow buff)
./semantic/symref/list.el:328:=C2=A0 =C2=A0 (switch-to-buffer-other-wi= ndow buff)
./semantic/symref/list.el:344:=C2=A0 =C2=A0 (switch-to-buffer-other-wi= ndow buff)
./semantic/symref/list.el:420:=C2=A0 =C2=A0 (switch-to-buffer-other-wi= ndow (semantic-tag-buffer tag))
./semantic/symref/list.el:440:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 (switch-to-buffer (current-buffer))
./semantic/sb.el:320:=C2=A0 =C2=A0 (switch-to-buffer (current-buffer))
./semantic/analyze/refs.el:351:=C2=A0 =C2=A0 (switch-to-buffer (curren= t-buffer))
./semantic/mru-bookmark.el:116:=C2=A0 =C2=A0 (switch-to-buffer (curren= t-buffer))
./semantic/texi.el:630:;;=C2=A0 =C2=A0 =C2=A0 =C2=A0(switch-to-buffer docbu= ff))
./semantic/texi.el:675:=C2=A0 =C2=A0(switch-to-buffer (semantic-tag-buffer = (car tags)))
./semantic/senator.el:533:=C2=A0 =C2=A0 =C2=A0 (switch-to-buffer (current-b= uffer))
./semantic/senator.el:537:=C2=A0 =C2=A0 =C2=A0 (switch-to-buffer result) ./semantic/senator.el:741:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (switch-to-buffer (= semantic-tag-buffer v))
./semantic.el:1081: `global-semantic-mru-bookmark-mode'=C2=A0 =C2= =A0- Provide `switch-to-buffer'-like
./srecode/getset.el:263:=C2=A0 =C2=A0 (switch-to-buffer (current-buffer)) ./ede/custom.el:103:=C2=A0 =C2=A0 (switch-to-buffer (get-buffer-create &quo= t;*EDE sort targets*"))
./ede/shell.el:44:=C2=A0 =C2=A0 =C2=A0 (switch-to-buffer-other-window buff = t))

I was able to reproduce the bug in "semantic-complete-jump" and "semantic-analyze-proto-impl-toggle", for example.

With Martin's explanation, I guess we should replace all of these uses = with pop-to-buffer-same-window.

Could you try out this kind of change and see if it fixes the problems you = are still seeing, without introducing any obvious new ones?

=E2=80=8BI replaced =E2=80=8Bswitch-to-buffer with pop-t= o-buffer-same-window in those functions which I'm using regularly and i= t fixes the problem. The CEDET functions where I made the replacements and = checked them are:

semantic-analyze-proto-impl-toggle=
semantic-complete-jump
semantic-decoration-include-visit
semantic-ia--fast-jump-helper
semantic-m= rub-vist
senator-jump
<= div class=3D"gmail_default">senator-jump-regexp
=E2=80=8Bsenator-go-to-up-= reference

= =E2=80=8BI didn't make any other replacements because:

a) For some of them I'm not sure if 'pop-to-buffer-same-windo= w' or 'pop-to-buffer' =E2=80=8Bshould be used.
b) I= 9;m not using any of the other functions with matches so I wouldn't be = able to test the change.

Also, searching for 'swit= ch-to-buffer' in non-CEDET related lisp files in the emacs sources reve= als more places which need to be fixed, but I didn't go that far. Howev= er, probably somebody (tm) should check them all one-by-one :-(
I also think that the advice not to use switch-to-buffer and inst= ead use pop-to-buffer(-same-window) should get a prominent entry in NEWS so= that third-parties can check their code and make the changes there, too. F= or example, SLIME has this open issue:


and others are p= robably also affected.

Cheers
Bastian
--94eb2c09d95e5985b5055ba75d18--