elisp を使用して特権コマンドを実行し、特定の出力が表示されたときにフィルターを使用してさらに処理を行いたいと考えています。
徹底的な RTFM を行った後、次のことができると私は理解しています。
default-directory「/sudo::/」で始まるパスに設定します。start-file-processsudo で実行されるプロセスを開始するために呼び出します。
これを行うために私が書いた関数を次に示します。
(defun start-vpn (config-file password-file callback)
  "Starts the VPN connection, waits for a DHCP address,
then invokes callback with the address it got."
  (let* ((default-directory "/sudo::/tmp")
         (buff (get-buffer-create "*openvpn*"))
         (proc (start-file-process "openvpn" "*openvpn*"
                                   "/usr/local/sbin/openvpn"
                                   (concat "--config " config-file)
                                   (concat "--auth-user-pass " password-file))))
    (set-process-filter proc
                        (lambda (proc output)
                          (message "Got output: " output)
                          (let ((ip (get-vpn-ip-address output)))
                            (when ip
                              (callback ip)))))))
これを実行すると、*Messages*バッファに次の出力が表示されます。
start-vpn
Tramp: Opening connection for root@localhost using sudo...
Tramp: Sending command `exec sudo -u root -s -H -p Password:'
Tramp: Waiting for prompts from remote shell
Tramp: Sending command `exec sudo -u root -s -H -p Password:'
Tramp: Found remote shell prompt on `localhost'
Tramp: Opening connection for root@localhost using sudo...done
(lambda (proc output) (message "Got output: " output) (let ((ip ...)) (if ip (progn ...))))
Got output: 
...そして*openvpn*、関数が作成するバッファに出力はありません。
私は elisp の専門家ではないので、愚かな間違いを犯していると思います。バッファー"(lambda (proc ..."内のについても非常に興味があります。*Messages*
アドバイス、批判、またはヒントをいただければ幸いです。ありがとう!