From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id wPROFfol22CTMQEAgWs5BA (envelope-from ) for ; Tue, 29 Jun 2021 15:54:02 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id +IkcEfol22DwVwAAB5/wlQ (envelope-from ) for ; Tue, 29 Jun 2021 13:54:02 +0000 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 28C061F8B8 for ; Tue, 29 Jun 2021 15:54:01 +0200 (CEST) Received: from localhost ([::1]:49680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyEBb-0008Hd-RA for larch@yhetil.org; Tue, 29 Jun 2021 09:53:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44314) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyEB7-0008Ej-Ma for emacs-orgmode@gnu.org; Tue, 29 Jun 2021 09:53:29 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:36532) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyEB3-00046Q-LZ for emacs-orgmode@gnu.org; Tue, 29 Jun 2021 09:53:29 -0400 Received: by mail-wr1-x42c.google.com with SMTP id v5so267582wrt.3 for ; Tue, 29 Jun 2021 06:53:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=andrew-cmu-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vx7u2yiQ+fY+UC1QViJL1xV9kyxDhy3VObt8LqCkrEw=; b=Kcqo/ORf/rkIojgCqK5QyBv21dcn95YSu0/9+HjbIu0GN5roBN3Mr8A8vfeNHnKgJA inxEnqixCAuTXwDXdwgwdSRB0e+aDlA2VO4X6nHoyuMmJXHA9lTJ3necLeFajoT+JWFG hDPDJa9CPNaXfQ0HyBlRi8IvpJE8srGOyl7FmqbpB6oIT6CQ5C7w6XRu+CLPvJVFM8dC z0xOBuFPp8OjfKRiwbBidBmQOMXoGGjZKZ77ROVt7G7c+UjZAeKg8tKgi+P7UjvNq43i 18lfu/lIdcImR9sVQD34kQ9W4fZBZYBeanwa/PhAKcHOe7b9LgqXyWhErumKghCMokND La2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vx7u2yiQ+fY+UC1QViJL1xV9kyxDhy3VObt8LqCkrEw=; b=rt8eVuoC1vXC3isFFZ6OQ39A6wQjS3y/YcXTvvC0VyuDlqCcmM7mPZF2o2EK+HpCEP gp7TaizXmNSt4CjPCsbeQYfmGZ7fJeTcu1S+NrFv8Bjo63/W3NBjMdOZ+RRgDdIQ3v23 semjxmxQvlhcob0w0tEgGK+He2hgyg6AG6IdAkopKM8UUc21P21uShPaCSSnPC8Tcu+Q dTWiUv38/MmHcIl3F6wXSAnY376/p3K4XOtXJ4pozAhAcdwuFXnXg5VZpoWfZONVSCIy Y/2t5Szv8RaEUcDQbhhw/Wwf9Hp7UFKfxamHccbfk9yCR9UobOKBrx3UWR7fb/7avnam 0/Jw== X-Gm-Message-State: AOAM532AhmTsaRUPp2iH0kd4KTxvkYbM7NJGqzs5i1sP9ABbqlilmslz gE3wQQAFHrSPt2sVGHt5qLYRNp3w2ydKAKOYV30= X-Google-Smtp-Source: ABdhPJzS94LkhMh4/aiYYGXsUSlgMdeOlm+tix9gJrDtQJniygO6y3Dg6CjN7YfyTfoB1KIVHfYYY1y9h5VsHXGqJ40= X-Received: by 2002:a5d:5302:: with SMTP id e2mr33853555wrv.75.1624974802994; Tue, 29 Jun 2021 06:53:22 -0700 (PDT) MIME-Version: 1.0 References: <87v95wq5e9.fsf@gmail.com> <87bl7okd53.fsf@posteo.net> In-Reply-To: <87bl7okd53.fsf@posteo.net> From: John Kitchin Date: Tue, 29 Jun 2021 09:53:12 -0400 Message-ID: Subject: Re: Virtually prefix headlines according to content To: =?UTF-8?Q?Juan_Manuel_Mac=C3=ADas?= Content-Type: multipart/alternative; boundary="000000000000e6cb7805c5e7ede3" Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=johnrkitchin@gmail.com; helo=mail-wr1-x42c.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: orgmode , Rodrigo Morales Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1624974841; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=vx7u2yiQ+fY+UC1QViJL1xV9kyxDhy3VObt8LqCkrEw=; b=h2MTgp8i6swdbWmeFY8u2ZBhZ3slF1r8BwUynaHBAbzO12NJvV2sXaVmVUm3ufE8g4/mEF +qv8RetwznH8x3i4i/S8dGFWxO6gYxz4W+aFWrVoquGzWReLorK434h1cDfjksDzKAFboV LncNDXuhK98R8u0J3GScvE+nqsD7sDXM6pA/SK6q1EaF9lHPLHIjN/HSu2bayyq++r1Ke+ 7y1RDqN2ad0tC2YL/qc4I7pIkKMr73ITP+EU4jALGATAEAA0Y45SwfhaEY9SplUiHGDPFF W5xy01FXbcmD2TPoN2sRIGViRTPIgIE7mzRzyvhwZQymM9S6wW8SC9AVIFJ6Rw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624974841; a=rsa-sha256; cv=none; b=nqzrJ+PGF8Fj+mOkkoNrPAatJuj+wypVFlrwMpOUGTpi7wwnQEH8DxHWqG6wFZiwODhW7v T81pBgzuEkEhRz16WACtwZWA51+jdDnSjG167RUTcBsYUu2WaJEn3puPj7o7AIUAEOw9tq ujVbQ3RzjRE7JoyedQpEqVjV6drY9tQ1UenB8RraPbp0GBa+2Pegt/Du0x7t9na2XXf1at 1xLNDnh6ludn2NXSCFClyrGUiqS9tAVmoy9RYk4H8O7TtWC8Al1+ESR0sz59TSz5w+dCmx imy5UVOFOGHr3zj5/xuFYwskXx6O/eOiWQpRI7zuF2gFH2EojlgshG9ioN8GcQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=andrew-cmu-edu.20150623.gappssmtp.com header.s=20150623 header.b="Kcqo/ORf"; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.32 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=andrew-cmu-edu.20150623.gappssmtp.com header.s=20150623 header.b="Kcqo/ORf"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=andrew.cmu.edu (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 28C061F8B8 X-Spam-Score: -1.32 X-Migadu-Scanner: scn0.migadu.com X-TUID: OGnRbuFgcANr --000000000000e6cb7805c5e7ede3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable you could use this alternative to just change the display without adding the tag: (org-map-entries (lambda () (looking-at org-heading-regexp) (put-text-property (match-beginning 2) (match-end 2) 'display (concat "GH " (match-string 2)))) "+GITHUB=3D{.+}") There might be some clever way to tie that onto fontlock, or some kind of hook to make it also work for entries as you create them. John ----------------------------------- Professor John Kitchin (he/him/his) Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu On Tue, Jun 29, 2021 at 9:35 AM Juan Manuel Mac=C3=ADas wrote: > Rodrigo Morales writes: > > > What I would like to know is whether it is possible to format a headlin= e > > by taking into consideration the properties it has. For example, in thi= s > > specific scenario, I would like to make all headlines that have a > > "GITHUB" to show "GH" before the actual headline (the content would loo= k > > like this). > > You can define a function with `org-map-entries' that adds (for example) = a > tag :github: to all headers with the property GITHUB: > > #+begin_src emacs-lisp > (defun add-github-tag () > (interactive) > (org-map-entries (lambda () > (save-restriction > (save-excursion > (org-narrow-to-subtree) > (goto-char (point-min)) > (end-of-line) > (insert " :github:")))) > "+GITHUB=3D{.+}")) > > (add-hook 'org-mode-hook #'add-github-tag) > #+end_src > > Best regards, > > Juan Manuel > > > --000000000000e6cb7805c5e7ede3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
you could use this alternative to just change the display = without adding the tag:

(org-map-entries (lambda ()
= =C2=A0 (looking-at org-heading-regexp)
=C2=A0 (put-text-property (m= atch-beginning 2) (match-end 2) 'display (concat "GH " (match= -string 2))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0"+GITHUB=3D{.+}")

There might be s= ome clever way to tie that onto fontlock, or some kind of hook to make it a= lso work for entries as you create them.
John

--------------------------------= ---
Professor John Kitchin (he/him/his)
Doherty Hall A207F
Departm= ent of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA= 15213
412-268-7803


On Tue, Jun 29,= 2021 at 9:35 AM Juan Manuel Mac=C3=ADas <maciaschain@posteo.net> wrote:
Rodrigo Morales writes:

> What I would like to know is whether it is possible to format a headli= ne
> by taking into consideration the properties it has. For example, in th= is
> specific scenario, I would like to make all headlines that have a
> "GITHUB" to show "GH" before the actual headline (= the content would look
> like this).

You can define a function with `org-map-entries' that adds (for example= ) a
tag :github: to all headers with the property GITHUB:

#+begin_src emacs-lisp
=C2=A0 (defun add-github-tag ()
=C2=A0 =C2=A0 (interactive)
=C2=A0 =C2=A0 (org-map-entries (lambda ()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(save-restriction
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(save-excursion
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(org-narrow-to-subtree)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(goto-char (point-min))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(end-of-line)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(insert "=C2=A0 :github:"))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0"+GITHUB=3D{.+}"))

(add-hook 'org-mode-hook #'add-github-tag)
#+end_src

Best regards,

Juan Manuel


--000000000000e6cb7805c5e7ede3--