*** /home/albinus/src/emacs/lisp/rfn-eshadow.el.~1.25.~ 2007-07-26 07:31:01.000000000 +0200 --- /home/albinus/src/emacs/lisp/rfn-eshadow.el 2007-09-12 23:21:52.000000000 +0200 *************** *** 130,135 **** --- 130,140 ---- (defvar rfn-eshadow-overlay) (make-variable-buffer-local 'rfn-eshadow-overlay) + ;; An overlay covering the shadowed local filename part of a remote + ;; filename (local to the minibuffer). + (defvar rfn-eshadow-remote-overlay) + (make-variable-buffer-local 'rfn-eshadow-remote-overlay) + ;;; Hook functions *************** *** 140,156 **** (when minibuffer-completing-file-name (setq rfn-eshadow-overlay (make-overlay (minibuffer-prompt-end) (minibuffer-prompt-end))) ;; Give rfn-eshadow-overlay the user's props. (let ((props (if window-system file-name-shadow-properties file-name-shadow-tty-properties))) (while props ! (overlay-put rfn-eshadow-overlay (pop props) (pop props)))) ;; Turn on overlay evaporation so that we don't have to worry about ;; odd effects when the overlay sits empty at the beginning of the ;; minibuffer. (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))) --- 145,167 ---- (when minibuffer-completing-file-name (setq rfn-eshadow-overlay (make-overlay (minibuffer-prompt-end) (minibuffer-prompt-end))) + (setq rfn-eshadow-remote-overlay + (make-overlay (minibuffer-prompt-end) (minibuffer-prompt-end))) ;; Give rfn-eshadow-overlay the user's props. (let ((props (if window-system file-name-shadow-properties file-name-shadow-tty-properties))) (while props ! (let ((prop (pop props)) ! (value (pop props))) ! (overlay-put rfn-eshadow-overlay prop value) ! (overlay-put rfn-eshadow-remote-overlay prop value)))) ;; Turn on overlay evaporation so that we don't have to worry about ;; odd effects when the overlay sits empty at the beginning of the ;; minibuffer. (overlay-put rfn-eshadow-overlay 'evaporate t) + (overlay-put rfn-eshadow-remote-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))) *************** *** 168,176 **** 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'." (condition-case nil (let ((goal (substitute-in-file-name (minibuffer-contents))) ! (mid (overlay-end rfn-eshadow-overlay)) (start (minibuffer-prompt-end)) (end (point-max))) (unless --- 179,200 ---- 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'." + ;; Shadow from the beginning. + (rfn-eshadow-do-overlay rfn-eshadow-overlay) + + ;; In remote files name, there is a shadowing just for the local part. + (let ((x (or (overlay-end rfn-eshadow-overlay) (minibuffer-prompt-end)))) + (when (file-remote-p (buffer-substring-no-properties x (point-max))) + (narrow-to-region + (1+ (or (string-match "/" (buffer-string) x) x)) (point-max)) + (rfn-eshadow-do-overlay rfn-eshadow-remote-overlay) + (widen)))) + + (defun rfn-eshadow-do-overlay (overlay) + "Apply `rfn-eshadow-overlay' to cover shadowed part of minibuffer input." (condition-case nil (let ((goal (substitute-in-file-name (minibuffer-contents))) ! (mid (overlay-end overlay)) (start (minibuffer-prompt-end)) (end (point-max))) (unless *************** *** 193,199 **** (if (rfn-eshadow-sifn-equal goal mid) (setq start mid) (setq end mid))) ! (move-overlay rfn-eshadow-overlay (minibuffer-prompt-end) start))) ;; `substitute-in-file-name' can fail on partial input. (error nil))) --- 217,223 ---- (if (rfn-eshadow-sifn-equal goal mid) (setq start mid) (setq end mid))) ! (move-overlay overlay (minibuffer-prompt-end) start))) ;; `substitute-in-file-name' can fail on partial input. (error nil)))