Emacs Lisp;如何从任何类型的变量中得到一个字符串? [英] Emacs lisp; how to make a string from a variable of any type?

查看:66
本文介绍了Emacs Lisp;如何从任何类型的变量中得到一个字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

显示类似于错误调用函数的错误消息,例如:

Like error messages for wrongly called functions show, eg.:

(message (file-attributes "."))

产生消息:

"eval: Wrong type argument: stringp, ("/home14/tjones" 1 0 0 (20415 35598) (20211 19255) (20211 19255) 14 "lrwxrwxrwx" t ...)"

您如何故意进行这种类型的翻译,例如:

How do you do this type of translation intentionally, eg.:

(message (thing-to-string (file-attributes ".")))

要发送类似消息:

("/home14/tjones" 1 0 0 (20415 35598) (20211 19255) (20211 19255) 14 "lrwxrwxrwx" t ...)

这仅用于调试/信息。我假设消息正在执行某种方式,但这对我们的用户开放吗?

This is for debugging/info only. I'm assuming there's a way as message is doing it, but is this exposed to us users?

推荐答案

查看 prin1到字符串和相关功能( prin1 princ ,等等)。并尝试使用手册! http://www.gnu.org/software/emacs /manual/html_node/elisp/Output-Functions.html

Look into prin1-to-string and related functions (prin1, princ, etc). And do try the manual! http://www.gnu.org/software/emacs/manual/html_node/elisp/Output-Functions.html

这篇关于Emacs Lisp;如何从任何类型的变量中得到一个字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆