Better fix for bug#32550

* lisp/rfn-eshadow.el (rfn-eshadow-overlay): Give it a global default.

* lisp/net/tramp.el (rfn-eshadow-overlay): Declare it as dynamically scoped.
(tramp-rfn-eshadow-update-overlay): Revert the corresponding part of
last change.
This commit is contained in:
Stefan Monnier 2018-09-04 12:03:52 -04:00
parent 30d94e4b92
commit 9618e16efa
2 changed files with 11 additions and 5 deletions

View file

@ -1923,6 +1923,13 @@ special handling of `substitute-in-file-name'."
(defun tramp-rfn-eshadow-update-overlay-regexp () (defun tramp-rfn-eshadow-update-overlay-regexp ()
(format "[^%s/~]*\\(/\\|~\\)" tramp-postfix-host-format)) (format "[^%s/~]*\\(/\\|~\\)" tramp-postfix-host-format))
;; Package rfn-eshadow is preloaded in Emacs, but for some reason,
;; it only did (defvar rfn-eshadow-overlay) without giving it a global
;; value, so it was only declared as dynamically-scoped within the
;; rfn-eshadow.el file. This is now fixed in Emacs>26.1 but we still need
;; this defvar here for older releases.
(defvar rfn-eshadow-overlay)
(defun tramp-rfn-eshadow-update-overlay () (defun tramp-rfn-eshadow-update-overlay ()
"Update `rfn-eshadow-overlay' to cover shadowed part of minibuffer input. "Update `rfn-eshadow-overlay' to cover shadowed part of minibuffer input.
This is intended to be used as a minibuffer `post-command-hook' for This is intended to be used as a minibuffer `post-command-hook' for
@ -1944,8 +1951,9 @@ been set up by `rfn-eshadow-setup-minibuffer'."
(buffer-string) end) (buffer-string) end)
end)) end))
(point-max)) (point-max))
(setq rfn-eshadow-overlay tramp-rfn-eshadow-overlay) (let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay)
(let (rfn-eshadow-update-overlay-hook file-name-handler-alist) (rfn-eshadow-update-overlay-hook nil)
file-name-handler-alist)
(move-overlay rfn-eshadow-overlay (point-max) (point-max)) (move-overlay rfn-eshadow-overlay (point-max) (point-max))
(rfn-eshadow-update-overlay))))))) (rfn-eshadow-update-overlay)))))))

View file

@ -132,9 +132,7 @@ system, `file-name-shadow-properties' is used instead."
;; An overlay covering the shadowed part of the filename (local to the ;; An overlay covering the shadowed part of the filename (local to the
;; minibuffer). ;; minibuffer).
(defvar rfn-eshadow-overlay) (defvar-local rfn-eshadow-overlay nil)
(make-variable-buffer-local 'rfn-eshadow-overlay)
;;; Hook functions ;;; Hook functions