Function: rfn-eshadow-update-overlay
rfn-eshadow-update-overlay is a byte-compiled function defined in
rfn-eshadow.el.gz.
Signature
(rfn-eshadow-update-overlay)
Documentation
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(var)/file-name-shadow-mode(fun); the minibuffer should have already
been set up by rfn-eshadow-setup-minibuffer.
Source Code
;; Defined in /usr/src/emacs/lisp/rfn-eshadow.el.gz
;; post-command-hook to update overlay
(defun 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'."
(condition-case nil
(let* ((non-essential t)
(goal (substitute-in-file-name (minibuffer-contents)))
(mid (overlay-end rfn-eshadow-overlay))
(start (minibuffer-prompt-end))
(end (point-max)))
(unless
;; Catch the common case where the shadow does not need to move.
(and mid
(or (eq mid end)
(not (rfn-eshadow-sifn-equal goal (1+ mid))))
(or (eq mid start)
(rfn-eshadow-sifn-equal goal mid)))
;; Binary search for the greatest position still equivalent to
;; the whole.
(while (or (< (1+ start) end)
(if (and (< (1+ end) (point-max))
(rfn-eshadow-sifn-equal goal (1+ end)))
;; (SIFN end) != goal, but (SIFN (1+end)) == goal,
;; We've reached a discontinuity: this can happen
;; e.g. if `end' point to "/:...".
(setq start (1+ end) end (point-max))))
(setq mid (/ (+ start end) 2))
(if (rfn-eshadow-sifn-equal goal mid)
(setq start mid)
(setq end mid)))
(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)))