From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: help understanding overlay behaviour with images Date: Wed, 16 Aug 2023 17:37:04 +0300 Message-ID: <835y5f835b.fsf@gnu.org> References: <87sf8jtgef.fsf@motzkin.cs.unb.ca> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35620"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: David Bremner Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Aug 16 16:37:37 2023 Return-path: Envelope-to: ged-emacs-devel@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 1qWHeT-00092X-65 for ged-emacs-devel@m.gmane-mx.org; Wed, 16 Aug 2023 16:37:37 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWHdt-000139-DL; Wed, 16 Aug 2023 10:37:01 -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 1qWHdr-00011f-KV for emacs-devel@gnu.org; Wed, 16 Aug 2023 10:36:59 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWHdq-0006fm-SG; Wed, 16 Aug 2023 10:36:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=nxGa1E7Y251K1VRk+qpuQc9zbGxjwYrlEXS6wxnejeg=; b=GYfi3iYb9czl naAUxqajTi7ohqA1S2P80E50AB1VXYrIY1TpThahsFZr64pE9K6ZS3FIyWP1m0E64saO8uQmVWLNA 9a6P4YLYKH16kiU/gIsLZYE1n4C9yDBZLJdXjVohZDrKvIVsIhkqZkAABPOwtGumdBz1xXRszV9rO j8IbypYkDkSOurt843/Wad7BJopohrooDUZ7sm+4hU/z/hL1Br3O/LyyiHe9qjh7NjmZfyJmaHYYN L+38O9iPhr0TTzIdCrPd5DX7+GrHML7tFeN7WgbMOn3gaE4x1GJ71krMhptM1M5FMU8YngDLCcndu Wnat1Pg1PJbAEg4mjVgRHw==; In-Reply-To: <87sf8jtgef.fsf@motzkin.cs.unb.ca> (message from David Bremner on Wed, 16 Aug 2023 07:45:12 -0300) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:308824 Archived-At: > From: David Bremner > Date: Wed, 16 Aug 2023 07:45:12 -0300 > > I'm not sure if this is a bug or if I misunderstand something. In the > following code sample I expect the image to be hidden, but it isn't, > unless I also hide the previous character, i.e. pass 10 as the first > argument to make-overlay. In both Emacs 28.2 and 29.1 (tested on > Debian), it gets some weird in between state where the point skips over > the image when running left-char or right-char, but the image stays visible. > > (let ((buf (get-buffer-create "image-buffer")) > (img (find-image '((:type xpm :file "attach.xpm")))) > (overlay nil)) > (switch-to-buffer buf) > (insert "0123456789") > (insert-image img "x") > (insert "0123456789") > (insert "\n") > (setq overlay (make-overlay 11 12)) > (overlay-put overlay 'invisible t) > (message "props=%s" (overlay-properties overlay))) This is expected: a 'display' property (which is how Emacs implements display of images in a buffer) causes Emacs to ignore the text "covered" by the property, in this case the character "x" on which you placed the overlay with the invisible property. So Emacs doesn't see the overlay on "x", and doesn't act upon the invisible property of that overlay. IOW, you have here two display features, each of which needs to skip the same buffer positions, so the first one wins.