bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#28645: Status: 26.0.50; semantic-ia-fast-jump jumps to a random plac


From: Bastian Beischer
Subject: bug#28645: Status: 26.0.50; semantic-ia-fast-jump jumps to a random place in buffer
Date: Tue, 17 Oct 2017 14:30:35 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Dmitry Gutov <dgutov@yandex.ru> writes:

> On 10/16/17 1:21 PM, Bastian Beischer wrote:
>
>> ​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
>>

It turns out that senator-jump and senator-jump-regexp don't exist in
emacs but only in upstream CEDET. So no need to change these.

>> ​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 :-(
>
> Could you send a patch with the replacements you did make?

Sure:

diff --git a/lisp/cedet/semantic/analyze/refs.el 
b/lisp/cedet/semantic/analyze/refs.el
index 55fcd83043..a58479f505 100644
--- a/lisp/cedet/semantic/analyze/refs.el
+++ b/lisp/cedet/semantic/analyze/refs.el
@@ -348,7 +348,7 @@ Only works for tags in the global namespace."
 
     (push-mark)
     (semantic-go-to-tag target)
-    (switch-to-buffer (current-buffer))
+    (pop-to-buffer-same-windown (current-buffer))
     (semantic-momentary-highlight-tag target))
   )
 
diff --git a/lisp/cedet/semantic/complete.el b/lisp/cedet/semantic/complete.el
index ff8e61e54d..325ca1f441 100644
--- a/lisp/cedet/semantic/complete.el
+++ b/lisp/cedet/semantic/complete.el
@@ -2120,7 +2120,7 @@ completion works."
     (when (semantic-tag-p tag)
       (push-mark)
       (semantic-go-to-tag tag)
-      (switch-to-buffer (current-buffer))
+      (pop-to-buffer-same-window (current-buffer))
       (semantic-momentary-highlight-tag tag)
       (message "%S: %s "
               (semantic-tag-class tag)
diff --git a/lisp/cedet/semantic/decorate/include.el 
b/lisp/cedet/semantic/decorate/include.el
index 6876e5f3a4..4a86b9e4ee 100644
--- a/lisp/cedet/semantic/decorate/include.el
+++ b/lisp/cedet/semantic/decorate/include.el
@@ -467,7 +467,7 @@ its contents.
        (error "Could not location include %s"
               (semantic-tag-name tag)))
        ((get-file-buffer file)
-       (switch-to-buffer (get-file-buffer file)))
+       (pop-to-buffer-same-window (get-file-buffer file)))
        ((stringp file)
        (find-file file))
        ))))
diff --git a/lisp/cedet/semantic/mru-bookmark.el 
b/lisp/cedet/semantic/mru-bookmark.el
index 5fa58e08ea..24863de01b 100644
--- a/lisp/cedet/semantic/mru-bookmark.el
+++ b/lisp/cedet/semantic/mru-bookmark.el
@@ -113,7 +113,7 @@ Uses `semantic-go-to-tag' and highlighting."
          (forward-char o))
       (error nil))
     ;; make it visible
-    (switch-to-buffer (current-buffer))
+    (pop-to-buffer-same-window (current-buffer))
     (semantic-momentary-highlight-tag tag)
     ))
 
diff --git a/lisp/cedet/semantic/senator.el b/lisp/cedet/semantic/senator.el
index e86658628b..d37345aa2d 100644
--- a/lisp/cedet/semantic/senator.el
+++ b/lisp/cedet/semantic/senator.el
@@ -530,11 +530,11 @@ Some tags such as includes have other reference features."
        ;; A tag
        ((semantic-tag-p result)
        (semantic-go-to-tag result)
-       (switch-to-buffer (current-buffer))
+       (pop-to-buffer-same-window (current-buffer))
        (semantic-momentary-highlight-tag result))
        ;; Buffers
        ((bufferp result)
-       (switch-to-buffer result)
+       (pop-to-buffer-same-window result)
        (pulse-momentary-highlight-one-line (point)))
        ;; Files
        ((and (stringp result) (file-exists-p result))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]