2009年10月10日土曜日

Emacsのタイトルバーにホスト名を表示させる

 Granzchesta's ぷち日常天国 さんの方で Emacs で tramp使用時にタイトルバーにホスト名を入れられないかどうか悩んでいたみたいなので試してみました。
 以下を ~/.emacs に追記。

;;; tramp でリモートホスト名をフレームに表示する。
(defun my-tramp-hostname ()
"tramp host name."
(if (buffer-file-name)
(if (string-match "\\`/\\([^[/:]+\\|[^/]+]\\):" (buffer-file-name))
(tramp-file-name-host (tramp-dissect-file-name (buffer-file-name)))
"local") nil ))
;; フレームにセット
(setq frame-title-format '("%b - " (:eval (my-tramp-hostname))))

 Emacsはテキストエディタなんですから決っして文字列操作が弱いわけではありません。テキストエディタなのに弱いとはこれいかに。

3 件のコメント:

  1. おぉ、素晴らしいです。
    This is exactly what I wanted to do って感じです。

    ありがとうございました。
    これで、また一歩快適な emacs ライフに近づきました。

    返信削除
  2. Casino Near Bryson City NJ - Mapyro
    Casino 전라남도 출장샵 Near Bryson City NJ - Mapyro provides real-time driving directions 충주 출장마사지 to a casino 시흥 출장마사지 and 군포 출장마사지 parking lot. The 의왕 출장마사지 location map shows all casinos and parking lots

    返信削除