From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: pwr--- via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: Redisplaying text in both display margins? Date: Tue, 19 Jan 2021 19:27:34 +1000 Message-ID: <87a6t546pl.fsf@bydasein.com> Reply-To: "Paul W. Rankin" Mime-Version: 1.0 Content-Type: text/plain; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4465"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.4.14; emacs 27.1 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jan 19 15:57:02 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 1l1sRK-00012B-DO for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 19 Jan 2021 15:57:02 +0100 Original-Received: from localhost ([::1]:53452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1sRJ-0005T3-CT for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 19 Jan 2021 09:57:01 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47126) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1nIz-0001ds-4D for help-gnu-emacs@gnu.org; Tue, 19 Jan 2021 04:28:05 -0500 Original-Received: from sendmail.purelymail.com ([34.202.193.197]:47552) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1nIx-0002dP-5i for help-gnu-emacs@gnu.org; Tue, 19 Jan 2021 04:28:04 -0500 DKIM-Signature: a=rsa-sha256; b=VmW04EFqRTThyyyxiFvlho6mwpBZBPsCDPYbGPvToqNCnMGGJkWJJgymLKHdZFd3gd/Y9wVpOsZM+Dmsz4ONNf6gVCKjf2VT0baTdweJLCYW5648zV0x4foNE1MQJaMJtapYUoxan9w3tdVuV03JZIZwvPEfoGMR/iokrqBPZTZNsmJNkPSd1MSK/2yNhHdOIEj4rPhNBjeu8yTpbQ014O8xihSxImnsm4tiM03/cLUsLhpaoBQZ9wKS10nXs21lAO1iqVA3IsovegzmDYOypxW/4dHgo7uGETKyqhW4tNkmfifhvVUXQqIFNyV/HxRYw2vOx9C6FkzhEVk8ZvcC6A==; s=purelymail1; d=bydasein.com; v=1; bh=AiOk6Mv+neqkXESVDKsxWqsGjiO+ubiGCom7gbgvpMo=; h=Received:From:To; DKIM-Signature: a=rsa-sha256; b=mJgt1tLXoUATNQnT6KSb7hESchcGZCjBLXULheLAYNJQl7gKMCLwkmEyCs0d/XZvL1HnK3XwG/ZqKmkiugYXcmZqTGba6vNy/hqiBLHPfbEJqicfrnCcTBQipnoXdcYFLInHLZ7x5Pu9zl3BbTiDPrQbP6xvOVyDUfLY77dW1laXScZkrs8uhv+1ZGMqrvF1vsWDJ466ws/lEA0tmfY8OQs+SINteftjL/0m+uFlG484u3ry4PnXAyDAFgMIPrUIopxmGVQ9NTZ7jlFLfwA53SJfT2vGFaB2C8JbBybthffjHTGAVWOj/W4FQfoKes9a1p/3+eVFUIH6ECrdCyZ4aw==; s=purelymail1; d=purelymail.com; v=1; bh=AiOk6Mv+neqkXESVDKsxWqsGjiO+ubiGCom7gbgvpMo=; h=Feedback-ID:Received:From:To; Feedback-ID: 791:353:null:purelymail X-Pm-Original-To: help-gnu-emacs@gnu.org Original-Received: by ip-172-30-0-124.ec2.internal (JAMES SMTP Server ) with ESMTPA ID 406100612 for ; Tue, 19 Jan 2021 09:27:42 +0000 (UTC) Received-SPF: pass client-ip=34.202.193.197; envelope-from=pwr@bydasein.com; helo=sendmail.purelymail.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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 19 Jan 2021 09:55:57 -0500 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:127301 Archived-At: Hello, I would like to use font-lock and display text properties to redisplay a regular expression group for a heading number in both display margins. n.b. "Margins" here may be ambiguous; I refer to the display margins (info "(elisp) Display Margins") and not the text margins (info "(elisp) Margins"). My intent is to redisplay the string marked here: HEADING. FOOBAR #5-A# ^^^^^^^^ as: 5-A HEADING. FOOBAR 5-A So far clarity, in this particular major mode, a heading may end with an arbitrary string between two '#' characters (e.g. "5-A"). This string should be redisplayed in the display margins (without the '#' characters). At the moment I'm happily redisplaying the heading number in the right margin with the following code (where group 7 is the preceding space, group 8 is the first '#', group 9 is the string to redisplay, and gropu 10 is the second '#'): (put-text-property (match-beginning 7) (match-end 10) 'display (list '(margin right-margin) (match-string-no-properties 9))) There are a couple of things I can't figure out: 1. How to put multiple display text properties on the same text, so that it may redisplay group 9 in both margins. 2. When redisplaying a string in the left margin, how to right-align it, ideally padded with a couple of spaces away from the body text. I have read over (info "(elisp) Display Property") a few times, but haven't been able to quite grok it for this specific problem. Any help would be much appreciated. Thank you in advance, -- Paul W. Rankin https://bydasein.com The single best thing you can do for the world is to delete your social media accounts.