shell - 使用预定义的 lisp 代码从 shell 启动 emacs

标签 shell emacs lisp

可以从 shell 启动 emacs 并告诉它执行一个 lisp 函数,例如

emacs -f some-lisp-function my_file.py

但是,我也想传递带有参数的 lisp 函数,比如

emacs -f "(goto-line 10)" my_file.py
# --> not working

在最好的情况下,还传递由多个函数调用组成的更复杂的 lisp 代码,例如

emacs -f "(goto-line 10) (some-other-func some-arg)" my_file.py
# --> not working

有人知道怎么做吗?

编辑:为了阐明这一点,我需要一种方法来评估文件自身缓冲区中的 lisp 代码,打开它之后。

(顺便说一句。我知道可以在不使用 -f 的情况下以不同的方式解决 goto-line 问题,但这只是我的一般问题的一个例子)

最佳答案

试试 emacs my_file.py --eval '(progn (goto-line 10) (some-other-func some-arg))'。另请注意,将 Emacs 调用为 emacs +10 my_file.py 将在第十行打开文件。

关于shell - 使用预定义的 lisp 代码从 shell 启动 emacs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18033190/

相关文章:

list - 喜欢 first 和 rest 而不是 car 和 cdr 的 lisp 如何接近像 cdaddr 这样的组合?

file-io - 在 Common Lisp 中读取文件返回空字符

MYSQL:无法删除或更新父行:外键约束失败SHELL

emacs - 独立于平台的路径(在 LaTex 和 Elisp 中)?

emacs - 用于跟踪缓冲区中更改的次要模式

emacs - 矩形选择视觉故障

haskell - Lisp 有类似 Haskell 的 takeWhile 函数吗?

linux - 如何在 echo 中使用双 $

asp.net - asp.net中的命令提示符和asp中的执行文件

linux - 在读取命令时保留带空格的字符串