emacs - ELisp:如何在 'else' block 中执行多个表达式?

标签 emacs elisp

如何在 else 中执行多个表达式块 if声明,当使用 ELisp 时?

最佳答案

你不需要progn为此,因为这已经是默认行为:

高频if可再生能源

if is a special form in `C source code'.

(if COND THEN ELSE...)

If COND yields non-nil, do THEN, else do ELSE...
Returns the value of THEN or the value of the last of the ELSE's.
THEN must be one expression, but ELSE... can be zero or more expressions.
If COND yields nil, and there are no ELSE's, the value is nil.



重用 sindikat 的例子:

(if (> 1 2)
    (message "True")
  (message "False")
  (message "I repeat, completely false"))

当然,您会使用 progn如果您希望计算 THEN 中的多个表达式形式。

关于emacs - ELisp:如何在 'else' block 中执行多个表达式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10330731/

相关文章:

emacs - 如何评估 Emacs init.el 文件中的某些内容?

emacs - Elisp:在 Let 中绑定(bind)一个 lambda 并执行它

emacs - 如何在自动配对模式下插入 $$ 并将光标放在它们之间

qt - 在 emacs 中为 Qt 自动完成

c# - emacs:帮我用 flymake 和 csharp 解决这个自动加载排序问题

java - 尝试在 emacs 中安装 malabar-mode,得到 "Cannot open load file, malabar-mode"

emacs - 如何在 Emacs 中以编程方式读取文件的内容?

emacs - 将行号与linum-mode对齐?

emacs - emacs下使用gdb时的缓冲区控制

emacs - 如何在 Emacs 中自定义目录列表?