emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: emacs-orgmode@gnu.org
Subject: Advice for debugging org-export
Date: Mon, 14 May 2018 16:09:48 +0100	[thread overview]
Message-ID: <871seegtoj.fsf@linaro.org> (raw)


Hi,

I find debugging my exporters for org-mode a real pain. Consider the
following:

#+name: get-task-list-as-exported-text
#+begin_src emacs-lisp :exports code
  (defun my-filter-out-done-lines (s backend info)
    "Filter out lines ending in :done"
    (apply 'concat
           (--remove (s-matches? (rx ":done" (zero-or-more blank) eol) it)
                     (s-slice-at (rx bol "-") s))))

  (defun my-filter-out-old-completed-todos (s backend info)
    "Filter out DONE items if they where completed over a week ago."
    (setq my-debug-items
          (add-to-list 'my-debug-items (list s backend info)))
           s)

  (org-export-define-derived-backend 'my-status-report 'ascii
    :options-alist
    '((:with-todo-keywords nil)
      (:num nil))
    :filters-alist
    '((:filter-plain-list . my-filter-out-done-lines)
      (:filter-headline . my-filter-out-old-completed-todos)))

  ;; Snarf the weeks activities
  (save-excursion
    (goto-char (point-min))
    (when (re-search-forward "* Tasks")
      (goto-char (match-beginning 0))
      (org-export-as 'my-status-report t nil t )))
#+end_src

When I poke around in my-debug-items to work out the correct furtling I
need to do I inevitably lock up Emacs as the pretty printer struggles to
dump the entire org AST in :parent.

Is there anyway of suppressing the :parent and associated data so I can
just concentrate on the data for the actual node I have?

--
Alex Bennée

                 reply	other threads:[~2018-05-14 15:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=871seegtoj.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --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).