0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

コマンドに引数が指定されているかどうかを区別したい

Last updated at Posted at 2014-01-23

M-x foo と C-u M-x foo を区別したいような場合で、引数の値自体はどうでもいい場合。

(interactive "P") を指定し、引数が nil かどうかをチェックすればよい。

(defun foo (arg)
  (interactive "P")
  (if arg
      "引数が指定された"
    "引数が指定されなかった"))
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?