Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 15606

query-replace is a built-in Emacs command for interactively replacing one string with another in a buffer. query-replace-regexp does the same thing, but with support for matching regular expressions. Use this tag for both commands.

3 votes
2 answers
153 views

Make region(s) invisible (not evaluated) to query-replacy and similar commands

Is there a way to make some regions of the buffer invisible (I mean not evaluated by) to query-replace and similar commands? Let me better explain with an example. Let's take a piece of LaTeX code . …
Gabriele's user avatar
  • 1,680
3 votes
3 answers
414 views

How to count regexp in a string and use that number in replacement?

In my LaTeX code I want to replace these strings: \left.\left.\left. \left.\left. \left. with: \left.\left.\left. \mycommand{3} \left.\left. \mycommand{2} \left. \mycommand{1} where the argument …
Gabriele's user avatar
  • 1,680
2 votes
1 answer
174 views

Add multiple predicates to isearch-filter-predicate

I wrote a set of predicates to filter matches in my ìsearch-* and query-replace* routines. I also wrote a macro to bind the isearch-filter-predicate variable to multiple predicates: (defmacro with-if …
Gabriele's user avatar
  • 1,680
1 vote
1 answer
137 views

Make query-replace skip certain matches

Lets say I have these strings: "foo", "fooo" and "fo". And this line of code: (query-replace-regexp "\\<fo+\\>" "foo" nil (point-min) (point-max)) I'd like to skip the query-replacement for the mat …
Gabriele's user avatar
  • 1,680
1 vote
1 answer
47 views

Face-based replacements

I need to perform this kind of (query-)substitutions in LaTeX code: "fig" --> "figure" But I don't want to match text inside commands e.g. \label{fig:1} or \includegraphics[width=2cm]{fig/D.pdf}. I f …
Gabriele's user avatar
  • 1,680
1 vote
Accepted

Face-based replacements

I want to answer my own question because I've just found that the redisplay command seems to solve my problem. I want to share my solution: (goto-char (point-min) (while (search-forward-regexp "\\<\\ …
Gabriele's user avatar
  • 1,680
1 vote
1 answer
192 views

Passing a string with substitutions to the "perform-replace" command

I want to generalize this query-replace regexp: (perform-replace "Geophysical[\s\t\n]*Research[\s\t\n]*Letters" "Geophys.\\\\ Res.\\\\ Lett." t t nil 1 nil (point- …
Gabriele's user avatar
  • 1,680
1 vote
2 answers
40 views

Temporary Inhibition of Mouse Events in Windows During Menu Opening

I'm facing an issue (Unwanted Focus Shift when Clicking Menu Functions in Emacs Mode Line) regarding mouse event handling in buffer windows during menus opening. To address this, I'm attempting to tem …
Gabriele's user avatar
  • 1,680
1 vote
Accepted

How to perform query-replace excluding LaTeX math?

If you don't need to discriminate between in-line mathematics and mathematical environments, you can simply use texmathp. You don't need to install AUCTeX, but you can retrieve the texmathp.el file fr …
Gabriele's user avatar
  • 1,680
1 vote
1 answer
45 views

query-replace* (perform-replace): highlighting issue with "act-and-show"

When I use the query-replace* (perform-replace) functions, I can type "," "to replace but not move point immediately." During the replacement, the function highlights the match, but if I type ",", the …
Gabriele's user avatar
  • 1,680
0 votes

Make region(s) invisible (not evaluated) to query-replacy and similar commands

I found that the read-only text property combined with the query-replace-skip-read-only variable also works for this purpose. Here's a simplified example of my code: (defun query-replace-skipping-mat …
Gabriele's user avatar
  • 1,680
0 votes
1 answer
27 views

query-replace, add a "skip to next" in lambda function

I have this function: (defun fix-mult-punct-before-footnote () "Scope: FOOTNOTE Description: Fixes repeated/multiple punctuation before the \\footnote macro." (interactive) ;; "..\footnote{" --> …
Gabriele's user avatar
  • 1,680
0 votes
Accepted

query-replace, add a "skip to next" in lambda function

The solution is built-in in query-replace-regexp: (defun fix-mult-punct-before-footnote () "Scope: FOOTNOTE Description: Fixes repeated/multiple punctuation before the \\footnote macro." (interact …
Gabriele's user avatar
  • 1,680
0 votes
1 answer
66 views

query-replace bug?

When I run query-replace* commands if I type ? I get this explanation of the function's options: Type Space or ‘y’ to replace one match, Delete or ‘n’ to skip to next, RET or ‘q’ to exit, Period to re …
Gabriele's user avatar
  • 1,680
0 votes
Accepted

query-replace bug?

It was indeed a bug. I believe it will be fixed in Emacs version 29.2.
Gabriele's user avatar
  • 1,680

15 30 50 per page