emacs: add section related to query-replace

This commit is contained in:
Protesilaos 2026-08-15 21:40:17 +03:00
parent 9069f5e88b
commit d332c08c28
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA
2 changed files with 25 additions and 0 deletions

View file

@ -19,6 +19,10 @@
(setq isearch-wrap-pause t) ; `no-ding' makes keyboard macros never quit
(setq isearch-repeat-on-direction-change t))
(prot-emacs-configure
(setq query-replace-show-preview t) ; Emacs 32
(setq query-replace-from-to-separator " > "))
(prot-emacs-configure
(setq list-matching-lines-jump-to-current-line nil) ; do not jump to current line in `*occur*' buffers
(prot-emacs-hook occur-mode-hook (prot-common-truncate-lines-silently hl-line-mode)))
@ -76,6 +80,7 @@
;; All those have been changed for Emacs 28
(setq xref-show-definitions-function #'xref-show-definitions-completing-read) ; for M-.
(setq xref-show-xrefs-function #'xref-show-definitions-buffer) ; for grep and the like
(setq xref-file-name-display 'project-relative)
(setq xref-search-program (if ripgrep 'ripgrep 'grep))

View file

@ -5657,6 +5657,26 @@ end of the buffer).
(setq isearch-repeat-on-direction-change t))
#+end_src
*** The =prot-emacs-search.el= settings for ~query-replace
:PROPERTIES:
:CUSTOM_ID: h:7003a374-66e3-4b32-971d-9cc23144364c
:END:
[ Watch: [[https://protesilaos.com/codelog/2023-06-10-emacs-search-replace-basics/][Emacs: basics of search and replace]] (2023-06-10). ]
The ~query-replace~ command provides an interactive method for
replacing text from the point onward. The default behaviour is to ask
the user whether to replace the current match or not. Sometimes I need
to go through the results one-by-one, though I usually perform a
replacement on everything by inputting =!= at the prompt. That
granted, I rely more on my ~substitute~ package ([[#h:b4b3c8b7-e35c-4a56-bfb9-0c8bb33b2423][The =prot-emacs-essentials.el= section about ~substitute~]]).
#+begin_src emacs-lisp :tangle "prot-emacs-modules/prot-emacs-search.el"
(prot-emacs-configure
(setq query-replace-show-preview t) ; Emacs 32
(setq query-replace-from-to-separator " > "))
#+end_src
*** The =prot-emacs-search.el= tweaks for the occur buffer
:PROPERTIES:
:CUSTOM_ID: h:85aca4da-b89b-4fbe-89e9-3ec536ad7b0d