emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Virtually prefix headlines according to content


From: Samuel Wales
Subject: Re: Virtually prefix headlines according to content
Date: Tue, 29 Jun 2021 13:44:47 -0700

along similar lines one possibility is to stick a symbol into the
stars.  similar code could also indicate that scheduled and deadline.

On 6/29/21, John Kitchin <jkitchin@andrew.cmu.edu> wrote:
> 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={.+}")
>
> 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ías <maciaschain@posteo.net>
> wrote:
>
>> Rodrigo Morales writes:
>>
>> > What I would like to know is whether it is possible to format a
>> > headline
>> > by taking into consideration the properties it has. For example, in
>> > this
>> > 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
>>   (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={.+}"))
>>
>> (add-hook 'org-mode-hook #'add-github-tag)
>> #+end_src
>>
>> Best regards,
>>
>> Juan Manuel
>>
>>
>>
>


-- 
The Kafka Pandemic

Please learn what misopathy is.
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]