Search Results
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 |
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.
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 …
0
votes
2
answers
65
views
Build a "with-query-replace-description" macro
In the company where I work we use Emacs as the default editor for the LaTeX copy-editing tasks and we share some Emacs scripts to automate/guide some operations.
Actually I need to perform some query …
0
votes
Accepted
Build a "with-query-replace-description" macro
I've been successfully using this solution for quite some time now:
(defmacro with-interactive-tasks-explanation (MESSAGE &rest body)
"It allows displaying, in a dedicated buffer resized to the
nece …
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 …
0
votes
Accepted
query-replace* (perform-replace): highlighting issue with "act-and-show"
It seems to be a bug in Emacs 29. It was fixed in Emacs 30:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71430
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{" --> …
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 …
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 …
0
votes
Accepted
query-replace bug?
It was indeed a bug. I believe it will be fixed in Emacs version 29.2.
0
votes
0
answers
29
views
set-keymap-parent function and let binding of involved keymaps
I have this content in the buffer:
\begin{environment}
foo
Some other text here
\end{environment}
\begin{environment}
foo
Some other text here
\end{environment}
\begin{environment}
foo
Some other …
0
votes
1
answer
40
views
Using query-replace to add text properties to replacement strings in Emacs
I'm trying to use query-replace in Emacs to replace a string with another string that has specific text properties. Specifically, in this example, I want to replace occurrences of "foo" with "bar" and …
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 …
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 "\\<\\ …
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- …
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 …