term-mode で引数ありで任意のコマンドを実行

M-x term とかだと引数付けられないので。

(require 'term nil t)
(defvar term-shell-command-history nil
  "History for `term-shell-command'")
(defun term-shell-command (command &optional buffer-or-name)
  "Run COMMAND in terminal emulator.
If BUFFER-OR-NAME is given, use this buffer. In this case, old process in the
buffer is destroyed. Otherwise, new buffer is generated automatically from
COMMAND."
  (interactive (list (read-shell-command "Run program: "
                                         shell-file-name
                                         'term-shell-command-history)))
  (let* ((name (car (split-string command
                                  " ")))
         (buf (if buffer-or-name
                  (get-buffer-create buffer-or-name)
                (generate-new-buffer (concat "*"
                                             name
                                             "*")))))
    (with-current-buffer buf
      (term-mode)
      (term-exec buf
                 name
                 shell-file-name
                 nil
                 (list shell-command-switch
                       command))
      (term-char-mode)
      )
    (display-buffer buf)))