Table of Contents
Here is a list of tools that helps me debugging/maintaining org-trello. This could help users when they have trouble.
1 Repl
Using emacs-lisp's repl ielm:
M-x ielm <RET>
Set the credentials for your account:
(let ((org-trello--user-logged-in "<user>")) (orgtrello-controller-load-keys))
Note: Load in context the credentials from the file `~/.emacs.d/.trello/<user>.el`
Now execute some request to check that the connection is good:
ELISP> (orgtrello-query-http-trello (orgtrello-api-get-me) 'sync) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data (:username "ardumont" :url "https://trello.com/ardumont" :status "disconnected" :full-name "Antoine R. Dumont" :id "aabbccddeeffgghhiijjkk"))
Note: You can have a pretty good idea of org-trello's api by reading the `org-trello-api.el` file. It's trello's api adapter.
Simpler:
(let ((org-trello--user-logged-in "ardumont")) (orgtrello-controller-load-keys) (orgtrello-query-http-trello (orgtrello-api-get-me) 'sync))
(let ((org-trello--user-logged-in "ardumont")) (orgtrello-controller-load-keys) (orgtrello-query-http-trello (orgtrello-api-get-board "board-id") 'sync))
1.1 Improvment on debug
Adapt according to your need, this will help loading the org-trello context:
(let ((org-trello-file-to-debug "/home/tony/board.org") (orgtrello-log-level orgtrello-log-trace)) (with-temp-buffer (insert-file-contents org-trello-file-to-debug) (org-mode) (org-trello-mode) (orgtrello-controller-load-keys) (-> (orgtrello-buffer-board-id) orgtrello-api-get-full-cards (orgtrello-query-http-trello 'sync))))
Note: This made me realize that org-trello could spawn an adapter library `trello-core` or `trello-lib`.
2 Trace
Emacs comes with `trace-fn` function. This can help a lot.
Identify some function you want to trace (display inputs, output), for example:
(trace-function 'orgtrello-data-parse-data) (untrace-function 'orgtrello-data-parse-data)
Note: `orgtrello-data/parse-data` is the central function used to parse the json output of trello. So in case of output doubt, this can be a good starting point.
2.1 trace-functions
It helps a lot and you can add more functions with the following ones.
To trace mutliple ones:
#+begin_src lisp (defun trace-functions (fns) "Trace functions FNS." (mapc 'trace-function fns)) (defun untrace-functions (fns) "Trace functions FNS." (mapc 'untrace-function fns))
With sample:
(trace-functions '(orgtrello-data/parse-data)) (untrace-functions '(orgtrello-data/parse-data))
3 Display the content of the board's global setup
Inside the current org-trello buffer:
M-: (orgtrello-setup-display-current-buffer-setup!)
This will compute and return a list with the important settings.
Something like:
(:users-id-name #s(hash-table size 65 test equal rehash-size 1.5... data ( "user-id0" "orgtrello-user-antoineromaindumont" "user-id2" "orgtrello-user-orgmode" "user-id3" "orgtrello-user-ardumont" "ardumont" "orgtrello-user-me" ...)) :users-name-id #s(hash-table size 65 test equal rehash-size 1.5... data ( "orgtrello-user-antoineromaindumont" "user-id0" "orgtrello-user-orgmode" "user-id3" "orgtrello-user-ardumont" "user-id1" "orgtrello-user-me" "ardumont" ...)) :user-logged-in "ardumont" :org-keyword-trello-list-names ( "TODO" "IN-PROGRESS" "DONE" "PENDING" "DELEGATED" "FAILED" "CANCELLED") :org-keyword-id-name #s(hash-table size 65 test equal rehash-size 1.5... data ( "todo-id" "TODO" "in-progress-id" "IN-PROGRESS" "done-id" "DONE" "pending-id" "PENDING" "delegated-id" "DELEGATED" "failed-id" "FAILED" "cancelled-id" "CANCELLED" ...)))
This can help to see if something is amiss or not.