Skip to content

Commit da3e910

Browse files
author
Bozhidar Batsov
committed
Further simplify var def lookup
1 parent eed90f3 commit da3e910

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

cider-interaction.el

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -676,25 +676,18 @@ not found."
676676
(file (nrepl-dict-get info "file")))
677677
(cider-find-file file)))
678678

679-
(defun cider-jump-to (buffer &optional pos other-buffer)
680-
"Push current point onto marker ring, and jump to BUFFER to position POS.
681-
POS can be either a cons cell (LINE . COLUMN) or a number representing the
682-
character position in a buffer. If OTHER-BUFFER is non-nil use
683-
`pop-to-buffer' to jump to the location, otherwise `switch-to-buffer'."
679+
(defun cider-jump-to (buffer &optional line other-buffer)
680+
"Push current point onto marker ring, and jump to BUFFER and LINE.
681+
If OTHER-BUFFER is non-nil use `pop-to-buffer' to jump to the location,
682+
otherwise `switch-to-buffer'."
684683
(ring-insert find-tag-marker-ring (point-marker))
685684
(if other-buffer
686685
(pop-to-buffer buffer)
687686
(switch-to-buffer buffer))
688687
(with-current-buffer buffer
689688
(widen)
690-
;; check if we have a (line . column) pair or just a buffer position
691-
(if (not (consp pos))
692-
(goto-char pos)
693-
(goto-char (point-min))
694-
(forward-line (1- (or (car pos) 1)))
695-
(if (cdr pos)
696-
(move-to-column (cdr pos))
697-
(back-to-indentation)))
689+
(forward-line (1- (or line 1)))
690+
(back-to-indentation)
698691
(cider-mode +1)))
699692

700693
(defun cider-jump-to-resource (path &optional line)
@@ -706,7 +699,7 @@ When called interactively, this operates on point."
706699
(nrepl-send-sync-request)
707700
(plist-get :value)))
708701
(buffer (cider-find-file resource)))
709-
(cider-jump-to buffer (cons line nil))
702+
(cider-jump-to buffer line)
710703
(message "Cannot find resource %s" path)))
711704

712705
(defun cider--jump-to-loc-from-info (info &optional other-buffer)
@@ -717,7 +710,7 @@ OTHER-BUFFER is passed to `cider-jamp-to'."
717710
(file (nrepl-dict-get info "file"))
718711
(buffer (unless (cider--tooling-file-p file)
719712
(cider-find-file file))))
720-
(cider-jump-to buffer (cons line nil) other-buffer)))
713+
(cider-jump-to buffer line other-buffer)))
721714

722715
(defun cider-jump-to-var (&optional var line)
723716
"Jump to the definition of VAR, optionally at a specific LINE.

0 commit comments

Comments
 (0)