Next: , Up: 接続ローカル変数   [Contents][Index]


12.14.1 接続ローカルなプロファイル

接続ローカルプロファイルとは、特定の接続にたいして適用する変数のセッティングを保存するためにEmacsが使用するプロファイルのことです。connection-local-set-profilesを使用してプロファイルを適用すべき条件を定義することで、プロファイルとリモート接続を関連付けることができます。

Function: connection-local-set-profile-variables profile variables

この関数は接続profile (シンボル)にたいする一連の変数セッティングを定義する。この接続プロファイルに後から1つ以上のリモート接続を割り当てることができ、Emacsはそれらの接続にたいするすべてのプロセスバッファーにそれらの変数セッティングを適用するだろう。variables内のリストは(name . value)という形式のalist。たとえば:

(connection-local-set-profile-variables
  'remote-bash
  '((shell-file-name . "/bin/bash")
    (shell-command-switch . "-c")
    (shell-interactive-switch . "-i")
    (shell-login-switch . "-l")))

(connection-local-set-profile-variables
  'remote-ksh
  '((shell-file-name . "/bin/ksh")
    (shell-command-switch . "-c")
    (shell-interactive-switch . "-i")
    (shell-login-switch . "-l")))

(connection-local-set-profile-variables
  'remote-null-device
  '((null-device . "/dev/null")))

既存のプロファイルにたいして変数セッティングを追加したい場合には、以下のように関数connection-local-get-profile-variablesを使って既存のセッティングを取得できる

(connection-local-set-profile-variables
  'remote-bash
  (append
   (connection-local-get-profile-variables 'remote-bash)
   '((shell-command-dont-erase-buffer . t))))
User Option: connection-local-profile-alist

このalistは接続プロファイルシンボルと連想変数セッティングを保持する。これはconnection-local-set-profile-variablesにより更新される。

Function: connection-local-set-profiles criteria &rest profiles

この関数はcriteriaで識別されるすべてのリモート接続にprofiles (シンボル)を割り当てる。criteriaは接続を識別するplistであり、アプリケーションはその接続を使用する。プロパティ名は:application:protocol:user:machineのいずれか。:applicationのプロパティ値はシンボル、それ以外のプロパティ値は文字列。プロパティはすべてオプション。criterianilなら常に適用される。たとえば:

(connection-local-set-profiles
  '(:application tramp :protocol "ssh" :machine "localhost")
  'remote-bash 'remote-null-device)

(connection-local-set-profiles
  '(:application tramp :protocol "sudo"
    :user "root" :machine "localhost")
  'remote-ksh 'remote-null-device)

criterianilならすべてのリモート接続に適用される。したがって上記の例は以下と等価

(connection-local-set-profiles
  '(:application tramp :protocol "ssh" :machine "localhost")
  'remote-bash)

(connection-local-set-profiles
  '(:application tramp :protocol "sudo"
    :user "root" :machine "localhost")
  'remote-ksh)

(connection-local-set-profiles
  nil 'remote-null-device)

profilesのすべてのプロファイルはconnection-local-set-profile-variablesで定義済みでなければならない。

User Option: connection-local-criteria-alist

このalistは接続のcriteria(判断基準)それに割り当てられたとprofileの名前を含む。関数connection-local-set-profilesはこのリストを更新する。

This page has generated for branch:work/emacs-29_d8687fd6cd807db1c76084a5e2bb214f9b6c9a49, commit:9e9726235ea9d9194d6a50e000c5b1189b51c690 to check Japanese translation.