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: Juan Manuel Macías
Subject: Re: Virtually prefix headlines according to content
Date: Tue, 29 Jun 2021 13:34:48 +0000

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 




reply via email to

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