Mac 下 Emacs 指定打开行号的问题

  • 使用 open 命令的 --args 参数,无法重复打开不同的文件。
open -a /usr/local/opt/emacs-mac/Emacs.app --args +10:1 /file_name

这样打开是可以实现跳转到那一行那一个字符的,但是如果再次执行

open -a /usr/local/opt/emacs-mac/Emacs.app --args +10:1 /another_file_name

这样仅仅是切换到 Emacs 窗口,没有跳转到另一个文件,更没有跳到那一行。

  • 不使用 --args 参数,不知道怎么指定行号。
open -a /usr/local/opt/emacs-mac/Emacs.app +12:2 /file

The file +12:2 does not exist

认为是要打开两个文件,把 +12:2 当做文件名了。

打开 M-x server-mode,然后用 emacsclient +10:3 foo.txt

open 不太可能会支持 Emacs 的跳转到行号的功能,Emacs 应该也只有机会处理一次命令行参数。

1 个赞

看来只能用 sever 了