]> code.delx.au - gnu-emacs/commitdiff
* rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
authorMichael Albinus <michael.albinus@gmx.de>
Fri, 21 Sep 2007 05:24:06 +0000 (05:24 +0000)
committerMichael Albinus <michael.albinus@gmx.de>
Fri, 21 Sep 2007 05:24:06 +0000 (05:24 +0000)
(rfn-eshadow-update-overlay-hook): New defvars.
(rfn-eshadow-setup-minibuffer, rfn-eshadow-update-overlay): Run
the hooks.

* net/tramp.el (tramp-rfn-eshadow-overlay): New defvar.
(tramp-rfn-eshadow-setup-minibuffer)
(tramp-rfn-eshadow-update-overlay): New defuns.  Hook into
rfn-eshadow.el.

* net/tramp-smb.el (tramp-smb-errors): Add error message for call
timeout.

lisp/ChangeLog
lisp/net/tramp-smb.el
lisp/net/tramp.el
lisp/rfn-eshadow.el

index f238531667afc64c9b589d7ae66ab397785e9629..2b0e3ad42e3f175ebb3c83a4f30e8f87e3ef147b 100644 (file)
@@ -1,3 +1,18 @@
+2007-09-21  Michael Albinus  <michael.albinus@gmx.de>
+
+       * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
+       (rfn-eshadow-update-overlay-hook): New defvars.
+       (rfn-eshadow-setup-minibuffer, rfn-eshadow-update-overlay): Run
+       the hooks.
+
+       * net/tramp.el (tramp-rfn-eshadow-overlay): New defvar.
+       (tramp-rfn-eshadow-setup-minibuffer)
+       (tramp-rfn-eshadow-update-overlay): New defuns.  Hook into
+       rfn-eshadow.el.
+
+       * net/tramp-smb.el (tramp-smb-errors): Add error message for call
+       timeout.
+
 2007-09-21  Markus Triska  <markus.triska@gmx.at>
 
        * emacs-lisp/bytecomp.el (byte-compile-normal-call): Warn when
index 5dbf12955d74e2046fa7e445a855ce76e4dd1c43..c7ea3a12163ac9dcb04ae9d2718e62e8e1678d29 100644 (file)
@@ -79,6 +79,7 @@
    '(;; Connection error / timeout
      "Connection to \\S-+ failed"
      "Read from server failed, maybe it closed the connection"
+     "Call timed out: server did not respond"
      ;; Samba
      "ERRDOS"
      "ERRSRV"
index bcab2b9cf524f8a130e41489f7e554544b5bd210..a102a9f19c0c428d9dfffe3845c9a8de85ef818d 100644 (file)
@@ -2087,6 +2087,49 @@ For definition of that list see `tramp-set-completion-function'."
    ;; The method related defaults.
    (cdr (assoc method tramp-completion-function-alist))))
 
+
+;;; Fontification of `read-file-name'.
+
+;; rfn-eshadow.el is part of Emacs 22.  Its is autoloaded.
+(defvar tramp-rfn-eshadow-overlay)
+(make-variable-buffer-local 'tramp-rfn-eshadow-overlay)
+
+(defun tramp-rfn-eshadow-setup-minibuffer ()
+  "Set up a minibuffer for `file-name-shadow-mode'.
+Adds another overlay hiding filename parts according to Tramp's
+special handling of `substitute-in-file-name'."
+  (when minibuffer-completing-file-name
+    (setq tramp-rfn-eshadow-overlay
+         (make-overlay (minibuffer-prompt-end) (minibuffer-prompt-end)))
+    ;; Copy rfn-eshadow-overlay properties.
+    (let ((props (overlay-properties rfn-eshadow-overlay)))
+      (while props
+       (overlay-put tramp-rfn-eshadow-overlay (pop props) (pop props))))))
+
+(when (boundp 'rfn-eshadow-setup-minibuffer-hook)
+  (add-hook 'rfn-eshadow-setup-minibuffer-hook
+           'tramp-rfn-eshadow-setup-minibuffer))
+
+(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
+`file-name-shadow-mode'; the minibuffer should have already
+been set up by `rfn-eshadow-setup-minibuffer'."
+  ;; In remote files name, there is a shadowing just for the local part.
+  (let ((end (or (overlay-end rfn-eshadow-overlay) (minibuffer-prompt-end))))
+    (when (file-remote-p (buffer-substring-no-properties end (point-max)))
+      (narrow-to-region
+       (1+ (or (string-match "/" (buffer-string) end) end)) (point-max))
+      (let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay)
+           (rfn-eshadow-update-overlay-hook nil))
+       (rfn-eshadow-update-overlay))
+      (widen))))
+
+(when (boundp 'rfn-eshadow-update-overlay-hook)
+  (add-hook 'rfn-eshadow-update-overlay-hook
+           'tramp-rfn-eshadow-update-overlay))
+
+
 ;;; File Name Handler Functions:
 
 (defun tramp-handle-make-symbolic-link
@@ -7467,7 +7510,7 @@ please ensure that the buffers are attached to your email.\n\n")
 ;;   indefinitely blocking piece of code.  In this case it would be
 ;;   within Tramp around one of its calls to accept-process-output (or
 ;;   around one of the loops that calls accept-process-output)
-;;   (Stefann Monnier).
+;;   (Stefan Monnier).
 ;; * Autodetect if remote `ls' groks the "--dired" switch.
 ;; * Add fallback for inline encodings.  This should be used
 ;;   if the remote end doesn't support mimencode or a similar program.
index daa66118b38e29c4910bddd91b9b2b98c17b725d..ced5ed3f36870940a6ea6d2ec590ad6be6204f2e 100644 (file)
@@ -119,6 +119,12 @@ system, `file-name-shadow-properties' is used instead."
   :group 'minibuffer
   :version "22.1")
 
+(defvar rfn-eshadow-setup-minibuffer-hook nil
+  "Minibuffer setup functions from other packages.")
+
+(defvar rfn-eshadow-update-overlay-hook nil
+  "Customer overlay functions from other packages")
+
 \f
 ;;; Internal variables
 
@@ -153,7 +159,9 @@ The prompt and initial input should already have been inserted."
     (overlay-put rfn-eshadow-overlay 'evaporate t)
     ;; Add our post-command hook, and make sure can remove it later.
     (add-to-list 'rfn-eshadow-frobbed-minibufs (current-buffer))
-    (add-hook 'post-command-hook #'rfn-eshadow-update-overlay nil t)))
+    (add-hook 'post-command-hook #'rfn-eshadow-update-overlay nil t)
+    ;; Run custom hook
+    (run-hooks 'rfn-eshadow-setup-minibuffer-hook)))
 
 (defsubst rfn-eshadow-sifn-equal (goal pos)
   (equal goal (condition-case nil
@@ -193,7 +201,9 @@ been set up by `rfn-eshadow-setup-minibuffer'."
             (if (rfn-eshadow-sifn-equal goal mid)
                 (setq start mid)
               (setq end mid)))
-          (move-overlay rfn-eshadow-overlay (minibuffer-prompt-end) start)))
+          (move-overlay rfn-eshadow-overlay (minibuffer-prompt-end) start))
+       ;; Run custom hook
+       (run-hooks 'rfn-eshadow-update-overlay-hook))
     ;; `substitute-in-file-name' can fail on partial input.
     (error nil)))
 \f