Skip to content

Commit 21f4caa

Browse files
committed
Fix enlighten-mode accidentally moving point
1 parent 79941e9 commit 21f4caa

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

cider-common.el

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,15 @@ On failure, read a symbol name using PROMPT and call CALLBACK with that."
7979

8080
(declare-function cider-jump-to "cider-interaction")
8181

82+
(defun cider--find-buffer-for-file (file)
83+
"Return a buffer visiting FILE.
84+
If FILE is a temp buffer name, return that buffer."
85+
(if (string-prefix-p "*" file)
86+
file
87+
(and file
88+
(not (cider--tooling-file-p file))
89+
(cider-find-file file))))
90+
8291
(defun cider--jump-to-loc-from-info (info &optional other-window)
8392
"Jump to location give by INFO.
8493
INFO object is returned by `cider-var-info' or `cider-member-info'.
@@ -87,11 +96,7 @@ OTHER-WINDOW is passed to `cider-jump-to'."
8796
(file (nrepl-dict-get info "file"))
8897
(name (nrepl-dict-get info "name"))
8998
;; the filename might actually be a REPL buffer name
90-
(buffer (if (string-prefix-p "*" file)
91-
file
92-
(and file
93-
(not (cider--tooling-file-p file))
94-
(cider-find-file file)))))
99+
(buffer (cider--find-buffer-for-file file)))
95100
(if buffer
96101
(cider-jump-to buffer (if line (cons line nil) name) other-window)
97102
(error "No source location"))))

cider-debug.el

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,8 +572,7 @@ is a coordinate measure in sexps."
572572
;; We prefer in-source debugging.
573573
(when-let ((buf (and file line column
574574
(ignore-errors
575-
(cider--jump-to-loc-from-info response)
576-
(current-buffer)))))
575+
(cider--find-buffer-for-file file)))))
577576
;; The logic here makes it hard to use `with-current-buffer'.
578577
(with-current-buffer buf
579578
;; This is for restoring point inside buf.

0 commit comments

Comments
 (0)