mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-24 03:50:24 +10:00
Minor updates.
This commit is contained in:
@@ -192,6 +192,18 @@ This can be passed nil as its second argument to unset handlers for MODES. e.g.
|
||||
'deferred
|
||||
t))))
|
||||
|
||||
(defun +lookup-dictionary-definition-backend-fn (identifier)
|
||||
"Look up dictionary definition for IDENTIFIER."
|
||||
(when (derived-mode-p 'text-mode)
|
||||
(+lookup/dictionary-definition identifier)
|
||||
'deferred))
|
||||
|
||||
(defun +lookup-thesaurus-definition-backend-fn (identifier)
|
||||
"Look up synonyms for IDENTIFIER."
|
||||
(when (derived-mode-p 'text-mode)
|
||||
(+lookup/synonyms identifier)
|
||||
'deferred))
|
||||
|
||||
(defun +lookup-xref-definitions-backend-fn (identifier)
|
||||
"Non-interactive wrapper for `xref-find-definitions'"
|
||||
(+lookup--xref-show 'xref-backend-definitions identifier #'xref--show-defs))
|
||||
@@ -343,7 +355,7 @@ Otherwise, falls back on `find-file-at-point'."
|
||||
(list (or (doom-thing-at-point-or-region 'word)
|
||||
(read-string "Look up in dictionary: "))
|
||||
current-prefix-arg))
|
||||
(message "Looking up definition for %S" identifier)
|
||||
(message "Looking up dictionary definition for %S" identifier)
|
||||
(cond ((and IS-MAC (require 'osx-dictionary nil t))
|
||||
(osx-dictionary--view-result identifier))
|
||||
((and +lookup-dictionary-prefer-offline
|
||||
|
||||
@@ -16,24 +16,23 @@
|
||||
|
||||
;;;###autoload
|
||||
(defun +lookup-online-backend-fn (identifier)
|
||||
"Opens the browser and searches for IDENTIFIER online.
|
||||
|
||||
Will prompt for which search engine to use the first time (or if the universal
|
||||
argument is non-nil)."
|
||||
"Open the browser and search for IDENTIFIER online.
|
||||
When called for the first time, or with a non-nil prefix argument, prompt for
|
||||
the search engine to use."
|
||||
(+lookup/online
|
||||
identifier
|
||||
(+lookup--online-provider (not current-prefix-arg))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +lookup/online (query provider)
|
||||
"Looks up QUERY (a string) in you browser usin PROVIDER.
|
||||
"Look up QUERY in the browser using PROVIDER.
|
||||
When called interactively, prompt for a query and, when called for the first
|
||||
time, the provider from `+lookup-provider-url-alist'. In subsequent calls, reuse
|
||||
the previous provider. With a non-nil prefix argument, always prompt for the
|
||||
provider.
|
||||
|
||||
PROVIDER should be a key of `+lookup-provider-url-alist'.
|
||||
|
||||
When used interactively, it will prompt for a query and, for the first time, the
|
||||
provider from `+lookup-provider-url-alist'. On consecutive uses, the last
|
||||
provider will be reused. If the universal argument is supplied, always prompt
|
||||
for the provider."
|
||||
QUERY must be a string, and PROVIDER must be a key of
|
||||
`+lookup-provider-url-alist'."
|
||||
(interactive
|
||||
(list (if (use-region-p) (doom-thing-at-point-or-region))
|
||||
(+lookup--online-provider current-prefix-arg)))
|
||||
@@ -64,7 +63,7 @@ for the provider."
|
||||
|
||||
;;;###autoload
|
||||
(defun +lookup/online-select ()
|
||||
"Runs `+lookup/online', but always prompts for the provider to use."
|
||||
"Run `+lookup/online', but always prompt for the provider to use."
|
||||
(interactive)
|
||||
(let ((current-prefix-arg t))
|
||||
(call-interactively #'+lookup/online)))
|
||||
@@ -77,7 +76,7 @@ for the provider."
|
||||
(defvar counsel-search-engine)
|
||||
;;;###autoload
|
||||
(defun +lookup--online-backend-google (query)
|
||||
"Search google, starting with QUERY, with live autocompletion."
|
||||
"Search Google, starting with QUERY, with live autocompletion."
|
||||
(cond ((fboundp 'counsel-search)
|
||||
(let ((ivy-initial-inputs-alist `((t . ,query)))
|
||||
(counsel-search-engine 'google))
|
||||
@@ -91,7 +90,7 @@ for the provider."
|
||||
|
||||
;;;###autoload
|
||||
(defun +lookup--online-backend-duckduckgo (query)
|
||||
"Search duckduckgo, starting with QUERY, with live autocompletion."
|
||||
"Search DuckDuckGo, starting with QUERY, with live autocompletion."
|
||||
(cond ((fboundp 'counsel-search)
|
||||
(let ((ivy-initial-inputs-alist `((t . ,query)))
|
||||
(counsel-search-engine 'ddg))
|
||||
|
||||
Reference in New Issue
Block a user