Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
c0b45763
Commit
c0b45763
authored
Dec 27, 2005
by
Richard M. Stallman
Browse files
(perform-replace): Calculate match-again
before skipping read-only matches.
parent
d6f0f3e0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
21 deletions
+25
-21
lisp/ChangeLog
lisp/ChangeLog
+3
-0
lisp/replace.el
lisp/replace.el
+22
-21
No files found.
lisp/ChangeLog
View file @
c0b45763
2005-12-26 Richard M. Stallman <rms@gnu.org>
* replace.el (perform-replace): Calculate match-again
before skipping read-only matches.
* paren.el (paren-showing-faces): New group.
(show-paren-match, show-paren-mismatch): Move to that group.
...
...
lisp/replace.el
View file @
c0b45763
...
...
@@ -1474,32 +1474,33 @@ make, or the user didn't cancel the call."
;; For speed, use only integers and
;; reuse the list used last time.
(
replace-match-data
t
real-match-data
)))))
;; Record whether the match is nonempty, to avoid an infinite loop
;; repeatedly matching the same empty string.
(
setq
nonempty-match
(
/=
(
nth
0
real-match-data
)
(
nth
1
real-match-data
)))
;; If the match is empty, record that the next one can't be
;; adjacent.
;; Otherwise, if matching a regular expression, do the next
;; match now, since the replacement for this match may
;; affect whether the next match is adjacent to this one.
;; If that match is empty, don't use it.
(
setq
match-again
(
and
nonempty-match
(
or
(
not
regexp-flag
)
(
and
(
looking-at
search-string
)
(
let
((
match
(
match-data
)))
(
and
(
/=
(
nth
0
match
)
(
nth
1
match
))
match
))))))
;; Optionally ignore matches that have a read-only property.
(
unless
(
and
query-replace-skip-read-only
(
text-property-not-all
(
match-beginning
0
)
(
match-
end
0
)
(
nth
0
real-match-data
)
(
nth
1
real-
match-
data
)
'read-only
nil
))
;; Record whether the match is nonempty, to avoid an infinite loop
;; repeatedly matching the same empty string.
(
setq
nonempty-match
(
/=
(
nth
0
real-match-data
)
(
nth
1
real-match-data
)))
;; If the match is empty, record that the next one can't be
;; adjacent.
;; Otherwise, if matching a regular expression, do the next
;; match now, since the replacement for this match may
;; affect whether the next match is adjacent to this one.
;; If that match is empty, don't use it.
(
setq
match-again
(
and
nonempty-match
(
or
(
not
regexp-flag
)
(
and
(
looking-at
search-string
)
(
let
((
match
(
match-data
)))
(
and
(
/=
(
nth
0
match
)
(
nth
1
match
))
match
))))))
;; Calculate the replacement string, if necessary.
(
when
replacements
(
set-match-data
real-match-data
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment