Permalink
Browse files

Handle nils silently when converting a tree to text.

  • Loading branch information...
1 parent 17d0da6 commit 50e3aa363192d585dffd55c198bcf6189d3d2353 @aemoncannon committed Apr 23, 2009
Showing with 10 additions and 11 deletions.
  1. +10 −11 flyparse-mode.el
View
@@ -1064,17 +1064,16 @@
(defun flyparse-tree-as-text (tree)
"Naively destructure a flyparse tree to text representation."
- (if (not (null tree))
- (if (flyparse-leaf-p tree)
- (flyparse-tree-type tree)
- (let ((result ""))
- (flyparse-each-subtree
- (tree subtree nil offset)
- (let ((space-width (max 0 (- (+ offset (flyparse-tree-beg-offset subtree)) offset 1))))
- (setf result (concat result (make-string space-width (string-to-char " "))))
- (setf result (concat result (flyparse-tree-as-text subtree)))))
- result))
- (error '"Tried to convert null tree to text")))
+ (if (null tree) ""
+ (if (flyparse-leaf-p tree)
+ (flyparse-tree-type tree)
+ (let ((result ""))
+ (flyparse-each-subtree
+ (tree subtree nil offset)
+ (let ((space-width (max 0 (- (+ offset (flyparse-tree-beg-offset subtree)) offset 1))))
+ (setf result (concat result (make-string space-width (string-to-char " "))))
+ (setf result (concat result (flyparse-tree-as-text subtree)))))
+ result))))
(defun flyparse-absolute-tree-copy (tree base-buffer-offset)

0 comments on commit 50e3aa3

Please sign in to comment.