unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Bastian Beischer <bastian.beischer@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: bug#28645 <28645@debbugs.gnu.org>
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	[thread overview]
Message-ID: <CAK9AuB8B+PT9vd1DH=aU90vcEdMJ6ao9F5VcEZrSTznNBLt3Fg@mail.gmail.com> (raw)
In-Reply-To: <f288626c-e9e0-68f4-0de4-45902ad96144@yandex.ru>

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

Hey Dmitry,

On Mon, Oct 16, 2017 at 1:06 AM, Dmitry Gutov <dgutov@yandex.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:     (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-buffer
>> (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 you
> are still seeing, without introducing any obvious new ones?
>

​I replaced ​switch-to-buffer with pop-to-buffer-same-window 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
​senator-go-to-up-reference

​I 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' ​should 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

[-- Attachment #2: Type: text/html, Size: 7258 bytes --]

  reply	other threads:[~2017-10-16 10:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-29 13:23 bug#28645: 26.0.50; semantic-ia-fast-jump jumps to a random place in buffer Constantine
2017-09-29 14:42 ` Dmitry Gutov
2017-09-29 14:57   ` Constantine
2017-09-29 18:18   ` martin rudalics
2017-09-30 14:19     ` Dmitry Gutov
2017-10-03  9:40 ` bug#28645: Status: " Bastian Beischer
2017-10-04  9:03   ` martin rudalics
2017-10-04 11:11     ` Bastian Beischer
2017-10-05  8:09       ` martin rudalics
2017-10-15 23:06   ` Dmitry Gutov
2017-10-16 10:21     ` Bastian Beischer [this message]
2017-10-17  8:58       ` martin rudalics
2017-10-17 10:44       ` Dmitry Gutov
2017-10-17 12:30         ` Bastian Beischer
2017-10-18 23:46           ` Dmitry Gutov
2017-10-19  9:41             ` Bastian Beischer
2017-10-19 10:03               ` Dmitry Gutov

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='CAK9AuB8B+PT9vd1DH=aU90vcEdMJ6ao9F5VcEZrSTznNBLt3Fg@mail.gmail.com' \
    --to=bastian.beischer@gmail.com \
    --cc=28645@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).