From 890c31f329c9f17641a6f4068aa3ae7116b60db6 Mon Sep 17 00:00:00 2001 From: GrĂ©goire DuchĂȘne Date: Sat, 15 Jan 2022 13:47:27 +0000 Subject: emacs: Add my/isearch-region advice to isearch If the region is active, my/isearch-region will add its contents to the search string. --- emacs/functions.el | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'emacs/functions.el') diff --git a/emacs/functions.el b/emacs/functions.el index e81639a..fc8431f 100644 --- a/emacs/functions.el +++ b/emacs/functions.el @@ -9,6 +9,17 @@ (expand-file-name name (concat (xdg-data-home) "/emacs"))) +;; Search Helpers + +(defun my/isearch-region (&rest _args) + "Pull the contents of the region into the search string if it +is active." + (when (use-region-p) + (deactivate-mark) + (isearch-yank-string (buffer-substring-no-properties + (region-beginning) (region-end))))) + + ;; Theme Functions (defun my/macos-dark-p () -- cgit v1.2.3-70-g09d2