Generalize thing-at-point & region functions
This commit is contained in:
parent
d426349f21
commit
27bf3c85b5
7 changed files with 80 additions and 58 deletions
|
@ -43,7 +43,7 @@ If ARG (universal argument), runs `compile' from the current directory."
|
|||
(unless (bound-and-true-p lsp-mode)
|
||||
(user-error "Not in an LSP buffer"))
|
||||
(call-interactively
|
||||
(if (use-region-p)
|
||||
(if (doom-region-active-p)
|
||||
#'lsp-format-region
|
||||
#'lsp-format-buffer)))
|
||||
|
||||
|
|
|
@ -45,17 +45,12 @@ If prefix ARG is set, prompt for a known project to search from."
|
|||
(+default/search-project 'other))
|
||||
|
||||
;;;###autoload
|
||||
(defun +default/search-project-for-symbol-at-point (&optional arg symbol)
|
||||
(defun +default/search-project-for-symbol-at-point (&optional symbol arg)
|
||||
"Search current project for symbol at point.
|
||||
If prefix ARG is set, prompt for a known project to search from."
|
||||
(interactive
|
||||
(list current-prefix-arg
|
||||
(or (and (use-region-p)
|
||||
(rxt-quote-pcre
|
||||
(buffer-substring-no-properties (region-beginning)
|
||||
(region-end))))
|
||||
(rxt-quote-pcre (thing-at-point 'symbol t))
|
||||
"")))
|
||||
(list (rxt-quote-pcre (or (doom-thing-at-point-or-region) ""))
|
||||
current-prefix-arg))
|
||||
(let ((default-directory
|
||||
(if arg
|
||||
(if-let (projects (projectile-relevant-known-projects))
|
||||
|
@ -74,7 +69,7 @@ If prefix ARG is set, prompt for a known project to search from."
|
|||
"Conduct a text search in the current project for symbol at point. If prefix
|
||||
ARG is set, prompt for a known project to search from."
|
||||
(interactive
|
||||
(list (rxt-quote-pcre (or (thing-at-point 'symbol t) ""))))
|
||||
(list (rxt-quote-pcre (or (doom-thing-at-point-or-region) ""))))
|
||||
(require 'org)
|
||||
(let ((default-directory org-directory))
|
||||
(+default/search-project-for-symbol-at-point
|
||||
|
@ -86,7 +81,7 @@ ARG is set, prompt for a known project to search from."
|
|||
(interactive)
|
||||
(require 'org)
|
||||
(let ((default-directory org-directory))
|
||||
(+default/search-project-for-symbol-at-point nil "")))
|
||||
(+default/search-project-for-symbol-at-point "")))
|
||||
|
||||
;;;###autoload
|
||||
(defun +default/org-notes-headlines ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue