emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Advice for debugging org-export


From: Alex Bennée
Subject: [O] Advice for debugging org-export
Date: Mon, 14 May 2018 16:09:48 +0100
User-agent: mu4e 1.1.0; emacs 26.1

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 via email to

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