Minor edits.

This commit is contained in:
Derek Taylor
2020-11-05 13:27:52 -06:00
parent 8fbacc6392
commit 35112d3f8c
170 changed files with 1304 additions and 756 deletions

View File

@@ -180,6 +180,7 @@ This can be passed nil as its second argument to unset handlers for MODES. e.g.
;;
;;; Lookup backends
(autoload 'xref--show-defs "xref")
(defun +lookup--xref-show (fn identifier &optional show-fn)
(let ((xrefs (funcall fn
(xref-find-backend)
@@ -239,14 +240,39 @@ neither is available. These require ripgrep to be installed."
(defun +lookup-evil-goto-definition-backend-fn (_identifier)
"Uses `evil-goto-definition' to conduct a text search for IDENTIFIER in the
current buffer."
(and (fboundp 'evil-goto-definition)
(ignore-errors
(cl-destructuring-bind (beg . end)
(bounds-of-thing-at-point 'symbol)
(evil-goto-definition)
(let ((pt (point)))
(not (and (>= pt beg)
(< pt end))))))))
(when (fboundp 'evil-goto-definition)
(ignore-errors
(cl-destructuring-bind (beg . end)
(bounds-of-thing-at-point 'symbol)
(evil-goto-definition)
(let ((pt (point)))
(not (and (>= pt beg)
(< pt end))))))))
(defun +lookup-ffap-backend-fn (_identifier)
"Uses `find-file-at-point' to read file at point."
(require 'ffap)
(when (ffap-guesser)
(find-file-at-point)))
(defun +lookup-bug-reference-backend-fn (_identifier)
"Searches for a bug reference in user/repo#123 or #123 format and opens it in
the browser."
(require 'bug-reference)
(let ((bug-reference-url-format bug-reference-url-format)
(bug-reference-bug-regexp bug-reference-bug-regexp)
(bug-reference-mode (derived-mode-p 'text-mode 'conf-mode))
(bug-reference-prog-mode (derived-mode-p 'prog-mode)))
(bug-reference--run-auto-setup)
(unwind-protect
(catch 'found
(bug-reference-fontify (line-beginning-position) (line-end-position))
(dolist (o (overlays-at (point)))
;; It should only be possible to have one URL overlay.
(when-let (url (overlay-get o 'bug-reference-url))
(browse-url url)
(throw 'found t))))
(bug-reference-unfontify (line-beginning-position) (line-end-position)))))
;;
@@ -317,22 +343,14 @@ for the current mode/buffer (if any), then falls back to the backends in
(defvar ffap-file-finder)
;;;###autoload
(defun +lookup/file (path)
(defun +lookup/file (&optional path)
"Figure out PATH from whatever is at point and open it.
Each function in `+lookup-file-functions' is tried until one changes the point
or the current buffer.
Otherwise, falls back on `find-file-at-point'."
(interactive
(progn
(require 'ffap)
(list
(or (ffap-guesser)
(ffap-read-file-or-url
(if ffap-url-regexp "Find file or URL: " "Find file: ")
(doom-thing-at-point-or-region))))))
(require 'ffap)
(interactive)
(cond ((and path
buffer-file-name
(file-equal-p path buffer-file-name)

View File

@@ -97,7 +97,9 @@ If the argument is interactive (satisfies `commandp'), it is called with
argument: the identifier at point. See `set-lookup-handlers!' about adding to
this list.")
(defvar +lookup-file-functions ()
(defvar +lookup-file-functions
'(+lookup-ffap-backend-fn
+lookup-bug-reference-backend-fn)
"Function for `+lookup/file' to try, before restoring to `find-file-at-point'.
Stops at the first function to return non-nil or change the current
window/point.
@@ -153,8 +155,10 @@ Dictionary.app behind the scenes to get definitions.")
(let ((xref-backend-functions '(etags--xref-backend t)))
(funcall orig-fn)))
;; Use `better-jumper' instead of xref's marker stack
(advice-add #'xref-push-marker-stack :around #'doom-set-jump-a)
;; This integration is already built into evil
(unless (featurep! :editor evil)
;; Use `better-jumper' instead of xref's marker stack
(advice-add #'xref-push-marker-stack :around #'doom-set-jump-a))
(use-package! ivy-xref
:when (featurep! :completion ivy)

View File

@@ -8,11 +8,11 @@
(package! helm))
;;
(package! dumb-jump :pin "0d74b2f2aa834b602e91d99e9cb23197a389f042")
(package! dumb-jump :pin "fbbe6b0c3010bea8a6eaac2297080137319160e2")
(when (featurep! :completion ivy)
(package! ivy-xref :pin "3d4c35fe2b243d948d8fe02a1f0d76a249d63de9"))
(when (featurep! :completion helm)
(package! helm-xref :pin "6b4a8bd91f5eaf82f51bd31b03f6587387fe6983"))
(package! helm-xref :pin "23f1174cfca7667d95828dcd388c655a4a9c877d"))
;; For dictionary and online lookup
(package! request :pin "d02d1347ffdf138cffd380cbeac62ac8732036ef")
@@ -27,7 +27,7 @@
(when (featurep! +dictionary)
(if IS-MAC
(package! osx-dictionary :pin "1b79ff64c72485cb078db9ab7ee3256b11a99f4b")
(package! define-word :pin "08c71b1ff4fd07bf0c78d1fcf77efeaafc8f7443")
(package! define-word :pin "3af6825c5f3bf4f6176a3f5b2e499616c65e2fe0")
(package! powerthesaurus :pin "93036d3b111925ebc34f747ff846cb0b8669b92e")
(when (featurep! +offline)
(package! wordnut :pin "feac531404041855312c1a046bde7ea18c674915")