Rename Incremental Search and Other Search and Loop Commands section

This commit is contained in:
Gerard Vermeulen 2024-03-05 14:52:47 +01:00
parent 30dc8b6451
commit be9076cbdc

View File

@ -1706,15 +1706,16 @@ pairs.
| renumber grep/occur matches | =\(.+:\)= | =\,(1+ \#)._= | | renumber grep/occur matches | =\(.+:\)= | =\,(1+ \#)._= |
|-----------------------------+---------------------------------+---------------| |-----------------------------+---------------------------------+---------------|
** [[https://www.masteringemacs.org/article/searching-buffers-occur-mode][Searching and Editing in Buffers with Occur Mode]] ** [[info:emacs#Incremental Search][Incremental Search (info)]] and [[info:emacs#Other Repeating Search][Other Search and Loop Commands (info)]]
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: sec:occur :CUSTOM_ID: sec:search
:END: :END:
#+caption[Define =multi-occur-in-this-mode=]: #+caption[Define =multi-occur-in-this-mode=]:
#+caption: Define =multi-occur-in-this-mode=. #+caption: Define =multi-occur-in-this-mode=.
#+name: lst:multi-occur-in-this-mode #+name: lst:multi-occur-in-this-mode
#+begin_src emacs-lisp -n #+begin_src emacs-lisp -n
;; https://www.masteringemacs.org/article/searching-buffers-occur-mode
(defun get-buffers-matching-mode (mode) (defun get-buffers-matching-mode (mode)
"Return a list of buffers whose major-mode is equal to MODE." "Return a list of buffers whose major-mode is equal to MODE."
(let ((buffer-mode-matches '())) (let ((buffer-mode-matches '()))
@ -1732,6 +1733,57 @@ pairs.
(car (occur-read-primary-args)))) (car (occur-read-primary-args))))
#+end_src #+end_src
#+caption[Use =consult-line= from =isearch=]:
#+caption: Use =consult-line= from =isearch=.
#+name: lst:consult-line-from-isearch
#+begin_src emacs-lisp -n :results silent
;; https://blog.chmouel.com/posts/emacs-isearch/
(when (package-installed-p 'consult)
(defun consult-line-from-isearch ()
"Invoke `consult-line' from isearch."
(interactive)
(let ((query (if isearch-regexp
isearch-string
(regexp-quote isearch-string))))
(isearch-update-ring isearch-string isearch-regexp)
(let (search-nonincremental-instead)
(ignore-errors (isearch-done t t)))
(consult-line query)))
(keymap-set isearch-mode-map "C-l" #'consult-line-from-isearch))
#+end_src
#+caption[Use =occur= and =project-find-regexp= from =isearch=]:
#+caption: Use =occur= and =project-find-regexp= from =isearch=.
#+name: lst:occur-and-project-find-regexp-from-isearch
#+begin_src emacs-lisp -n :results silent
;; https://blog.chmouel.com/posts/emacs-isearch/
(defun occur-from-isearch ()
"Invoke `occur' from isearch."
(interactive)
(let ((query (if isearch-regexp
isearch-string
(regexp-quote isearch-string))))
(isearch-update-ring isearch-string isearch-regexp)
(let (search-nonincremental-instead)
(ignore-errors (isearch-done t t)))
(occur query)))
(defun project-find-regexp-from-isearch ()
"Invoke `project-find-regexp' from isearch."
(interactive)
(let ((query (if isearch-regexp
isearch-string
(regexp-quote isearch-string))))
(isearch-update-ring isearch-string isearch-regexp)
(let (search-nonincremental-instead)
(ignore-errors (isearch-done t t)))
(project-find-regexp query)))
(keymap-set isearch-mode-map "C-o" #'occur-from-isearch)
(keymap-set isearch-mode-map "C-f" #'project-find-regexp-from-isearch)
#+end_src
** [[https://www.genivia.com/get-ugrep.html][Ugrep]] ** [[https://www.genivia.com/get-ugrep.html][Ugrep]]
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: sec:ugrep :CUSTOM_ID: sec:ugrep