Pas*_*ten 14 emacs arguments function
我想C-u在函数(例如,regexp)中使用,其中调用它C-u具有不同的效果.我怎么能在Emacs中做到这一点?该文档没有说明如何使用Emacs Lisp执行此操作.
(defun test ()
(interactive)
(align-regexp)) ; I would like to add the C-u prefix to this.
Run Code Online (Sandbox Code Playgroud)
Sea*_*rry 19
(defun my/test ()
(interactive)
(let ((current-prefix-arg 4)) ;; emulate C-u
(call-interactively 'align-regexp) ;; invoke align-regexp interactively
)
)
Run Code Online (Sandbox Code Playgroud)
希望有所帮助.
kot*_*ane 10
我来到这里寻找一种方法来检测我的函数是否被 Cu 调用。这是你如何做到的:
(defun my-function ()
(interactive)
(if (equal current-prefix-arg nil) ; no C-u
;; then
(message "my-function was called normally")
;; else
(message "my-function was called with C-u")))
Run Code Online (Sandbox Code Playgroud)
原发帖者问的是如何从他/她的函数内部使用 Cu调用另一个函数。我将其发布为对上面@codyChan 评论的澄清,希望它可以帮助其他人。
| 归档时间: |
|
| 查看次数: |
2569 次 |
| 最近记录: |