all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nick Roberts <nickrob@snap.net.nz>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: emacs-devel@gnu.org
Subject: Re: mode-line with Tramp
Date: Tue, 17 Jul 2007 11:17:27 +1200	[thread overview]
Message-ID: <18075.64647.459220.644967@kahikatea.snap.net.nz> (raw)
In-Reply-To: <87myxyhvku.fsf@gmx.de>

 > 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

  reply	other threads:[~2007-07-16 23:17 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-09  8:51 Tramp with GUD broken on trunk? Nick Roberts
2007-07-09 10:10 ` Michael Albinus
2007-07-09 10:35   ` Nick Roberts
2007-07-09 11:20     ` Michael Albinus
2007-07-10  2:03       ` Nick Roberts
2007-07-10  4:42         ` Michael Albinus
2007-07-10 14:14           ` Stefan Monnier
2007-07-10 14:39             ` Michael Albinus
2007-07-10 15:04               ` Stefan Monnier
2007-07-10 15:14                 ` Michael Albinus
2007-07-10 18:14                   ` Stefan Monnier
2007-07-10 19:55                     ` Michael Albinus
2007-07-10 22:27                       ` Nick Roberts
2007-07-11  2:10                       ` Nick Roberts
2007-07-11  5:59                         ` Michael Albinus
2007-07-11  7:44                       ` Nick Roberts
2007-07-11  7:58                         ` Michael Albinus
2007-07-11 19:42                         ` Michael Albinus
2007-07-11 22:32                           ` Nick Roberts
2007-07-12 15:36                             ` Michael Albinus
2007-07-12 21:17                               ` Michael Albinus
2007-07-12 22:40                                 ` Nick Roberts
2007-07-12 22:39                               ` mode-line with Tramp [was: Re: Tramp with GUD broken on trunk?] Nick Roberts
2007-07-15  9:20                                 ` mode-line with Tramp Michael Albinus
2007-07-16 23:17                                   ` Nick Roberts [this message]
2007-07-17 12:32                                     ` Michael Albinus
2007-07-18  8:43                                       ` Nick Roberts
2007-07-19 10:35                                         ` Michael Albinus
2007-07-19 21:21                                           ` Richard Stallman
2007-07-19 23:28                                             ` Nick Roberts
2007-07-21  4:52                                               ` Richard Stallman
2007-07-21  9:07                                                 ` Nick Roberts
2007-07-21  9:33                                                   ` Eli Zaretskii
2007-07-22  1:49                                                   ` Richard Stallman
2007-07-21  9:46                                               ` Eli Zaretskii
2007-07-21 23:12                                                 ` Nick Roberts
2007-07-22 18:36                                                   ` Richard Stallman
2007-07-21 19:04                                               ` Juri Linkov
2007-07-21 20:20                                                 ` David Kastrup
2007-07-21 23:10                                                 ` Nick Roberts
2007-07-22 18:36                                                   ` Richard Stallman
2007-07-22 19:24                                                     ` Michael Albinus
2007-07-22 22:39                                                     ` Nick Roberts
2007-07-22 21:47                                                   ` Juri Linkov
2007-07-22 22:36                                                     ` Nick Roberts
2007-07-22 18:36                                                 ` Richard Stallman
2007-07-22 23:25                                                   ` Nick Roberts
2007-07-23  7:56                                                     ` Michael Albinus
2007-07-23 20:58                                                       ` Nick Roberts
2007-07-23 18:06                                                     ` Richard Stallman
2007-07-23 21:28                                                       ` Nick Roberts
2007-07-23 21:34                                                     ` Juri Linkov
2007-07-23 22:46                                                       ` Nick Roberts
2007-07-25 22:26                                                         ` Nick Roberts
2007-07-26  8:51                                                           ` Juri Linkov
2007-07-26 16:59                                                           ` Richard Stallman
2007-07-27 23:05                                                     ` Johan Bockgård
2007-07-27 23:52                                                       ` Nick Roberts
2007-07-20  6:42                                             ` Michael Albinus
2007-07-21  4:51                                               ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18075.64647.459220.644967@kahikatea.snap.net.nz \
    --to=nickrob@snap.net.nz \
    --cc=emacs-devel@gnu.org \
    --cc=michael.albinus@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.