From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#66403: [PATCH] Use delete-all-overlays in clean-mode Date: Sun, 08 Oct 2023 14:21:13 -0700 Message-ID: <871qe4u7tx.fsf@breatheoutbreathe.in> References: <87r0m5tp00.fsf@breatheoutbreathe.in> <83v8bhxvfm.fsf@gnu.org> Reply-To: Joseph Turner Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="841"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 66403@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 08 23:24:58 2023 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 1qpbGj-000ATz-IL for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 08 Oct 2023 23:24:58 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qpbGX-0001mN-9w; Sun, 08 Oct 2023 17:24:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qpbGU-0001mC-WD for bug-gnu-emacs@gnu.org; Sun, 08 Oct 2023 17:24:43 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qpbGU-0004Uo-OJ for bug-gnu-emacs@gnu.org; Sun, 08 Oct 2023 17:24:42 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qpbGo-0004hR-4n for bug-gnu-emacs@gnu.org; Sun, 08 Oct 2023 17:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Joseph Turner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Oct 2023 21:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66403 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 66403-submit@debbugs.gnu.org id=B66403.169680024717968 (code B ref 66403); Sun, 08 Oct 2023 21:25:02 +0000 Original-Received: (at 66403) by debbugs.gnu.org; 8 Oct 2023 21:24:07 +0000 Original-Received: from localhost ([127.0.0.1]:58774 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qpbFu-0004fj-Kd for submit@debbugs.gnu.org; Sun, 08 Oct 2023 17:24:06 -0400 Original-Received: from out-206.mta1.migadu.com ([95.215.58.206]:61101) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qpbFr-0004fa-Tx for 66403@debbugs.gnu.org; Sun, 08 Oct 2023 17:24:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; s=key1; t=1696800222; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=h12br24xDplyyss3zVdod+SDi6uD8p0/LFQ07jKpBhg=; b=N071DYZWRDjngTxnEWNUSGii7VElTRim+D3wPEZuR8UrvWhem2y0QaomiSdW83PeMCbNKl Iv8BdLQC2S/+buZg7MG5ijNd1A0Xfc0WVNmItxjf28FXS3pNp6RVW2x1PskUX3e+vYDXfR mlJQhIWIwVQBm6wzV21PwX101BuButw= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-reply-to: <83v8bhxvfm.fsf@gnu.org> X-Migadu-Flow: FLOW_OUT 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:272110 Archived-At: Eli Zaretskii writes: >> Date: Sun, 08 Oct 2023 02:57:25 -0700 >> From: Joseph Turner via "Bug reports for GNU Emacs, >> the Swiss army knife of text editors" >> >> Is there a reason to use dolist instead of delete-all-overlays? > > Can the buffer be narrowed? Ah, good catch. The following snippet only deletes ov1, whereas if you replace the dolist with delete-all-overlays, both are deleted. (with-current-buffer (generate-new-buffer "test-overlay-deletion") (insert "hello\n\nworld") (let ((ov1 (make-overlay 0 6)) (ov2 (make-overlay 8 13))) (overlay-put ov1 'display "aaaaa") (overlay-put ov2 'display "bbbbb")) (narrow-to-region 1 6) ;; (delete-all-overlays) (dolist (overlay (overlays-in (point-min) (point-max))) (delete-overlay overlay)) (widen) (pop-to-buffer (current-buffer))) Joseph