From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#39121: 27.0.60; occur: Add bindings for next-error-no-select Date: Sat, 24 Jul 2021 19:29:57 +0200 Message-ID: References: <87r1fzi7c3.fsf@mail.linkov.net> <871r7pazx1.fsf@gnus.org> <87wnpg2au7.fsf@gnus.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_75554E38-7061-4293-AB83-C7796877E55E" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37086"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Juri Linkov , 39121@debbugs.gnu.org, Tino Calancha To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 24 19:31:10 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m7LUT-0009VU-TN for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 24 Jul 2021 19:31:10 +0200 Original-Received: from localhost ([::1]:43874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7LUS-0005KQ-Ux for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 24 Jul 2021 13:31:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36882) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7LUM-0005KI-DA for bug-gnu-emacs@gnu.org; Sat, 24 Jul 2021 13:31:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35332) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m7LUM-0007h6-5P for bug-gnu-emacs@gnu.org; Sat, 24 Jul 2021 13:31:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m7LUL-0001OP-Ux for bug-gnu-emacs@gnu.org; Sat, 24 Jul 2021 13:31:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 24 Jul 2021 17:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39121 X-GNU-PR-Package: emacs Original-Received: via spool by 39121-submit@debbugs.gnu.org id=B39121.16271478075261 (code B ref 39121); Sat, 24 Jul 2021 17:31:01 +0000 Original-Received: (at 39121) by debbugs.gnu.org; 24 Jul 2021 17:30:07 +0000 Original-Received: from localhost ([127.0.0.1]:46878 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m7LTS-0001MN-Nj for submit@debbugs.gnu.org; Sat, 24 Jul 2021 13:30:07 -0400 Original-Received: from mail72c50.megamailservers.eu ([91.136.10.82]:55532 helo=mail92c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m7LTP-0001LE-C5 for 39121@debbugs.gnu.org; Sat, 24 Jul 2021 13:30:04 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1627147801; bh=DWvoNH+o6AVa2nNb/yoDw9C8g07wBifB9KiFYAsz5kE=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=W/8BvQTmCIB9LI/H+JLI/qZaUcceRqK1SsDGzEnKvDs2nLsQ0EIvXJb8REwixOpit Ts9ImDn2XNeta88uTzCKbiNus5+4r8bxIkh4Y5BHFnZUjcKBYX+0XPJelEdhRs29VH V0aHuk7EnzkU7vtZui8BdJ+CemgC04wVsX2yJN1s= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.0.4] (c188-150-171-71.bredband.tele2.se [188.150.171.71]) (authenticated bits=0) by mail92c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 16OHTw8W018071; Sat, 24 Jul 2021 17:30:00 +0000 In-Reply-To: <87wnpg2au7.fsf@gnus.org> X-Mailer: Apple Mail (2.3445.104.21) X-CTCH-RefID: str=0001.0A742F28.60FC4E19.000F, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=UJ+j4xXy c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=M51BFTxLslgA:10 a=OocQHUDgAAAA:8 a=irfnjWxm5M9kWPbGQF0A:9 a=CjuIK1q_8ugA:10 a=M3k1PryANISby0uPEgsA:9 a=B2y7HmGcmWMA:10 a=xUZTl98r3Qw_uB5NK3jt:22 X-Origin-Country: SE X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:210651 Archived-At: --Apple-Mail=_75554E38-7061-4293-AB83-C7796877E55E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 24 juli 2021 kl. 13.46 skrev Lars Ingebrigtsen : > That does indeed sound like a better solution. All right, this might work. Patch! The immediate visible benefit is that all matches on the same line are = highlighted, not just the first one. It also fixes the compatibility = problems mentioned above by removing occur-highlight-regexp entirely. External packages that populate occur-mode buffers themselves should = still work, since the old `occur-target` property format is still = recognised. In those cases we just highlight from the first match to the = end of the line. --Apple-Mail=_75554E38-7061-4293-AB83-C7796877E55E Content-Disposition: attachment; filename=0001-Keep-track-of-match-extents-in-occur-mode-bug-39121.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Keep-track-of-match-extents-in-occur-mode-bug-39121.patch" Content-Transfer-Encoding: quoted-printable =46rom=209035a88e1b62980f38362c938eba6b042d500686=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Sat,=2024=20Jul=202021=2016:32:11=20+0200=0A= Subject:=20[PATCH]=20Keep=20track=20of=20match=20extents=20in=20= occur-mode=20(bug#39121)=0A=0AUse=20the=20`occur-target`=20text=20= property=20to=20keep=20track=20of=20the=20extents=20of=0Aall=20matches=20= on=20each=20line=20instead=20of=20just=20the=20start=20of=20the=20first=20= match.=0ADoing=20so=20allows=20us=20to=20highlight=20all=20matches=20= when=20jumping=20to=20a=20matching=0Aline=20instead=20of=20just=20the=20= first=20one,=20and=20it=20works=20in=20a=20more=20principled=0Away.=20=20= It=20also=20removes=20compatibility=20problems=20that=20were=20= introduced=20with=0Aoccur-highlight-regexp.=0A=0AFor=20compatibility=20= with=20code=20that=20populate=20their=20own=20occur-mode=0Abuffers,=20we=20= still=20accept=20`occur-target`=20properties=20with=20a=20single=0A= marker=20as=20value.=0A=0A*=20lisp/replace.el=20(occur-highlight-regexp,=20= occur-highlight-overlay):=0ARemove.=0A(occur-highlight-overlays):=20New.=0A= (occur--targets-start):=20New.=0A*=20lisp/replace.el=20= (occur-after-change-function):=0A(occur-mode-find-occurrence):=20Replace=20= with...=0A(occur-mode--find-occurrences):=20...this=20function=20that=20= returns=20the=0Awhole=20`occur-target`=20property=20value.=0A= (occur-mode-goto-occurrence,=20occur-mode-goto-occurrence-other-window)=0A= (occur-goto-locus-delete-o,=20occur-mode-display-occurrence)=0A= (occur-engine):=20Adjust=20to=20new=20property=20format.=0A= (occur--highlight-occurrence):=20Replace=20with...=0A= (occur--highlight-occurrences):=20...this=20function=20that=20takes=0A= the=20`occur-target`=20property=20value=20as=20argument.=0A(occur-1):=20= Don't=20use=20`occur-highlight-regexp`.=0A*=20test/lisp/replace-tests.el=20= (occur-highlight-occurrence):=0AAdapt=20to=20new=20property=20format.=0A= ---=0A=20lisp/replace.el=20=20=20=20=20=20=20=20=20=20=20=20|=20177=20= +++++++++++++++++++------------------=0A=20test/lisp/replace-tests.el=20= |=20=20=202=20+-=0A=202=20files=20changed,=2091=20insertions(+),=2088=20= deletions(-)=0A=0Adiff=20--git=20a/lisp/replace.el=20b/lisp/replace.el=0A= index=207e30f1fc55..24befed241=20100644=0A---=20a/lisp/replace.el=0A+++=20= b/lisp/replace.el=0A@@=20-792,12=20+792,8=20@@=20regexp-history=0A=20= Maximum=20length=20of=20the=20history=20list=20is=20determined=20by=20= the=20value=0A=20of=20`history-length',=20which=20see.")=0A=20=0A= -(defvar=20occur-highlight-regexp=20t=0A-=20=20"Regexp=20matching=20part=20= of=20visited=20source=20lines=20to=20highlight=20temporarily.=0A= -Highlight=20entire=20line=20if=20t;=20don't=20highlight=20source=20= lines=20if=20nil.")=0A-=0A-(defvar=20occur-highlight-overlay=20nil=0A-=20= =20"Overlay=20used=20to=20temporarily=20highlight=20occur=20matches.")=0A= +(defvar=20occur-highlight-overlays=20nil=0A+=20=20"Overlays=20used=20to=20= temporarily=20highlight=20occur=20matches.")=0A=20=0A=20(defvar=20= occur-collect-regexp-history=20'("\\1")=0A=20=20=20"History=20of=20= regexp=20for=20occur's=20collect=20operation")=0A@@=20-1357,18=20= +1353,27=20@@=20occur-cease-edit=0A=20=20=20=20=20(occur-mode)=0A=20=20=20= =20=20(message=20"Switching=20to=20Occur=20mode.")))=0A=20=0A+(defun=20= occur--targets-start=20(targets)=0A+=20=20"First=20marker=20of=20the=20= `occur-target'=20property=20value=20TARGETS."=0A+=20=20(if=20(consp=20= targets)=0A+=20=20=20=20=20=20(caar=20targets)=0A+=20=20=20=20;;=20= Tolerate=20an=20`occur-target'=20value=20that=20is=20a=20single=20marker=20= for=0A+=20=20=20=20;;=20compatibility.=0A+=20=20=20=20targets))=0A+=0A=20= (defun=20occur-after-change-function=20(beg=20end=20length)=0A=20=20=20= (save-excursion=0A=20=20=20=20=20(goto-char=20beg)=0A=20=20=20=20=20= (let*=20((line-beg=20(line-beginning-position))=0A-=09=20=20=20(m=20= (get-text-property=20line-beg=20'occur-target))=0A+=09=20=20=20(targets=20= (get-text-property=20line-beg=20'occur-target))=0A+=20=20=20=20=20=20=20=20= =20=20=20(m=20(occur--targets-start=20targets))=0A=20=09=20=20=20(buf=20= (marker-buffer=20m))=0A=20=09=20=20=20col)=0A=20=20=20=20=20=20=20(when=20= (and=20(get-text-property=20line-beg=20'occur-prefix)=0A=20=09=09=20(not=20= (get-text-property=20end=20'occur-prefix)))=0A=20=09(when=20(=3D=20= length=200)=0A=20=09=20=20;;=20Apply=20occur-target=20property=20to=20= inserted=20(e.g.=20yanked)=20text.=0A-=09=20=20(put-text-property=20beg=20= end=20'occur-target=20m)=0A+=09=20=20(put-text-property=20beg=20end=20= 'occur-target=20targets)=0A=20=09=20=20;;=20Did=20we=20insert=20a=20= newline?=20=20Occur=20Edit=20mode=20can't=20create=20new=0A=20=09=20=20= ;;=20Occur=20entries;=20just=20discard=20everything=20after=20the=20= newline.=0A=20=09=20=20(save-excursion=0A@@=20-1402,35=20+1407,38=20@@=20= occur-revert-function=0A=20=20=20"Handle=20`revert-buffer'=20for=20Occur=20= mode=20buffers."=0A=20=20=20(apply=20#'occur-1=20(append=20= occur-revert-arguments=20(list=20(buffer-name)))))=0A=20=0A-(defun=20= occur-mode-find-occurrence=20()=0A-=20=20(let=20((pos=20= (get-text-property=20(point)=20'occur-target)))=0A-=20=20=20=20(unless=20= pos=0A+(defun=20occur-mode--find-occurrences=20()=0A+=20=20;;=20The=20= `occur-target'=20property=20value=20is=20a=20list=20of=20(BEG=20.=20END)=20= for=20each=0A+=20=20;;=20match=20on=20the=20line,=20or=20(for=20= compatibility)=20a=20single=20marker=20to=20the=20start=0A+=20=20;;=20of=20= the=20first=20match.=0A+=20=20(let*=20((targets=20(get-text-property=20= (point)=20'occur-target))=0A+=20=20=20=20=20=20=20=20=20(start=20= (occur--targets-start=20targets)))=0A+=20=20=20=20(unless=20targets=0A=20= =20=20=20=20=20=20(error=20"No=20occurrence=20on=20this=20line"))=0A-=20=20= =20=20(unless=20(buffer-live-p=20(marker-buffer=20pos))=0A+=20=20=20=20= (unless=20(buffer-live-p=20(marker-buffer=20start))=0A=20=20=20=20=20=20=20= (error=20"Buffer=20for=20this=20occurrence=20was=20killed"))=0A-=20=20=20= =20pos))=0A+=20=20=20=20targets))=0A=20=0A=20(defalias=20= 'occur-mode-mouse-goto=20'occur-mode-goto-occurrence)=0A=20(defun=20= occur-mode-goto-occurrence=20(&optional=20event)=0A=20=20=20"Go=20to=20= the=20occurrence=20specified=20by=20EVENT,=20a=20mouse=20click.=0A=20If=20= not=20invoked=20by=20a=20mouse=20click,=20go=20to=20occurrence=20on=20= the=20current=20line."=0A=20=20=20(interactive=20(list=20= last-nonmenu-event))=0A-=20=20(let=20((buffer=20(when=20event=20= (current-buffer)))=0A-=20=20=20=20=20=20=20=20(pos=0A-=20=20=20=20=20=20=20= =20=20(if=20(null=20event)=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20= Actually=20`event-end'=20works=20correctly=20with=20a=20nil=20argument=20= as=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20well,=20so=20we=20= could=20dispense=20with=20this=20test,=20but=20let's=20not=0A-=20=20=20=20= =20=20=20=20=20=20=20=20=20;;=20rely=20on=20this=20undocumented=20= behavior.=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20= (occur-mode-find-occurrence)=0A-=20=20=20=20=20=20=20=20=20=20=20= (with-current-buffer=20(window-buffer=20(posn-window=20(event-end=20= event)))=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20(save-excursion=0A-=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20(goto-char=20(posn-point=20= (event-end=20event)))=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (occur-mode-find-occurrence)))))=0A-=20=20=20=20=20=20=20=20(regexp=20= occur-highlight-regexp))=0A+=20=20(let*=20((buffer=20(when=20event=20= (current-buffer)))=0A+=20=20=20=20=20=20=20=20=20(targets=0A+=20=20=20=20= =20=20=20=20=20=20(if=20(null=20event)=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20;;=20Actually=20`event-end'=20works=20correctly=20with=20a=20= nil=20argument=20as=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20= well,=20so=20we=20could=20dispense=20with=20this=20test,=20but=20let's=20= not=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20rely=20on=20this=20= undocumented=20behavior.=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (occur-mode--find-occurrences)=0A+=20=20=20=20=20=20=20=20=20=20=20=20= (with-current-buffer=20(window-buffer=20(posn-window=20(event-end=20= event)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20(save-excursion=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(goto-char=20= (posn-point=20(event-end=20event)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(occur-mode--find-occurrences)))))=0A+=20=20=20=20=20=20=20=20= =20(pos=20(occur--targets-start=20targets)))=0A=20=20=20=20=20= (pop-to-buffer=20(marker-buffer=20pos))=0A=20=20=20=20=20(goto-char=20= pos)=0A-=20=20=20=20(let=20((end-mk=20(save-excursion=20= (re-search-forward=20regexp=20nil=20t))))=0A-=20=20=20=20=20=20= (occur--highlight-occurrence=20pos=20end-mk))=0A+=20=20=20=20= (occur--highlight-occurrences=20targets)=0A=20=20=20=20=20(when=20buffer=20= (next-error-found=20buffer=20(current-buffer)))=0A=20=20=20=20=20= (run-hooks=20'occur-mode-find-occurrence-hook)))=0A=20=0A@@=20-1438,15=20= +1446,15=20@@=20occur-mode-goto-occurrence-other-window=0A=20=20=20"Go=20= to=20the=20occurrence=20the=20current=20line=20describes,=20in=20another=20= window."=0A=20=20=20(interactive)=0A=20=20=20(let=20((buffer=20= (current-buffer))=0A-=20=20=20=20=20=20=20=20(pos=20= (occur-mode-find-occurrence)))=0A+=20=20=20=20=20=20=20=20(pos=20= (occur--targets-start=20(occur-mode--find-occurrences))))=0A=20=20=20=20=20= (switch-to-buffer-other-window=20(marker-buffer=20pos))=0A=20=20=20=20=20= (goto-char=20pos)=0A=20=20=20=20=20(next-error-found=20buffer=20= (current-buffer))=0A=20=20=20=20=20(run-hooks=20= 'occur-mode-find-occurrence-hook)))=0A=20=0A-;;=20Stolen=20from=20= compile.el=0A=20(defun=20occur-goto-locus-delete-o=20()=0A-=20=20= (delete-overlay=20occur-highlight-overlay)=0A+=20=20(mapc=20= #'delete-overlay=20occur-highlight-overlays)=0A+=20=20(setq=20= occur-highlight-overlays=20nil)=0A=20=20=20;;=20Get=20rid=20of=20timer=20= and=20hook=20that=20would=20try=20to=20do=20this=20again.=0A=20=20=20(if=20= (timerp=20next-error-highlight-timer)=0A=20=20=20=20=20=20=20= (cancel-timer=20next-error-highlight-timer))=0A@@=20-1454,64=20+1462,55=20= @@=20occur-goto-locus-delete-o=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20#'occur-goto-locus-delete-o))=0A=20=0A=20;;=20Highlight=20the=20= current=20visited=20occurrence.=0A-;;=20Adapted=20from=20= `compilation-goto-locus'.=0A-(defun=20occur--highlight-occurrence=20(mk=20= end-mk)=0A-=20=20(let=20((highlight-regexp=20occur-highlight-regexp))=0A= -=20=20=20=20(if=20(timerp=20next-error-highlight-timer)=0A-=20=20=20=20=20= =20=20=20(cancel-timer=20next-error-highlight-timer))=0A-=20=20=20=20= (unless=20occur-highlight-overlay=0A-=20=20=20=20=20=20(setq=20= occur-highlight-overlay=0A-=09=20=20=20=20(make-overlay=20(point-min)=20= (point-min)))=0A-=20=20=20=20=20=20(overlay-put=20= occur-highlight-overlay=20'face=20'next-error))=0A-=20=20=20=20= (with-current-buffer=20(marker-buffer=20mk)=0A-=20=20=20=20=20=20= (save-excursion=0A-=20=20=20=20=20=20=20=20(if=20end-mk=20(goto-char=20= end-mk)=20(end-of-line))=0A-=20=20=20=20=20=20=20=20(let=20((end=20= (point)))=0A-=09=20=20(if=20mk=20(goto-char=20mk)=20(beginning-of-line))=0A= -=09=20=20(if=20(and=20(stringp=20highlight-regexp)=0A-=09=09=20=20=20= (re-search-forward=20highlight-regexp=20end=20t))=0A-=09=20=20=20=20=20=20= (progn=0A-=09=20=20=20=20=20=20=20=20(goto-char=20(match-beginning=200))=0A= -=09=20=20=20=20=20=20=20=20(move-overlay=20occur-highlight-overlay=0A-=09= =09=09=20=20=20=20=20=20(match-beginning=200)=20(match-end=200)=0A-=09=09= =09=20=20=20=20=20=20(current-buffer)))=0A-=09=20=20=20=20(move-overlay=20= occur-highlight-overlay=0A-=09=09=09=20=20(point)=20end=20= (current-buffer)))=0A-=09=20=20(if=20(or=20(eq=20next-error-highlight=20= t)=0A-=09=09=20=20(numberp=20next-error-highlight))=0A-=09=20=20=20=20=20= =20;;=20We=20want=20highlighting:=20delete=20overlay=20on=20next=20= input.=0A-=09=20=20=20=20=20=20(add-hook=20'pre-command-hook=0A-=09=09=20= =20=20=20=20=20=20=20#'occur-goto-locus-delete-o)=0A-=09=20=20=20=20;;=20= We=20don't=20want=20highlighting:=20delete=20overlay=20now.=0A-=09=20=20=20= =20(delete-overlay=20occur-highlight-overlay))=0A-=09=20=20;;=20We=20= want=20highlighting=20for=20a=20limited=20time:=0A-=09=20=20;;=20set=20= up=20a=20timer=20to=20delete=20it.=0A-=09=20=20(when=20(numberp=20= next-error-highlight)=0A-=09=20=20=20=20(setq=20= next-error-highlight-timer=0A-=09=09=20=20(run-at-time=20= next-error-highlight=20nil=0A-=09=09=09=20=20=20=20=20=20=20= 'occur-goto-locus-delete-o))))))=0A-=20=20=20=20(when=20(eq=20= next-error-highlight=20'fringe-arrow)=0A-=20=20=20=20=20=20;;=20We=20= want=20a=20fringe=20arrow=20(instead=20of=20highlighting).=0A-=20=20=20=20= =20=20(setq=20next-error-overlay-arrow-position=0A-=09=20=20=20=20= (copy-marker=20(line-beginning-position))))))=0A+(defun=20= occur--highlight-occurrences=20(targets)=0A+=20=20(let=20((start-marker=20= (occur--targets-start=20targets)))=0A+=20=20=20=20= (occur-goto-locus-delete-o)=0A+=20=20=20=20(with-current-buffer=20= (marker-buffer=20start-marker)=0A+=20=20=20=20=20=20(when=20(or=20(eq=20= next-error-highlight=20t)=0A+=09=20=20=20=20=20=20=20=20(numberp=20= next-error-highlight))=0A+=20=20=20=20=20=20=20=20(setq=20= occur-highlight-overlays=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (mapcar=20(lambda=20(target)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(let=20((o=20(make-overlay=20(car=20= target)=20(cdr=20target))))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20(overlay-put=20o=20'face=20= 'next-error)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20o))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(if=20(listp=20targets)=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20targets=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20= `occur-target'=20compatibility:=20when=20we=20only=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20have=20a=20= single=20starting=20point,=20highlight=20the=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20rest=20of=20the=20= line.=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(let=20((end-pos=20(save-excursion=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(goto-char=20start-marker)=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(line-end-position))))=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(list=20(cons=20= start-marker=20end-pos))))))=0A+=20=20=20=20=20=20=20=20(add-hook=20= 'pre-command-hook=20#'occur-goto-locus-delete-o)=0A+=20=20=20=20=20=20=20= =20(when=20(numberp=20next-error-highlight)=0A+=20=20=20=20=20=20=20=20=20= =20;;=20We=20want=20highlighting=20for=20a=20limited=20time:=0A+=20=20=20= =20=20=20=20=20=20=20;;=20set=20up=20a=20timer=20to=20delete=20it.=0A+=09= =20=20(setq=20next-error-highlight-timer=0A+=09=20=20=20=20=20=20=20=20= (run-at-time=20next-error-highlight=20nil=0A+=09=09=09=20=20=20=20=20= 'occur-goto-locus-delete-o))))=0A+=0A+=20=20=20=20=20=20(when=20(eq=20= next-error-highlight=20'fringe-arrow)=0A+=20=20=20=20=20=20=20=20;;=20We=20= want=20a=20fringe=20arrow=20(instead=20of=20highlighting).=0A+=20=20=20=20= =20=20=20=20(setq=20next-error-overlay-arrow-position=0A+=09=20=20=20=20=20= =20(copy-marker=20(line-beginning-position)))))))=0A=20=0A=20(defun=20= occur-mode-display-occurrence=20()=0A=20=20=20"Display=20in=20another=20= window=20the=20occurrence=20the=20current=20line=20describes."=0A=20=20=20= (interactive)=0A-=20=20(let=20((buffer=20(current-buffer))=0A-=20=20=20=20= =20=20=20=20(pos=20(occur-mode-find-occurrence))=0A-=20=20=20=20=20=20=20= =20(regexp=20occur-highlight-regexp)=0A-=20=20=20=20=20=20=20=20= (next-error-highlight=20next-error-highlight-no-select)=0A-=20=20=20=20=20= =20=20=20(display-buffer-overriding-action=0A-=20=20=20=20=20=20=20=20=20= '(nil=20(inhibit-same-window=20.=20t)))=0A-=09window)=0A+=20=20(let*=20= ((buffer=20(current-buffer))=0A+=20=20=20=20=20=20=20=20=20(targets=20= (occur-mode--find-occurrences))=0A+=20=20=20=20=20=20=20=20=20(pos=20= (occur--targets-start=20targets))=0A+=20=20=20=20=20=20=20=20=20= (next-error-highlight=20next-error-highlight-no-select)=0A+=20=20=20=20=20= =20=20=20=20(display-buffer-overriding-action=0A+=20=20=20=20=20=20=20=20= =20=20'(nil=20(inhibit-same-window=20.=20t)))=0A+=09=20window)=0A=20=20=20= =20=20(setq=20window=20(display-buffer=20(marker-buffer=20pos)=20t))=0A=20= =20=20=20=20;;=20This=20is=20the=20way=20to=20set=20point=20in=20the=20= proper=20window.=0A=20=20=20=20=20(save-selected-window=0A=20=20=20=20=20= =20=20(select-window=20window)=0A=20=20=20=20=20=20=20(goto-char=20pos)=0A= -=20=20=20=20=20=20(let=20((end-mk=20(save-excursion=20= (re-search-forward=20regexp=20nil=20t))))=0A-=20=20=20=20=20=20=20=20= (occur--highlight-occurrence=20pos=20end-mk))=0A+=20=20=20=20=20=20= (occur--highlight-occurrences=20targets)=0A=20=20=20=20=20=20=20= (next-error-found=20buffer=20(current-buffer))=0A=20=20=20=20=20=20=20= (run-hooks=20'occur-mode-find-occurrence-hook))))=0A=20=0A@@=20-1868,7=20= +1867,6=20@@=20occur-1=0A=20=09=20=20=20=20(buffer-undo-list=20t)=0A=20=09= =20=20=20=20(occur--final-pos=20nil))=0A=20=09(erase-buffer)=0A-=20=20=20= =20=20=20=20=20(setq-local=20occur-highlight-regexp=20regexp)=0A=20=09= (let=20((count=0A=20=09=20=20=20=20=20=20=20(if=20(stringp=20nlines)=0A=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20Treat=20= nlines=20as=20a=20regexp=20to=20collect.=0A@@=20-1968,7=20+1966,7=20@@=20= occur-engine=0A=20=09=09=20=20=20=20=20=20=20(origpt=20nil)=0A=20=09=09=20= =20=20=20=20=20=20(begpt=20nil)=0A=20=09=09=20=20=20=20=20=20=20(endpt=20= nil)=0A-=09=09=20=20=20=20=20=20=20(marker=20nil)=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20markers=20=20=20=20=20=20= =20=20=20=20=20=20;=20list=20of=20(BEG-MARKER=20.=20END-MARKER)=0A=20=09=09= =20=20=20=20=20=20=20(curstring=20"")=0A=20=09=09=20=20=20=20=20=20=20= (ret=20nil)=0A=20=09=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20= The=20following=20binding=20is=20for=20when=20case-fold-search=0A@@=20= -1994,8=20+1992,7=20@@=20occur-engine=0A=20=09=09=20=20=20=20=20=20=20=20= (setq=20endpt=20(line-end-position)))=0A=20=09=09=20=20=20=20=20=20;;=20= Sum=20line=20numbers=20up=20to=20the=20first=20match=20line.=0A=20=09=09=20= =20=20=20=20=20(setq=20curr-line=20(+=20curr-line=20(count-lines=20= origpt=20begpt)))=0A-=09=09=20=20=20=20=20=20(setq=20marker=20= (make-marker))=0A-=09=09=20=20=20=20=20=20(set-marker=20marker=20= matchbeg)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(setq=20markers=20nil)=0A=20=09=09=20=20=20=20=20=20(setq=20= curstring=20(occur-engine-line=20begpt=20endpt=20keep-props))=0A=20=09=09= =20=20=20=20=20=20;;=20Highlight=20the=20matches=0A=20=09=09=20=20=20=20=20= =20(let=20((len=20(length=20curstring))=0A@@=20-2017,6=20+2014,11=20@@=20= occur-engine=0A=20=09=09=09=20=20=20=20(setq=20orig-line-shown-p=20t)))=0A= =20=09=09=20=20=20=20=20=20=20=20(while=20(and=20(<=20start=20len)=0A=20=09= =09=09=09=20=20=20=20(string-match=20regexp=20curstring=20start))=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (push=20(cons=20(set-marker=20(make-marker)=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(+=20begpt=20= (match-beginning=200)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (set-marker=20(make-marker)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(+=20begpt=20(match-end=200))))=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20markers)=0A=20=09=09=09=20=20(setq=20matches=20(1+=20= matches))=0A=20=09=09=09=20=20(add-text-properties=0A=20=09=09=09=20=20=20= (match-beginning=200)=20(match-end=200)=0A@@=20-2029,6=20+2031,7=20@@=20= occur-engine=0A=20=09=09=09=20=20;;=20Avoid=20infloop=20(Bug#7593).=0A=20= =09=09=09=20=20(let=20((end=20(match-end=200)))=0A=20=09=09=09=20=20=20=20= (setq=20start=20(if=20(=3D=20start=20end)=20(1+=20start)=20end)))))=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(setq=20= markers=20(nreverse=20markers))=0A=20=09=09=20=20=20=20=20=20;;=20= Generate=20the=20string=20to=20insert=20for=20this=20match=0A=20=09=09=20= =20=20=20=20=20(let*=20((match-prefix=0A=20=09=09=09=20=20=20=20=20=20;;=20= Using=207=20digits=20aligns=20tabs=20properly.=0A@@=20-2042,7=20+2045,7=20= @@=20occur-engine=0A=20=09=09=09=09=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20;;=20(for=20Occur=20Edit=20mode).=0A=20=09=09=09=09= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= front-sticky=20t=0A=20=09=09=09=09=09=09=20=20=20=20=20rear-nonsticky=20= t=0A-=09=09=09=09=09=09=20=20=20=20=20occur-target=20,marker=0A+=09=09=09= =09=09=09=20=20=20=20=20occur-target=20,markers=0A=20=09=09=09=09=09=09=20= =20=20=20=20follow-link=20t=0A=20=09=09=09=09=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20help-echo=20"mouse-2:=20go=20to=20this=20= occurrence"))))=0A=20=09=09=09=20=20=20=20=20(match-str=0A@@=20-2050,7=20= +2053,7=20@@=20occur-engine=0A=20=09=09=09=20=20=20=20=20=20;;=20because=20= that=20loses.=20=20And=20don't=20put=20it=0A=20=09=09=09=20=20=20=20=20=20= ;;=20on=20context=20lines=20to=20reduce=20flicker.=0A=20=09=09=09=20=20=20= =20=20=20(propertize=20curstring=0A-=09=09=09=09=09=20=20'occur-target=20= marker=0A+=09=09=09=09=09=20=20'occur-target=20markers=0A=20=09=09=09=09=09= =20=20'follow-link=20t=0A=20=09=09=09=09=09=20=20'help-echo=0A=20=09=09=09= =09=09=20=20"mouse-2:=20go=20to=20this=20occurrence"))=0A@@=20-2069,8=20= +2072,8=20@@=20occur-engine=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20get=20a=20= contiguous=20highlight.=0A=20=09=09=09=20=20=20=20=20=20=20=20= (propertize=20(concat=20match-prefix=20match-str)=0A=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20'mouse-face=20'highlight))=0A-=09=09= =09=20=20=20=20=20=20=20;;=20Add=20marker=20at=20eol,=20but=20no=20mouse=20= props.=0A-=09=09=09=20=20=20=20=20=20=20(propertize=20"\n"=20= 'occur-target=20marker)))=0A+=09=09=09=20=20=20=20=20=20=20;;=20Add=20= markers=20at=20eol,=20but=20no=20mouse=20props.=0A+=09=09=09=20=20=20=20=20= =20=20(propertize=20"\n"=20'occur-target=20markers)))=0A=20=09=09=09=20=20= =20=20=20(data=0A=20=09=09=09=20=20=20=20=20=20(if=20(=3D=20nlines=200)=0A= =20=09=09=09=09=20=20;;=20The=20simple=20display=20style=0Adiff=20--git=20= a/test/lisp/replace-tests.el=20b/test/lisp/replace-tests.el=0Aindex=20= 417946c35f..7f62a417a0=20100644=0A---=20a/test/lisp/replace-tests.el=0A= +++=20b/test/lisp/replace-tests.el=0A@@=20-589,7=20+589,7=20@@=20= occur-highlight-occurrence=0A=20=20=20=20=20=20=20= (replace-tests-with-highlighted-occurrence=20highlight-locus=0A=20=20=20=20= =20=20=20=20=20(occur-mode-display-occurrence)=0A=20=20=20=20=20=20=20=20= =20(with-current-buffer=20(marker-buffer=0A-=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (get-text-property=20(point)=20'occur-target))=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(caar=20= (get-text-property=20(point)=20'occur-target)))=0A=20=20=20=20=20=20=20=20= =20=20=20(should=20(funcall=20check-overlays=20has-overlay)))))))=0A=20=0A= =20(ert-deftest=20replace-regexp-bug45973=20()=0A--=20=0A2.21.1=20(Apple=20= Git-122.3)=0A=0A= --Apple-Mail=_75554E38-7061-4293-AB83-C7796877E55E--