我正在努力学习Emacs Lisp。我想从字符串中删除一些空白。我从以下测试用例开始:
(defun test-fun (str)
(interactive)
(let ((ss str))
(replace-regexp-in-string "[ ]+" "" ss)
(message ss)))
(test-fun "He llo")
然而,在我的Scratch缓冲区中对此进行评估显示,没有删除任何空间。。
这里有一个更正:
(defun test-fun (str)
(let ((ss (replace-regexp-in-string "[ ]+" "" str)))
(message ss)))
interactive
只对交互式命令有用,所以这里不需要它。还注意到评估顺序。