Skip to content

Commit

Permalink
Don't fail if point is not on a symbol (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
phikal committed Jul 29, 2020
1 parent d55261b commit 5ec408d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions dumb-jump.el
Original file line number Diff line number Diff line change
Expand Up @@ -3004,12 +3004,13 @@ Using ag to search only the files found via git-grep literal symbol search."
"2020-06-26")

(cl-defmethod xref-backend-identifier-at-point ((_backend (eql dumb-jump)))
(let* ((ident (dumb-jump-get-point-symbol))
(start (car (bounds-of-thing-at-point 'symbol)))
(col (- start (point-at-bol)))
(line (dumb-jump-get-point-line))
(ctx (dumb-jump-get-point-context line ident col)))
(propertize ident :dumb-jump-ctx ctx)))
(let ((bounds (bounds-of-thing-at-point 'symbol)))
(and bounds (let* ((ident (dumb-jump-get-point-symbol))
(start (car bounds))
(col (- start (point-at-bol)))
(line (dumb-jump-get-point-line))
(ctx (dumb-jump-get-point-context line ident col)))
(propertize ident :dumb-jump-ctx ctx)))))

(cl-defmethod xref-backend-definitions ((_backend (eql dumb-jump)) prompt)
(let* ((info (dumb-jump-get-results prompt))
Expand Down

0 comments on commit 5ec408d

Please sign in to comment.