From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Thomas F. K. Jorna" Newsgroups: gmane.emacs.help Subject: Displaying an overlay image across the margins and body Date: Tue, 6 Jul 2021 09:36:58 +0200 Message-ID: <746412c1-037a-a724-ceb1-943092b8b708@tefkah.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14864"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jul 06 09:37:40 2021 Return-path: Envelope-to: geh-help-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 1m0feF-0003eN-LY for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 06 Jul 2021 09:37:39 +0200 Original-Received: from localhost ([::1]:48538 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m0feD-00049b-4m for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 06 Jul 2021 03:37:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42420) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0fdn-00049R-M4 for help-gnu-emacs@gnu.org; Tue, 06 Jul 2021 03:37:11 -0400 Original-Received: from pmg01-out1.zxcs.nl ([185.104.30.240]:39355) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0fdj-00075D-KV for help-gnu-emacs@gnu.org; Tue, 06 Jul 2021 03:37:11 -0400 Original-Received: from pmg01.zxcs.nl (localhost.localdomain [127.0.0.1]) by pmg01.zxcs.nl (ZXCS) with ESMTP id 6A0A610565C for ; Tue, 6 Jul 2021 09:37:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tefkah.com; s=x; h=Content-Type:MIME-Version:Date:Message-ID:Subject:From:To:Sender: Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Nz6eZ+4MA8dNgy7IFdEu6fdB2TZsYvKL11jdI72kbB4=; b=cLGvlmPZaP3Etec1Ta6/x/ZPvA Og4Ct36YodC5mWz3KkAsnZPSOBcnFqyqKCZ1FwgdMkqn16pnBW4VW00JKWSuYXbQYL242latzrbsA +mwTEf4gf0+TiMQknj0IHP0D9DYB7+mFFYF0MxMgBj+gDoo/zhjvxfQ+6VK2JqqGLPBv353EmtXVz UhyAqWdtYSOMmkuyT4zECreBOzhDsuri/XXb/WA9JAugncUUKIKrpJfGZRdeVhrxSyP+Zx8HvS0lb UfkZkpL9SzGbXToh1JHzxwjDX3zspdXnhs+oOQPKwUPav8P21p+DzzW/ee1LFojedCezwc5G0QKbM EFFBUY3A==; Content-Language: en-US X-Forwarded-For: help-gnu-emacs@gnu.org X-AuthUser: hello@tefkah.com Received-SPF: pass client-ip=185.104.30.240; envelope-from=hello@tefkah.com; helo=pmg01-out1.zxcs.nl X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_REMOTE_IMAGE=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:131544 Archived-At: Hi! I want to create an overlay (or, to avoid X-Y problems, a multicolored, multilayered, visually distinct line at an arbitrary position that cannot be removed, like a page-break) that spans the entire "page", by which I mean the margins and buffer width, of zero width, and insertable anywhere. I've created a sample function which does that (be sure to |(require 'svg)| if you want to test it) |(defun insert-svg-overlay () (interactive) (let* ((margin-pixel-width (* (frame-char-width) (car (window-margins)))) (svg (svg-create margin-pixel-width 50)) (svg2 (svg-create (window-body-width nil t) 50)) (ov (make-overlay (point) (point)))) (svg-rectangle svg 0 0 margin-pixel-width 50 :fill-color "red") (svg-rectangle svg2 0 0 (window-body-width nil t) 50 :fill-color "yellow") (overlay-put ov 'before-string (concat (propertize "x" 'display (svg-image svg2)) (propertize "x" 'display (list (list 'margin 'right-margin) (svg-image svg))) (propertize "x" 'display (list (list 'margin 'left-margin) (svg-image svg))))))) | which, if you have margins set, will insert an (ugly-looking) overlay like so red-yellow line inserted in the middle of some code . This does exactly what I want at the start of an "actual" line. However, I would like it to do the same thing at the start of a /visual / line. However, doing so yields (inserting before |(svg-image svg)|) same line, now with the yellow line offset from the rest How do I "prevent" some of the overlay from going places it shouldn't? I have tried so many different combinations of |before-string|, |after-string| and plain inserting images, to no avail. There are two things that do work, but are undesirable in their own right. 1. Make the middle rectangle 1 pixel shorter, by changing |svg2| to |(svg2 (svg-create (1- (window-body-width nil t) 50))| same line, now correct but with a 1 pixel gap between the middle yellow chunk and the right red chunk Undesirable for obvious reasons. 2. Make the overlay occupy non-zero space. This allows you to change the region occupied by the overlay to the image/whatever, which somehow /does/ work. Undesirable because this would remove the character(s) we want to have. I feel like there is some combination of |before-string|s and |after-string|s and svg-order that will accomplish what I want, but I have had very little luck so far. Somehow parts of the overlay get pushed to the next line, but why? I'm relatively sure it has something to do with visual-line-mode, is there some way to "prevent" it from word-wrapping specific strings? I am using svg's/overlays because I want to be able to draw in them/display multiple lines. This way of displaying in the margins comes from |put-image|. Thank you very much for your help! Thomas F. K. Jorna PS. This is a copy of https://emacs.stackexchange.com/questions/66457/why-cant-i-create-a-full-width-overlay-and-display-in-the-margins-at-the-same-t