emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Daniel Clemente <n142857@gmail.com>
To: Carsten Dominik <dominik@science.uva.nl>
Cc: emacs-orgmode@gnu.org
Subject: Re: Export without TODO keywords
Date: Thu, 25 Dec 2008 23:34:48 +0100	[thread overview]
Message-ID: <874p0rhojb.fsf@gmail.com> (raw)
In-Reply-To: <D2B214D9-85AB-4D35-934D-2BDA5A7FE098@uva.nl> (Carsten Dominik's message of "Sat, 6 Dec 2008 08:38:42 +0100")



Hi,


> Carsten Dominik <dominik@science.uva.nl> writes:
>>
>> ....
>>  Then only „log notes“ exporting is not configurable.
>
> True, but this is not really metadata, but notes, which could
> easily be confused with normal plain text.
>
> I think I will stop here adding options for this purpose.
>
> You can try to write a small function which removes these
> as well, and call it from `org-export-preprocess-hook'.
>

  By the way, this is how I finally removed all tracking information under the headlines.
  I included it in my file and had to eval it so that it registers the hook.
  You can use the code as you like.

-- Daniel




(defun org-export-remove-notes-from-all-headings ()
  "Removes all the tracking information of headings, like log notes, keywords, and clocking.
Add this as a hook to `org-export-preprocess-hook'"
  (show-all)
  (org-map-entries 'org-export-remove-notes-from-heading nil nil)
  )

(defun org-export-remove-notes-from-heading ()
  "Removes all the tracking information which is under the current headline, if it contains.
This information includes log notes (see `org-log-done'), CLOSED/SCHEDULED/DEADLINE keywords, CLOCK entries and others."


  (unless (org-at-heading-p) (error "Not on a headline"))

  (beginning-of-line)
  (let* (
	 (level (org-reduced-level (funcall outline-level)))
	; Regexp of lines to delete. If it starts with TAB, it is indented and thus we delete it. If it has spaces, we delete if the number of spaces is equal to the heading level (number of *)
	 (regexp-of-deletable (concat "^\\(\t+\\|" (make-string level ?  ) "\\)"))
	 )

    (forward-line)

    (while (looking-at regexp-of-deletable)
    ;(message (concat "Deleting this text: " (buffer-substring (line-beginning-position) (line-end-position))))
      (kill-line t)
      )

    )
  )

(add-hook 'org-export-preprocess-hook 'org-export-remove-notes-from-all-headings)

      reply	other threads:[~2008-12-25 22:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-01  2:02 Export without TODO keywords Daniel Clemente
2008-12-01 14:02 ` Sebastian Rose
2008-12-03  8:33   ` Carsten Dominik
2008-12-04 22:45     ` Daniel Clemente
2008-12-04 22:48       ` Carsten Dominik
2008-12-05 15:34         ` Daniel Clemente
2008-12-06  7:38           ` Carsten Dominik
2008-12-25 22:34             ` Daniel Clemente [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874p0rhojb.fsf@gmail.com \
    --to=n142857@gmail.com \
    --cc=dominik@science.uva.nl \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).