From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Overlay insertion types, markers, etc. Date: Fri, 15 Nov 2019 12:33:08 +0200 Message-ID: <83lfsh2zvf.fsf@gnu.org> References: <20c74b83-6272-44e9-b4ac-829fd4cd0143@default> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="179114"; mail-complaints-to="usenet@blaine.gmane.org" Cc: emacs-devel@gnu.org To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 15 11:33:56 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iVYvL-000kUA-Pn for ged-emacs-devel@m.gmane.org; Fri, 15 Nov 2019 11:33:55 +0100 Original-Received: from localhost ([::1]:37506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iVYvK-0000PB-HT for ged-emacs-devel@m.gmane.org; Fri, 15 Nov 2019 05:33:54 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58799) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iVYup-0000Oj-GN for emacs-devel@gnu.org; Fri, 15 Nov 2019 05:33:24 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:44947) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iVYuo-0001i8-VR; Fri, 15 Nov 2019 05:33:23 -0500 Original-Received: from [176.228.60.248] (port=4353 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iVYun-0006jV-Uu; Fri, 15 Nov 2019 05:33:22 -0500 In-reply-to: <20c74b83-6272-44e9-b4ac-829fd4cd0143@default> (message from Drew Adams on Tue, 12 Nov 2019 00:09:18 +0000 (UTC)) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:242227 Archived-At: > Date: Tue, 12 Nov 2019 00:09:18 +0000 (UTC) > From: Drew Adams > > Why, if you pass markers, isn't the default to use > the insertion types of those markers? Because the markers passed to make-overlay are treated only as representing buffer positions, similarly to other functions, like goto-char. > 2. `make-overlay' seems to be the only way to specify > the insertion types for an overlay. Is that right, > or did I miss something? That's right. > Why isn't there (or is there?) a simple way to > change the "marker insertion types" of an existing > overlay? Because it's easy to do that by hand? > Suppose you want to copy an existing overlay and > then change some things in the copy. You can't > change the insertion types for it, right? > > I guess you need to use `make-overlay', specifying > insertion types, and then explicitly copy everything > else from the first overlay. Is that right? Yes. > 3. Similarly, the default BUFFER for `make-overlay' > is the current buffer, even if you pass markers. > > Third question (similar to the first): > > Why, if you pass markers to `make-overlay', and > you don't pass arg BUFFER, isn't the default to > use the buffer of those markers? Because that just complicates the implementation with no real gain: what to do if the markers point to different buffers, or if their buffers don't exist, or the position information doesn't fit, etc.? > 4. (Repeating) "An overlay uses markers to record > its beginning and end." > > It seems that an overlay "uses markers" but those > aren't the markers you passed to `make-overlay'. > Is that right? Yes. > Can you retrieve the markers that are "used by" > an overlay, i.e., as markers? No. We don't want to give Lisp access to those markers, as that could mean giving to long a rope to Lisp programs to hang themselves. > "This is the only valid way to change the endpoints > of an overlay. Do not try modifying the markers in > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > the overlay by hand, as that fails to update other > vital data structures and can cause some overlays > to be lost." > > That makes me wonder. I don't even see how you > could try to "modify the markers of the overlay" > (with Lisp). I believe that remark is for C programming.