Article View: gnu.emacs.bug
Article #87385perform-replace handling of match-data
From: Dominique de Waleffe
Date: Wed, 28 Sep 1994 10:37
Date: Wed, 28 Sep 1994 10:37
61 lines
2799 bytes
2799 bytes
In GNU Emacs 19.27.1 (sparc-sun-sunos4.1.3, X toolkit) of Fri Sep 16 1994 on jacobi
Hi there,
A user here was having problems with query-replace and
tags-query-replace. I looked at it and found that in perform-replace
(replace.el) there is code to change the markers in the match-data
back to numbers. The function that does it does not check whether
it is passed a marker and sometimes tries to get the call
marker-position on a number. This fails. I could not reproduce this
in my environment but that was reproducible in his (which uses
hilit19, hence has lots of text properties around the buffers onto
which the query-replace function was called).
(match-data) is documented as possibly returning a list of markers or
a list of numbers.
It looks to me like
-----
;; Record previous position for ^ when we move on.
;; Change markers to numbers in the match data
;; since lots of markers slow down editing.
(setq stack
(cons (cons (point)
(or replaced
(mapcar (lambda (elt)
(and elt
(prog1 (marker-position elt)
(set-marker elt nil))))
(match-data))))
stack))
-----------
near the end of perform-replace could be changed to
;; Record previous position for ^ when we move on.
;; Change markers to numbers in the match data
;; since lots of markers slow down editing.
(setq stack
(cons (cons (point)
(or replaced
(mapcar (lambda (elt)
(if (numberp elt)
elt
;; nil or marker
(and elt
(prog1 (marker-position elt)
(set-marker elt nil)))))
(match-data))))
stack))
with a check on numberp or markerp on elt.
Regards,
Dominique
--
Dominique de Waleffe ddw@sunbim.be
BIM sa
Chaussee de Louvain, 510 Tel: +32 2 719 26 14
B-1930 Zaventem Fax: +32 2 725 47 83
Belgium PGP-Public-Key available on request
Technical Details
Message-ID:
<9409281027.AA11328@amadeus.sunbim.be>Path:
arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!deathstar.cris.com!news1.oakland.edu!newsxfer.itd.umich.edu!europa.eng.gtefsd.com!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!sunbim.BE!ddw2Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,ae89759c6ec7a03f,start X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1994-09-28 21:17:22 PST Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!deathstar.cris.com!news1.oakland.edu!newsxfer.itd.umich.edu!europa.eng.gtefsd.com!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!sunbim.BE!ddw2 From: ddw2@sunbim.BE (Dominique de Waleffe) Newsgroups: gnu.emacs.bug Subject: perform-replace handling of match-data Date: 28 Sep 1994 06:37:55 -0400 Organization: GNUs Not Usenet Lines: 62 Sender: daemon@cis.ohio-state.edu Approved: bug-gnu-emacs@prep.ai.mit.edu Distribution: gnu Message-ID: <9409281027.AA11328@amadeus.sunbim.be>