branch: elpa/treepy
commit de1a2ddc3fd7152d0bfbd9e14312ff8a4864ab2b
Merge: 3ac940e97f 91829c83c1
Author: Daniel Barreto <[email protected]>
Commit: GitHub <[email protected]>
Merge pull request #10 from tarsiiformes/unquote
---
.dir-locals.el | 2 ++
test/treepy.el-walker-test.el | 32 ++++++++++-----------------
test/treepy.el-zipper-test.el | 48 ++++++++++++++++------------------------
treepy.el | 51 ++++++++++++++++++-------------------------
4 files changed, 53 insertions(+), 80 deletions(-)
diff --git a/.dir-locals.el b/.dir-locals.el
new file mode 100644
index 0000000000..3a491ef96b
--- /dev/null
+++ b/.dir-locals.el
@@ -0,0 +1,2 @@
+((emacs-lisp-mode
+ (indent-tabs-mode . nil)))
diff --git a/test/treepy.el-walker-test.el b/test/treepy.el-walker-test.el
index 839e71aeee..91e2f9e559 100644
--- a/test/treepy.el-walker-test.el
+++ b/test/treepy.el-walker-test.el
@@ -1,38 +1,29 @@
-;;; treepy-walker-tests.el --- Generic tree traversal tools -*-
lexical-binding: t -*-
-;;
-;; Filename: treepy.el-walker-test.el
-;;
-;; Description: Generic Tree Traversal Tools
+;;; treepy-walker-tests.el --- Generic tree traversal tools -*-
lexical-binding: t -*-
+
;; Author: Daniel Barreto <[email protected]>
;; Created: Mon Jul 10 15:17:36 2017 (+0200)
;; Version: 0.1.1
;; Package-Requires: ((emacs "25.1"))
;; URL: https://github.com/volrath/treepy.el
-;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
-;;; Commentary:
-;;
-;; Generic tools for recursive and iterative tree traversal based on
-;; clojure.walk and clojure.zip respectively.
-;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
+
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
-;;
+;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
-;;
+;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
-;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
+
+;;; Commentary:
+
+;; Generic tools for recursive and iterative tree traversal based on
+;; clojure.walk and clojure.zip respectively.
+
;;; Code:
(require 'ert)
@@ -137,5 +128,4 @@
'(:b (1 2 3 :c :b) ((:b . :c) (:c . :b))))))
(provide 'treepy-walker-tests)
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; treepy-walker-tests.el ends here
diff --git a/test/treepy.el-zipper-test.el b/test/treepy.el-zipper-test.el
index 6a7c54f31c..13e01ec881 100644
--- a/test/treepy.el-zipper-test.el
+++ b/test/treepy.el-zipper-test.el
@@ -1,38 +1,29 @@
;;; treepy-zipper-tests.el --- Generic tree traversal tools -*-
lexical-binding: t -*-
-;;
-;; Filename: treepy.el-zipper-test.el
-;;
-;; Description: Generic Tree Traversal Tools
+
;; Author: Daniel Barreto <[email protected]>
;; Created: Mon Jul 10 15:17:36 2017 (+0200)
;; Version: 0.1.1
;; Package-Requires: ((emacs "25"))
;; URL: https://github.com/volrath/treepy.el
-;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
-;;; Commentary:
-;;
-;; Generic tools for recursive and iterative tree traversal based on
-;; clojure.walk and clojure.zip respectively.
-;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
+
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
-;;
+;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
-;;
+;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
-;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
+
+;;; Commentary:
+
+;; Generic tools for recursive and iterative tree traversal based on
+;; clojure.walk and clojure.zip respectively.
+
;;; Code:
(require 'ert)
@@ -361,21 +352,21 @@ be (defn new-&node-type> [field-map])."
(defun custom-children (node)
(cl-case (node-type node)
- (':root (map-elt node ':children))
- (':compare-criteria (list (map-elt node ':left) (map-elt node ':right)))
- (':concat (map-elt node ':args))
- (':value (list (map-elt node ':val)))))
+ (:root (map-elt node ':children))
+ (:compare-criteria (list (map-elt node ':left) (map-elt node ':right)))
+ (:concat (map-elt node ':args))
+ (:value (list (map-elt node ':val)))))
(defun custom-make-node (node children)
(let* ((type (node-type node))
(constructor (intern (concat "new-" (substring (symbol-name type) 1
nil)))))
(funcall constructor
(cl-case type
- (':root `((:children . ,children)))
- (':compare-criteria `((:left . ,(car children))
- (:right . ,(cadr children))))
- (':concat `((:args . ,children)))
- (':value `((:val . ,(car children))))))))
+ (:root `((:children . ,children)))
+ (:compare-criteria `((:left . ,(car children))
+ (:right . ,(cadr children))))
+ (:concat `((:args . ,children)))
+ (:value `((:val . ,(car children))))))))
(setq custom-zipper (treepy-zipper #'custom-branch-p #'custom-children
#'custom-make-node custom-tree))
@@ -524,5 +515,4 @@ NODE is an AST node. CHILDREN is a list of AST nodes."
(provide 'treepy-zipper-tests)
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; treepy-zipper-tests.el ends here
diff --git a/treepy.el b/treepy.el
index 838d05addf..5f8b431d50 100644
--- a/treepy.el
+++ b/treepy.el
@@ -1,43 +1,34 @@
-;;; treepy.el --- Generic tree traversal tools -*- lexical-binding:
t -*-
-;;
-;; Filename: treepy.el
-;;
+;;; treepy.el --- Generic tree traversal tools -*- lexical-binding: t -*-
+
;; Copyright (C) 2017 Daniel Barreto
-;;
-;; Description: Generic Tree Traversing Tools
+
;; Author: Daniel Barreto <[email protected]>
;; Keywords: lisp, maint, tools
;; Created: Mon Jul 10 15:17:36 2017 (+0200)
;; Version: 0.1.1
;; Package-Requires: ((emacs "25.1"))
;; URL: https://github.com/volrath/treepy.el
-;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
-;;; Commentary:
-;;
-;; Generic tools for recursive and iterative tree traversal based on
-;; clojure.walk and clojure.zip respectively. Depends on `map', a map
-;; manipulation library built in Emacs 25.1. All functions are prefixed
-;; with "treepy-"
-;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
+
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
-;;
+;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
-;;
+;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
-;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
+
+;;; Commentary:
+
+;; Generic tools for recursive and iterative tree traversal based on
+;; clojure.walk and clojure.zip respectively. Depends on `map', a map
+;; manipulation library built in Emacs 25.1. All functions are prefixed
+;; with "treepy-".
+
;;; Code:
(require 'map)
@@ -157,9 +148,9 @@ Execute BODY in this context."
(declare (indent defun))
(let ((lex-ctx (mapcar (lambda (v)
(cl-case v
- ('node `(node (treepy-node ,loc)))
- ('context `(context (treepy--context ,loc)))
- (t `(,v (treepy--context ,loc (quote
,(intern (concat ":" (symbol-name v)))))))))
+ (node `(node (treepy-node ,loc)))
+ (context `(context (treepy--context ,loc)))
+ (t `(,v (treepy--context ,loc (quote
,(intern (concat ":" (symbol-name v)))))))))
vars)))
`(let* (,@lex-ctx) ,@body)))
@@ -440,8 +431,8 @@ When reaching the end, returns a distinguished loc
detectable via
Use ORDER if given. Possible values for ORDER are `:preorder' and
`:postorder', defaults to the former."
(cl-case (or order ':preorder)
- (':preorder (treepy--preorder-next loc))
- (':postorder (treepy--postorder-next loc))
+ (:preorder (treepy--preorder-next loc))
+ (:postorder (treepy--postorder-next loc))
(t (error "Unrecognized order"))))
(defun treepy--preorder-prev (loc)
@@ -471,8 +462,8 @@ If already at the root, returns nil."
Use ORDER if given. Possible values for ORDER are `:preorder' and
`:postorder',
defaults to the former."
(cl-case (or order ':preorder)
- (':preorder (treepy--preorder-prev loc))
- (':postorder (treepy--postorder-prev loc))
+ (:preorder (treepy--preorder-prev loc))
+ (:postorder (treepy--postorder-prev loc))
(t (error "Unrecognized order"))))
(defun treepy-end-p (loc)