From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nick Roberts Newsgroups: gmane.emacs.devel Subject: Re: mode-line with Tramp Date: Tue, 17 Jul 2007 11:17:27 +1200 Message-ID: <18075.64647.459220.644967@kahikatea.snap.net.nz> References: <18065.63231.612402.142669@kahikatea.snap.net.nz> <18066.3981.316891.841594@kahikatea.snap.net.nz> <18066.59645.564793.472461@kahikatea.snap.net.nz> <87k5t88258.fsf@gmx.de> <18068.35413.238789.960586@kahikatea.snap.net.nz> <878x9m6825.fsf@gmx.de> <18069.23173.327298.566469@kahikatea.snap.net.nz> <18070.44458.968610.559681@kahikatea.snap.net.nz> <87myxyhvku.fsf@gmx.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1184627888 26513 80.91.229.12 (16 Jul 2007 23:18:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 16 Jul 2007 23:18:08 +0000 (UTC) Cc: emacs-devel@gnu.org To: Michael Albinus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 17 01:18:06 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IAZpL-0001oP-Rl for ged-emacs-devel@m.gmane.org; Tue, 17 Jul 2007 01:18:04 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IAZpL-0003rj-5u for ged-emacs-devel@m.gmane.org; Mon, 16 Jul 2007 19:18:03 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IAZpH-0003pm-9p for emacs-devel@gnu.org; Mon, 16 Jul 2007 19:17:59 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IAZpE-0003lt-OF for emacs-devel@gnu.org; Mon, 16 Jul 2007 19:17:57 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IAZpE-0003lp-JM for emacs-devel@gnu.org; Mon, 16 Jul 2007 19:17:56 -0400 Original-Received: from viper.snap.net.nz ([202.37.101.8]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IAZpD-0006iL-OU for emacs-devel@gnu.org; Mon, 16 Jul 2007 19:17:56 -0400 Original-Received: from kahikatea.snap.net.nz (179.60.255.123.dynamic.snap.net.nz [123.255.60.179]) by viper.snap.net.nz (Postfix) with ESMTP id 6BED33D956D; Tue, 17 Jul 2007 11:17:48 +1200 (NZST) Original-Received: by kahikatea.snap.net.nz (Postfix, from userid 1000) id 66AD88FC66; Tue, 17 Jul 2007 11:17:28 +1200 (NZST) In-Reply-To: <87myxyhvku.fsf@gmx.de> X-Mailer: VM 7.19 under Emacs 22.1.50.15 X-detected-kernel: Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:74937 Archived-At: > What about this: > > (defvar tramp-minor-mode-map (make-sparse-keymap) > "Keymap for Tramp minor mode.") > > (define-minor-mode tramp-minor-mode "Tramp minor mode." > :group 'tramp > :global nil > :init-value nil > :lighter " Tramp" > :keymap tramp-minor-mode-map > (setq tramp-minor-mode > (and tramp-minor-mode (tramp-tramp-file-p default-directory)))) > > (add-hook 'find-file-hooks 'tramp-minor-mode t) It's a bit misleading because tramp-minor-mode doesn't have any keybindings so it's not a real minor-mode. Also for dired, GUD buffer etc. this shows nothing. I think conditioning on (file-remote-p default-directory) was the right idea. How about something like this for binding.el: (defvar mode-line-remote-p (list (propertize "%1R" 'help-echo (purecopy (lambda (window object point) (format "%s" (save-selected-window (select-window window) (if (file-remote-p default-directory) (concat "Remote: " default-directory) ""))))))) "Mode-line flag to show if current buffer is for a remote machine.") (make-variable-buffer-local 'mode-line-remote-p) where mode-line-remote-p is added to the value of mode-line-format: ("%e" #("-" 0 1 (help-echo "mouse-1: select (drag to resize), mouse-2 = C-x 1, mouse-3 = C-x 0")) mode-line-mule-info mode-line-modified mode-line-remote-p mode-line-frame-identification mode-line-buffer-identification... And %R (not implemented yet) works a bit like %*: print R or hyphen depending on whether (file-remote-p default-directory) is true or not. -- Nick http://www.inet.net.nz/~nickrob