で呼び出すと効果が異なるC-u関数(たとえば、正規表現)で使用したいと思います。C-uEmacsでこれを行うにはどうすればよいですか?ドキュメントには、EmacsLispでこれを行う方法は示されていません。
(defun test ()
(interactive)
(align-regexp)) ; I would like to add the C-u prefix to this.
(defun my/test ()
(interactive)
(let ((current-prefix-arg 4)) ;; emulate C-u
(call-interactively 'align-regexp) ;; invoke align-regexp interactively
)
)
お役に立てば幸いです。
私は自分の関数が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")))
元の投稿者が求めていたのは、関数内からCuを使用して別の関数を呼び出す方法です。他の人に役立つことを願って、上記の@codyChanのコメントの説明としてこれを投稿します。