emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Advice for debugging org-export
@ 2018-05-14 15:09 Alex Bennée
  0 siblings, 0 replies; only message in thread
From: Alex Bennée @ 2018-05-14 15:09 UTC (permalink / raw)
  To: emacs-orgmode


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-05-14 15:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-14 15:09 Advice for debugging org-export Alex Bennée

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).