                         (if (> length max) (setq max length))))
                 max)))
 
-(defun write-view (children indent)
+(defun write-view (children key-indent tree-indent)
     (loop for json across children do
     (let (
         (meta (eq t (cdr (assoc 'meta json))))

                            ;;'invisible t
			                    'link-key link-key
			                    'target-key target-key)))
                    (write-view children (+ indent 4))))))


;; VIEWS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

                    ;;(tinkernotes-mode)
                    (erase-buffer)
                    (let ((view-json (json-read-from-string view)))
                        (write-view (cdr (assoc 'children view-json)) (longest-key view-json) 0))
                    (beginning-of-buffer)
                    (setq visible-cursor t)
                    ;; Try to move to the corresponding line in the previous view.
