Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Secret structure in org-mode?

I'm wondering I if there's any functionality in org-mode that can make me able to operate with secret structure, that is: structure that I can see when I'm editing but that is treated as if it wasn't there when exporting. It's mainly importing when I export to ascii.

Example:

I would like this in the .org file:

* Normal heading
** Secret heading 1
Some text 1
** Secret heading 2
Some text 2
** Secret heading 3
Some text 3

To be exported to this:

Normal heading
--------------
Some text 1
Some text 2
Some text 3

What makes the headings secret can be anything like a tag, a property or something else but the secret headings should be foldable.

Edit:

Found this solution (from here) (I'm using org-mode 7.9.3 f. It doesn't work. Headlines with the :ignoreheading: tag are still displayed:

;; backend aware export preprocess hook
(defun sa-org-export-preprocess-hook ()
  "My backend aware export preprocess hook."
  (save-excursion
    (when (eq org-export-current-backend 'latex)
      ;; ignoreheading tag for bibliographies and appendices
      (let* ((tag "ignoreheading"))
        (org-map-entries (lambda ()
                           (delete-region (point-at-bol) (point-at-eol)))
                         (concat ":" tag ":"))))))

(add-hook 'org-export-preprocess-hook 'sa-org-export-preprocess-hook)
like image 507
MajorBriggs Avatar asked Apr 07 '14 08:04

MajorBriggs


2 Answers

You can use the EXCLUDE_TAGS property and tag certain sections, then export with org-export-exclude-tags. E.g:

#+EXCLUDE_TAGS: noexport

* Public Section

* Secret Section :noexport:

Documentation here.

like image 115
Biffen Avatar answered Sep 24 '22 19:09

Biffen


What you want is addressed here -- and here's the answer (repeated):

  1. Add the following to your .emacs file:

    (require 'ox-extra)
    (ox-extras-activate '(ignore-headlines))
    
  2. Use the ignore tag on headlines you'd like to have ignored (while not ignoring their content)

like image 22
Mark Avatar answered Sep 21 '22 19:09

Mark