From adcbca532ba6d14daf5d6afc8aa231b01ce3f064 Mon Sep 17 00:00:00 2001
From: Michael Albinus <michael.albinus@gmx.de>
Date: Mon, 3 Aug 2009 08:22:04 +0000
Subject: [PATCH] * net/tramp.el (tramp-rfn-eshadow-update-overlay-regexp) New
 defconst. (tramp-rfn-eshadow-update-overlay): Use it.

---
 lisp/ChangeLog    | 7 ++++++-
 lisp/net/tramp.el | 8 +++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 783a95da671..b15c3eb3e0c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2009-08-03  Michael Albinus  <michael.albinus@gmx.de>
+
+	* net/tramp.el (tramp-rfn-eshadow-update-overlay-regexp) New
+	defconst.
+	(tramp-rfn-eshadow-update-overlay): Use it.
+
 2009-08-02  Kevin Ryde  <user42@zip.com.au>
 
 	* net/newst-backend.el (newsticker--raw-url-list-defaults): Update
@@ -5,7 +11,6 @@
 
 2009-08-02  Chong Yidong  <cyd@stupidchicken.com>
 
-
 	* select.el (x-set-selection): Doc fix (Bug#4021).
 
 	* w32-fns.el (x-set-selection): Doc fix (Bug#4021).
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index e8ce36e4c07..df2f10ba5dd 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2196,6 +2196,9 @@ special handling of `substitute-in-file-name'."
 	       (remove-hook 'rfn-eshadow-setup-minibuffer-hook
 			    'tramp-rfn-eshadow-setup-minibuffer))))
 
+(defconst tramp-rfn-eshadow-update-overlay-regexp
+  (format "[^%s/~]*\\(/\\|~\\)" tramp-postfix-host-format))
+
 (defun tramp-rfn-eshadow-update-overlay ()
   "Update `rfn-eshadow-overlay' to cover shadowed part of minibuffer input.
 This is intended to be used as a minibuffer `post-command-hook' for
@@ -2209,7 +2212,10 @@ been set up by `rfn-eshadow-setup-minibuffer'."
       (save-excursion
 	(save-restriction
 	  (narrow-to-region
-	   (1+ (or (string-match "/" (buffer-string) end) end)) (point-max))
+	   (1+ (or (string-match
+		    tramp-rfn-eshadow-update-overlay-regexp (buffer-string) end)
+		   end))
+	   (point-max))
 	  (let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay)
 		(rfn-eshadow-update-overlay-hook nil))
 	    (move-overlay rfn-eshadow-overlay (point-max) (point-max))
-- 
2.39.5