相关疑难解决方法(0)

emacs lisp以编程方式使用前缀参数调用函数

我想从一些elisp代码中调用一个函数,就好像我用前缀参数以交互方式调用它一样.具体来说,我想用前缀调用grep.

我最接近它的工作是使用execute-extended-command,但仍然要求我输入我想用前缀调用的命令...

;; calls command with a prefix, but I have to type the command to be called...
(global-set-key (kbd "C-c m g")
                (lambda () (interactive)
                  (execute-extended-command t)))
Run Code Online (Sandbox Code Playgroud)

该文件说,execute-extended-command使用command-execute执行从迷你缓冲区读取命令,但我一直没能使其工作:

;; doesn't call with prefix...
(global-set-key (kbd "C-c m g")
                (lambda () (interactive)
                  (command-execute 'grep t [t] t)))
Run Code Online (Sandbox Code Playgroud)

有没有办法以非交互方式调用带前缀的函数?

emacs elisp

36
推荐指数
2
解决办法
6134
查看次数

标签 统计

elisp ×1

emacs ×1