eschulte pushed a commit to branch go in repository elpa. commit b61078a2a75cc63b2cb6766d3c612454de1f31e3 Author: Eric Schulte <schulte.e...@gmail.com> Date: Sun May 19 12:11:40 2013 -0600
remove dependencies on org-mode functions --- back-ends/gnugo.el | 2 +- back-ends/sgf2el.el | 4 ++-- go-util.el | 12 ++++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/back-ends/gnugo.el b/back-ends/gnugo.el index 54f41c4..3edb005 100644 --- a/back-ends/gnugo.el +++ b/back-ends/gnugo.el @@ -79,7 +79,7 @@ (defun gnugo-last-output (gnugo) (with-current-buffer (buffer gnugo) (comint-show-output) - (org-babel-clean-text-properties + (go-clean-text-properties (buffer-substring (+ 2 (point)) (- (point-max) 2))))) diff --git a/back-ends/sgf2el.el b/back-ends/sgf2el.el index a4fc122..e8a136b 100644 --- a/back-ends/sgf2el.el +++ b/back-ends/sgf2el.el @@ -46,7 +46,7 @@ (defun sgf2el-read-prop (val) (when (and (stringp val) (not (equal val ""))) - (or (org-babel-number-p val) val))) + (or (go-number-p val) val))) (defun sgf2el-convert-prop-vals (key vals) "Convert a property value to elisp." @@ -62,7 +62,7 @@ (insert str) (goto-char (point-min)) (loop while (re-search-forward re nil t) - collect (org-babel-clean-text-properties + collect (go-clean-text-properties (match-string (or sub-exp 0))))))) (defun sgf2el-region (&optional start end) diff --git a/go-util.el b/go-util.el index 38b5289..448f143 100644 --- a/go-util.el +++ b/go-util.el @@ -107,4 +107,16 @@ (defun sym-cat (&rest syms) (intern (mapconcat #'symbol-name (delq nil syms) "-"))) +(defun go-number-p (string) + "If STRING represents a number return its value." + (if (and (string-match "[0-9]+" string) + (string-match "^-?[0-9]*\\.?[0-9]*$" string) + (= (length (substring string (match-beginning 0) + (match-end 0))) + (length string))) + (string-to-number string))) + +(defun go-clean-text-properties (string) + (set-text-properties 0 (length string) nil string) string) + (provide 'go-util)