How to convert list to string in Emacs Lisp

前端 未结 4 605
悲&欢浪女
悲&欢浪女 2021-02-01 02:52

How can I convert a list to string so I can call insert or message with it? I need to display c-offsets-alist but I got Wrong type a

4条回答
  •  春和景丽
    2021-02-01 03:40

    (format) will embed parentheses in the string, e.g.:

    ELISP> (format "%s" '("foo" "bar"))
    "(foo bar)"
    

    Thus if you need an analogue to Ruby/JavaScript-like join(), there is (mapconcat):

    ELISP> (mapconcat 'identity '("foo" "bar") " ")
    "foo bar"
    

提交回复
热议问题