[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mode-line with Tramp
From: |
Nick Roberts |
Subject: |
Re: mode-line with Tramp |
Date: |
Tue, 17 Jul 2007 11:17:27 +1200 |
> 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
- Re: Tramp with GUD broken on trunk?, (continued)
- Re: Tramp with GUD broken on trunk?, Nick Roberts, 2007/07/11
- Re: Tramp with GUD broken on trunk?, Michael Albinus, 2007/07/11
- Re: Tramp with GUD broken on trunk?, Michael Albinus, 2007/07/11
- Re: Tramp with GUD broken on trunk?, Nick Roberts, 2007/07/11
- Re: Tramp with GUD broken on trunk?, Michael Albinus, 2007/07/12
- mode-line with Tramp [was: Re: Tramp with GUD broken on trunk?], Nick Roberts, 2007/07/12
- Re: mode-line with Tramp, Michael Albinus, 2007/07/15
- Re: mode-line with Tramp,
Nick Roberts <=
- Re: mode-line with Tramp, Michael Albinus, 2007/07/17
- Re: mode-line with Tramp, Nick Roberts, 2007/07/18
- Re: mode-line with Tramp, Michael Albinus, 2007/07/19
- Re: mode-line with Tramp, Richard Stallman, 2007/07/19
- Re: mode-line with Tramp, Nick Roberts, 2007/07/19
- Re: mode-line with Tramp, Richard Stallman, 2007/07/21
- Re: mode-line with Tramp, Nick Roberts, 2007/07/21
- Re: mode-line with Tramp, Eli Zaretskii, 2007/07/21
- Re: mode-line with Tramp, Richard Stallman, 2007/07/21
- Re: mode-line with Tramp, Eli Zaretskii, 2007/07/21