emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/evil dceb736: Do not try to switch file/buffer when jumpin


From: ELPA Syncer
Subject: [nongnu] elpa/evil dceb736: Do not try to switch file/buffer when jumping inside same file (#1506)
Date: Tue, 10 Aug 2021 04:57:19 -0400 (EDT)

branch: elpa/evil
commit dceb73603d397f7e42a541976d8ec0711248d38c
Author: Konstantin Kharlamov <Hi-Angel@users.noreply.github.com>
Commit: GitHub <noreply@github.com>

    Do not try to switch file/buffer when jumping inside same file (#1506)
    
    The vast majority of jumps will end up within the current opened
    file/buffer, simply because usually users do more movement inside a
    buffer rather than across buffers.
    
    There is even a special case when evil-jumps-cross-buffers is set to
    nil, which causes jumps never ever switch buffers.
    
    So, let's do a small optimization, and not try to call find-file or
    switch-to-buffer if we know it is unnecessary.
    
    As a side-effect, this should also help to users to stumble less upon
    https://github.com/emacs-evil/evil/issues/1504 bug (it has its own
    upstream fix, but until that landed, this small optimization is known to
    help as well).
---
 evil-jumps.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/evil-jumps.el b/evil-jumps.el
index a448ee8..55617e0 100644
--- a/evil-jumps.el
+++ b/evil-jumps.el
@@ -156,9 +156,10 @@
                (pos (car place))
                (file-name (cadr place)))
           (setq evil--jumps-jumping t)
-          (if (string-match-p evil--jumps-buffer-targets file-name)
-              (switch-to-buffer file-name)
-            (find-file file-name))
+          (unless (string= current-file-name file-name)
+            (if (string-match-p evil--jumps-buffer-targets file-name)
+                (switch-to-buffer file-name)
+              (find-file file-name)))
           (setq evil--jumps-jumping nil)
           (goto-char pos)
           (setf (evil-jumps-struct-idx (evil--jumps-get-current)) idx)



reply via email to

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