出于某种原因,使用交互形式的 emacs 函数在 Mac OS x 上对我不起作用。我正在使用的 emacs 来自emacsformacosx.com,到目前为止它工作得很好。使用交互式(取自此处)的此类函数的示例是:
(defun multiply-by-seven (number) ; Interactive version.
"Multiply NUMBER by seven."
(interactive "p")
(message "The result is %d" (* 7 number)))
Run Code Online (Sandbox Code Playgroud)
我用 Cx Ce 从头开始运行它,但我无法输入数字并获取任何内容。
我有点担心:
我从头开始运行它
C-x C-e
这不会运行该函数,它只是对其进行评估。要调用该函数,您可以评估:
(multiply-by-seven 10)
=> "The result is 70"
Run Code Online (Sandbox Code Playgroud)
与C-x C-e或以交互方式调用它:
M-x multiply-by-seven
=> "The result is 7"
Run Code Online (Sandbox Code Playgroud)
并用参数调用它
C-u M-x multiply-by-seven
=> "The result is 28"
Run Code Online (Sandbox Code Playgroud)
或者
C-u 7 M-x multiply-by-seven
=> "The result is 49"
Run Code Online (Sandbox Code Playgroud)
as(interactive "p")使用数字前缀参数,Emacs 手册
| 归档时间: |
|
| 查看次数: |
304 次 |
| 最近记录: |