From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id ANUPAm/H82OqAgEAbAwnHQ (envelope-from ) for ; Mon, 20 Feb 2023 20:18:07 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id mMPyAW/H82PDbAEAauVa8A (envelope-from ) for ; Mon, 20 Feb 2023 20:18:07 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id BD30EDBC5 for ; Mon, 20 Feb 2023 20:18:06 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pUBfG-0004TC-LH; Mon, 20 Feb 2023 14:17:30 -0500 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 1pUBfC-0004R9-9x for emacs-orgmode@gnu.org; Mon, 20 Feb 2023 14:17:29 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pUBfA-0003Qo-OJ for emacs-orgmode@gnu.org; Mon, 20 Feb 2023 14:17:26 -0500 Received: by mail-wr1-x432.google.com with SMTP id v3so2171144wrp.2 for ; Mon, 20 Feb 2023 11:17:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:date:references:in-reply-to:subject:to:from:message-id :from:to:cc:subject:date:message-id:reply-to; bh=e+QjFiqceaX0mqNbbxg5xEPV+OYURXwFmJ7iZLzyafg=; b=T3+JT/yUojhsQNxJPwrtpGoDMzNNDQt11RmnXzyHA8X+KKtTMtfkj3GdgNIXwXQXKZ O1CPQ0Wo41gk6/XtzKdJgTqqWeIQTMvuz9R2Y6iFAQGEqRcBIWl/zJwTt6z0dLSVDyCT fyjFN/ElrIdC0jxqNCgT2zjtJmyx3J7mIERGKLfkQWFecCyp0+ZsUoCDN6oSVVNWumk6 Ey+tiTLo+ZeukGzk3aihrDE4UNVDijBam8ytMfJy6FxujGzza0YWsNYqVE/k3TdnNT/j +XV/j5VNCkudczIwuHhZmLHMj9lTQiwl/pQYOFPSuv25cyb6KOf3uYlFFYLKKTZHUmN/ gndg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:date:references:in-reply-to:subject:to:from:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=e+QjFiqceaX0mqNbbxg5xEPV+OYURXwFmJ7iZLzyafg=; b=tW2w7HsyKGwMTlv+rNyQ9CZKfzUUdJKgGWpAnX5BeUwl6kMNGwbdnqtZ20T+Hk8v2u LBmeLs0GKdMnIuZkve8yYr7ltt5ejI3WyN2q787cndb1+RmcVYJGOoAmGtkeekmR5qDL OOJ3pLrfTGsrCu2w9eHGndSzy/9Ws534n4NBB9fGYc86+7qUegkxJXC4VmqPwdlKoM0P K/2YioqaCD8K4UthXd0Uf+vTrFuqnxq0K+NrRvmMOfzHNQJUsQNAJ80p1UDUpspAd8KP 9nq3HCGVp06B/7JoAxumv5axd67swdvUV/8CeMnQom1i92W3aPhgFDveY32SYCXd2cFQ 0tfw== X-Gm-Message-State: AO0yUKWG5zUEfAg0Ksaeo6b0rfTCnrlrpBHLqXObTaJKPHXs52LZrv3y EJGio/hgAzOgRxwaIbG5RHo= X-Google-Smtp-Source: AK7set+WMCjbMOyelf5icuV1l+BT8e7fDacGaoCp9x6a+RT02GAUP9lmFHW+YyHMZopQZT17V2n7ug== X-Received: by 2002:a05:6000:1152:b0:2c5:5184:abc with SMTP id d18-20020a056000115200b002c551840abcmr2594312wrx.59.1676920642588; Mon, 20 Feb 2023 11:17:22 -0800 (PST) Received: from keynux ([2a01:e0a:505:3460:169:7511:f49a:58eb]) by smtp.gmail.com with ESMTPSA id l11-20020adff48b000000b002c592535839sm2377107wro.17.2023.02.20.11.17.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 11:17:22 -0800 (PST) Message-ID: <63f3c742.df0a0220.58f3d.75fe@mx.google.com> Received: by keynux (sSMTP sendmail emulation); Mon, 20 Feb 2023 20:17:20 +0100 From: Bruno Barbier To: pareto optimal , Emacs Orgmode Subject: Re: RFC on implementation adding buttons beside headings In-Reply-To: <418353827.205931.1676736087884@fidget.co-bxl> References: <1495820062.205861.1676736033884@fidget.co-bxl> <418353827.205931.1676736087884@fidget.co-bxl> Date: Mon, 20 Feb 2023 20:17:20 +0100 MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=brubar.cs@gmail.com; helo=mail-wr1-x432.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, MSGID_FROM_MTA_HEADER=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-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="T3+JT/yU"; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1676920686; a=rsa-sha256; cv=none; b=eqrJKNMY+vGEzz+eyrNMBUazHBC7cnDVyfmol9dYuJEeyKjQ4a4aTRHf+oWIXis5+ImOZE hbxYTvVgxgG0JBWiL0pSs2riPYr6ZkoVDWp0waoH4a70eN6HdOxUst9HEzC+txliVJFwc2 KqzwYl0462FEQs9eiocgk3viSfF/nnvOGaPSfqDKbo9sZW2PVqNnFlFzWeoM2FUeQaje62 uFHXcbpHTO0ntKCuRvfWDpS0wqnjzej7mo8p+coft4hHtYI0tGn8uBD0qJF1bV5hgP0D0Z unaDJWhyIIZ+CJzkwUrWJ8qVmrwPNMbOKMYmny0sCnV8EoRfPLSzlm5sCI0sTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1676920686; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=e+QjFiqceaX0mqNbbxg5xEPV+OYURXwFmJ7iZLzyafg=; b=K0e8a75B6qNl27bt8LiSAZ/v1LYRA2qAywecLX/4QJRRLjZLO3I5R5uBjtOHvQJiBCAWqn KCX+pGBgvvYOPGQeuUpe84KIF4+bgMvgC/n9Dflfc7YLcTK+/oVxc4uovbEPfsA2XanyKJ P4aXAh70BnQUyTsGmigKlE+2FMARYkoz3/u2WuelN4jraQEpsSj+P1sCl3YmA7AUMhxJc9 7ci6n1Zl7sIK48I1RZA7RZ6Pe3cbVdvemzYNZqundDAh07g/TFXsN3Eovd0OSqLD6PneRP ESTzOQyeKtRlKWhdxn8VHIxcHRK13Oh4FhGAAFG+SqAOWBcdD03gzo9Xxp2Yxg== X-Spam-Score: -4.87 X-Migadu-Queue-Id: BD30EDBC5 X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="T3+JT/yU"; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com X-Migadu-Spam-Score: -4.87 X-TUID: RmSLvROPQgsL pareto optimal writes: > I found the only way to place the button where I wanted was to insert > some blank space after the heading. Is that expected and best practice > or is there some other way to do it? FWIW, instead of inserting some blank spaces, you could overlay existing characters, you'll just need to re-inject them at display time so that the display doesn't change. That way, you don't modified the text. Here is a way to add a button, in place, without modifying the buffer. The trick is to overlay the EOL and to re-inject an EOL using the "after-string" property. (with-current-buffer (generate-new-buffer "=test") (cl-flet ((run (f) (lambda (&rest args) (interactive) (funcall f)))) (let (pos) (insert "* My title\n") (setq pos (1- (point))) (insert "An amazing note.\n\n") (insert "** My 2 title\n") (insert "An even more amazing note.\n") (org-mode) (make-button pos (1+ pos) 'before-string "\n\n " 'display '((height 2) "Click me!") 'after-string "\n\n" 'face 'custom-button 'action (run (lambda () (message "Thanks!"))) ))) (pop-to-buffer (current-buffer)) ) Note that the above expression requires lexical-binding. Bruno