From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Vladimir Kazanov Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] User-defined fringe tooltips (a request for review) Date: Tue, 26 Mar 2024 22:16:02 +0000 Message-ID: References: <83sf3xgimq.fsf@gnu.org> <83plyzfoe4.fsf@gnu.org> <83plyxca0t.fsf@gnu.org> <8334vrczig.fsf@gnu.org> <86frwejkxe.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6421"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Mar 26 23:17:05 2024 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 1rpF6P-0001Qn-TX for ged-emacs-devel@m.gmane-mx.org; Tue, 26 Mar 2024 23:17:05 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rpF5j-0001JR-4k; Tue, 26 Mar 2024 18:16:23 -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 1rpF5g-0001J9-5b for emacs-devel@gnu.org; Tue, 26 Mar 2024 18:16:20 -0400 Original-Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rpF5e-0002q8-Hd; Tue, 26 Mar 2024 18:16:19 -0400 Original-Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2d475b6609eso75985041fa.2; Tue, 26 Mar 2024 15:16:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711491374; x=1712096174; darn=gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=gMomGIEp7+4n8dT4Ik7ijEc9pS0YAu2tyZ7sq9Z2gKY=; b=KxPpTdfbdHL9MHwJTkn2Y8KWJqh9K2IvWp1oqBZ149js1hY0UmHyZgv0aT+PJnegaj uFKD9vxt3BulOykrqY8Z7OzrMIHTdvfi49rqdquVmjk989K1pdxUGnuI3jDyaS3gijdc +fyTcyDfEErKzj50tgQ8U5LAe+oKxGVty8EOne9LHGiQeY7H3r331bTWip78KRW5v1kP Ph2ViS3JpaaOkkA7IkjfFAyZc5h+3mYNh3krFiwjA2zvtzratBmMPidVX+MtCEpAMDd+ 7qjMi5GidXp5/LkueT58dEycfnzB7s9A4hjrb8ZHH7olOMmMLNkGnZaxeFVoMLw6Q5y+ M7Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711491374; x=1712096174; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gMomGIEp7+4n8dT4Ik7ijEc9pS0YAu2tyZ7sq9Z2gKY=; b=kgUzyEGWDMMlPITmzEbaNenneKATsuhGWm/fJ49zGThAnVCKj6G+Ay/2orTCQ/FLkM RGTJuQqhg/22/ySiYHoEuC1JYKFzM1GJ09Zam+lLbQznbqs+0TZWgC8NMRkIImWX09lC dG/B9StYeE+6Xgk+hBBDrflm0xHfz7d89ilGsmkfZK7xpa2VEg6VWDwKLVmzqBUajYdL WedipM0wzL2g+irscxv6f0EKLhwV9xuClwQLCzLXOBV72XaPOLBBI9TB0ok7Cywht85g Od4reSpqO71WqjZ5zVNXE8oobx7Lhdvj0NOlJ7HVaF/6pUtGiWx6CzKeDY27iUiTqvxu f9qA== X-Gm-Message-State: AOJu0Yyh6RCRTgT2QLWYGBUDh3+0BboPk5FNG3JX9Ai6ijmj1aA68tom jsWQ5N1XoivFzxU/k56d/JLeXRuTDpomRjn0y6sgUajX82s1Ms/6/W+UueFwT9PJyFvkFMEBKb2 fy+1pxHXwdzlsIX2hl4aRNTnzlQCyTxBJ1KeQ X-Google-Smtp-Source: AGHT+IEGtg3ppGRurBSEP8W2M/8ZxFjxDTMuCpNM2pio0V9nANLHrNTaoEfORSwHSMK64fzLEO5pM4hpTKCzoUCm1BA= X-Received: by 2002:a2e:88d0:0:b0:2d2:206a:2f2a with SMTP id a16-20020a2e88d0000000b002d2206a2f2amr8563567ljk.17.1711491374068; Tue, 26 Mar 2024 15:16:14 -0700 (PDT) In-Reply-To: <86frwejkxe.fsf@gnu.org> Received-SPF: pass client-ip=2a00:1450:4864:20::22d; envelope-from=vekazanov@gmail.com; helo=mail-lj1-x22d.google.com 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:317316 Archived-At: Hey, I just did a deep dive into the code again - looking for a cleaner solution. > The condition is only evaluated at glyph generation time, as for any > other display property. When the tooltip should be displayed, the > condition is not relevant, since if it were false when the glyphs were > generated, you wouldn't have had the fringe bitmap shown in the first > place. > > However, I think there's an easy way of making the implementation > easier: just introduce a new overlay property called, say, > fringe-help-echo, and put that property on the same text as the > display property which produces the fringe. Then the code in > note_fringe_highlight should simply check if the text which yielded > the fringe bitmap also has this special property on it, and if so, > display the tooltip. Maybe an even easier solution would work: 1. Record buffer position of the fringe display spec in struct it. Then move it to glyph_row the same way user_fringe_bitmap_id's are copied over. It is just a ptrdiff so nothing out of place for glyph_rows. 2. In note_fringe_highlight it becomes easy to retrieve the fringe display spec using a single call to get_char_property_and_overlay(), no need to iterate over a line, or have the implementation detail leak into text properties. What I don't really understand is whether I should handle overlays with after-string/before-string properties. Overlays can contain strings propertized with fringe display specs as well. In fact, there is an example showing this trick in the manual (https://www.gnu.org/software/emacs/manual/html_node/elisp/Fringe-Bitmaps.html). Should I just go through all overlays touching the spec position and parse into the after-string/before-string as well? Pardon the many questions, display code has many moving parts. Thank you -- Regards, Vladimir Kazanov