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: [PATCH] User-defined fringe tooltips (a request for review) Date: Wed, 20 Dec 2023 14:31:41 +0200 Message-ID: <83sf3xgimq.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13752"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Vladimir Kazanov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Dec 20 13:33:03 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 1rFvl0-0003Lq-Oc for ged-emacs-devel@m.gmane-mx.org; Wed, 20 Dec 2023 13:33:02 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rFvkB-0008L4-QR; Wed, 20 Dec 2023 07:32:12 -0500 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 1rFvk6-0008Kj-5Y for emacs-devel@gnu.org; Wed, 20 Dec 2023 07:32:06 -0500 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 1rFvk2-0006nE-9z; Wed, 20 Dec 2023 07:32:05 -0500 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=apb0C0D2m/G7i0XQn6H7xvAV5seS78hRUVVG002XqfM=; b=RpwUUYC6CbTh gAeXjKyk3bgm/kj5Sgd9MOZY/xJmxZ0Y3dYMvKYDt6pLvHBEbIRE5e462FpQtnKZFrkfJb8Pzr2tb YoDJIheGQnSggmt7PqestI1xF2ZlJZ0OWl1TVY5p6aapdyrIDQSskGrP+CB+6x2NV9VKiFcXItMZH Otl265M4zUseMLtHeir7apyUKC8gm20Guwo+NLj7iw6HLm8UnF63wA3tpmJGZ/OOqdo0wxhs5KsRl JR77fUTmPe5mavHmEf3E+fqbxUnSlnvY3Eu01e1EArsZTm2bhk+roCy/Wqy8fNKomCUhG35DJiVWc y7EnUuhpolqBPS6zbZ/79w==; In-Reply-To: (message from Vladimir Kazanov on Tue, 19 Dec 2023 19:38:09 +0000) 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:314020 Archived-At: > From: Vladimir Kazanov > Date: Tue, 19 Dec 2023 19:38:09 +0000 > > Recently I've been looking into implementing a suggestion from > etc/TODO related to fringe indicator tooltips: > > > ** Allow fringe indicators to display a tooltip > > Provide a help-echo property? > > Attached is a quick and dirty proof-of-concept. The patch extends the > display specification with an optional string that would be displayed > through either tooltips or the echo area: > > (overlay-put (make-overlay (point) (point)) > 'before-string (propertize "x" 'display `(left-fringe right-arrow > nil "left fringe test tooltip"))) > > Moving a mouse pointer to the fringe would then display the string in > a tooltip on a relevant line. Thanks. > To make this work I've extended "struct it" and "struct glyphs_row" > with pointers to strings, and added some mouse hover handling in the > "note_mouse_highlight function". Obviously, the code needs more checks > but I want to confirm the approach with emacs-devel@ first. > > Happy to hear comments and suggestions about the path taken! I'm not sure I like to have Lisp_Object members in 'struct glyph_row'. I also don't think I understand why you needed to copy the hel-echo string to the glyph row. The code in note_mouse_highlight examines the buffer text and overlays for text properties whose meaning is to display a help-echo string, so why cannot you do the same to look for a 'display' property of this specific structure, and extract the help-echo directly from there at mouse-highlight time instead of at glyph-generation time?