From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#13648: 24.3.50; remove-overlays bugs Date: Tue, 25 Aug 2020 13:44:55 +0200 Message-ID: <87sgcb9cg8.fsf@gnus.org> References: <8738x8b1pa.fsf@rosalinde.fritz.box> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12918"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Stephen Berman , 13648@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 25 13:46:09 2020 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 1kAXOz-0003E0-Hh for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 25 Aug 2020 13:46:09 +0200 Original-Received: from localhost ([::1]:43416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kAXOy-0002ng-Ff for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 25 Aug 2020 07:46:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52780) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAXOs-0002nY-Jt for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2020 07:46:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49026) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kAXOs-000127-Au for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2020 07:46:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kAXOs-0005Jj-93 for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2020 07:46:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Aug 2020 11:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13648 X-GNU-PR-Package: emacs Original-Received: via spool by 13648-submit@debbugs.gnu.org id=B13648.159835590817271 (code B ref 13648); Tue, 25 Aug 2020 11:46:02 +0000 Original-Received: (at 13648) by debbugs.gnu.org; 25 Aug 2020 11:45:08 +0000 Original-Received: from localhost ([127.0.0.1]:60572 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kAXO0-0004U9-4S for submit@debbugs.gnu.org; Tue, 25 Aug 2020 07:45:08 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:40610) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kAXNy-0004Mw-Mu for 13648@debbugs.gnu.org; Tue, 25 Aug 2020 07:45:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=DN/g0lgf2m0YjiNtO7cN0nDsMB03hQqbF5kVXtwULik=; b=owQ+Jhn7b1FG+LheVw8xRQ9t2G 9IBBT7hftU/Qy7DHRsWFoU4zdDxEI3nprgalQjh1faH6kRvVxcBBO8mIl0B3EDCtyg7HUuhcrfuc9 /lkF0fLM4MNkJDZJHYS8rdkOWio7Et6p+157Tlt1pPDzkki82oU7YKyhDcgZxWHPUm24=; Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kAXNp-00054V-27; Tue, 25 Aug 2020 13:44:59 +0200 X-Now-Playing: Coil's _The Sound Of Musick_: "Sara Dale's Sensual Massage 7" In-Reply-To: (Stefan Monnier's message of "Thu, 07 Feb 2013 11:42:46 -0500") 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:186266 Archived-At: Stefan Monnier writes: >> invocation of remove-overlays is legitimate), the logic of the code is >> that the NAME and VAL arguments are either both nil or both non-nil, > > Indeed. > >> which conflicts with the semantics of the &optional keyword. > > Right. We should document it in the docstring. Does the patch below look OK? >> This means that the last call of remove-overlays in the above sexp >> would clear any after-string overlays, regardless of their value. > > Normally we don't distinguish "an property FOO of value nil" and "no > property FOO". So I think what would make sense is to say that if VAL > is nil, then we remove any overlay whose NAME property is non-nil > (i.e. the exact inverse from what we currently do). > > This said, the reason why I have not implemented this case of NAME being > specified while VAL is left unspecified is because I haven't come up > with a need for it. So I'd be interested to hear the backstory of > why/where you need it. The case here is (remove-overlay beg end 'foo), which will remove all overlays that don't have foo (as well as the ones that have foo, but it's set to nil)? diff --git a/lisp/subr.el b/lisp/subr.el index a58a873a33..bd50c52552 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3073,7 +3073,10 @@ copy-overlay (defun remove-overlays (&optional beg end name val) "Clear BEG and END of overlays whose property NAME has value VAL. Overlays might be moved and/or split. -BEG and END default respectively to the beginning and end of buffer." + +BEG and END default respectively to the beginning and end of buffer. +Values are compared with `eq'. +If either NAME or VAL are specified, both should be specified." ;; This speeds up the loops over overlays. (unless beg (setq beg (point-min))) (unless end (setq end (point-max))) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no