Emacs 如何以交互方式读入两个输入并在函数调用中使用它们

Emacs 如何以交互方式读入两个输入并在函数调用中使用它们,emacs,elisp,Emacs,Elisp,我目前正在参加一个学习elisp的课程,所以我没有这门语言的经验。我试图以交互方式读取两个输入(矩形的宽度和长度),然后使用它们调用函数来计算矩形的面积。我的守则如下: (defun rectangle_Area(w l) "Compute the area of a rectangle, given its width and length interactively." (interactive "nWidth: ") (interactive "nLength: ") (setq are

我目前正在参加一个学习elisp的课程,所以我没有这门语言的经验。我试图以交互方式读取两个输入(矩形的宽度和长度),然后使用它们调用函数来计算矩形的面积。我的守则如下:

(defun rectangle_Area(w l)
"Compute the area of a rectangle, given its width and length  interactively."
(interactive "nWidth: ")
(interactive "nLength: ")
(setq area (rectangleArea w l))      
(message "The rectangle's area is %f." area))
目前我得到了一个错误数量的参数错误。 就像我说的,我以前没有经验。。。我真正需要知道的是如何使用interactive存储/读取两个单独的值

谢谢您的帮助

C-hf
interactive
RET:

要获取多个参数,请连接各个字符串, 用换行符分隔它们

因此,我们:

(defun rectangle_Area(w l)
    "Compute the area of a rectangle, given its width and length  interactively."
    (interactive "nWidth: \nnLength: ")
    (setq area (rectangleArea w l))      
    (message "The rectangle's area is %f." area))

我以前试过,但没有成功,但我想这是因为我有一个额外的角色。它确实起作用了,非常感谢!!我很好奇是谁在elisp?Protip中提供了一个类,请避免使用如此相似的函数名(不同之处仅在于
\uu
)。此外,elisp命名约定是使用
连字符分隔的单词
。玩得高兴