fix(emacs): add and use lean-string-join

This commit is contained in:
Soonho Kong 2014-08-14 08:42:52 -07:00
parent ced0ed0eca
commit c19bcad845
3 changed files with 8 additions and 6 deletions

View file

@ -5,7 +5,6 @@
;;
(require 'cl-lib)
(require 'subr-x)
(require 'lean-util)
(require 'lean-debug)
@ -32,7 +31,7 @@
(defun lean-typeinfo-body (typeinfo)
(cl-third typeinfo))
(defun lean-typeinfo-body-str (typeinfo)
(string-join (lean-typeinfo-body typeinfo) "\n"))
(lean-string-join (lean-typeinfo-body typeinfo) "\n"))
;; -- Test
(cl-assert (lean-typeinfo-str-p "-- TYPE|121|2"))
@ -60,7 +59,7 @@
(cl-second overload))
(defun lean-overload-names (overload)
(cl-loop for seq in (cl-third overload)
collect (string-join seq "\n")))
collect (lean-string-join seq "\n")))
(defun lean-overload-str-p (str)
(string-prefix-p "-- OVERLOAD|" str))
(defun lean-overload-str-seq-p (seq)

View file

@ -5,10 +5,9 @@
;;
(require 'cl-lib)
(require 'subr-x)
(require 'lean-variable)
(require 'lean-cmd)
(require 'lean-util)
(require 'lean-cmd)
(require 'lean-server)
(require 'lean-debug)
@ -79,7 +78,7 @@ The return valus has the form of '([symbol-string] [start-pos])"
(when overload-names
(format "\n%s with %s"
(propertize "overloaded" 'face 'font-lock-keyword-face)
(string-join (cdr overload-names) ", "))))
(lean-string-join (cdr overload-names) ", "))))
(output-str (concat type-output-str overload-output-str)))
(message output-str))))

View file

@ -16,6 +16,10 @@
(or (string-prefix-p line str)
(search (concat "\n" line) str)))
(defun lean-string-join (strings &optional separator)
"Join all STRINGS using SEPARATOR."
(mapconcat 'identity strings separator))
(defun lean-grab-line (n)
"Return the contents of line n"
(let* ((cur-line-number (line-number-at-pos))