elisp - Emacs 口齿不清;如何从任何类型的变量创建一个字符串?

标签 elisp

像错误调用函数的错误消息显示,例如:

(message (file-attributes "."))

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

你如何有意地进行这种类型的翻译,例如:
(message (thing-to-string (file-attributes ".")))

要发送消息,例如:
("/home14/tjones" 1 0 0 (20415 35598) (20211 19255) (20211 19255) 14 "lrwxrwxrwx" t ...)

这仅用于调试/信息。我假设有一种方法可以让消息这样做,但这是否会暴露给我们用户?

最佳答案

调查prin1-to-string和相关函数( prin1princ 等)。并尝试使用手册! http://www.gnu.org/software/emacs/manual/html_node/elisp/Output-Functions.html

关于elisp - Emacs 口齿不清;如何从任何类型的变量创建一个字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10755677/

相关文章:

emacs - 在 diff 模式下自动启用空白模式

elisp - 重命名文件错误?

lisp - Lisp 中的反引号扩展

lisp - elisp:处理错误类型参数异常

emacs - 如何让 emacs 停止加载 viper 模式?

emacs - with-current-buffer 不移动点

emacs - 如何禁用Emacs消息,例如 "You can run the command X with Y"

regex - 组织议程正则表达式搜索类别

方案和 Lisp 最佳实践 : recursion yes for Scheme, Lisp 没有?

debugging - elisp `trace-function` 不产生跟踪