Fix Bug#32550

* lisp/net/tramp.el (tramp-rfn-eshadow-setup-minibuffer): Do not
use `symbol-value'.
(tramp-rfn-eshadow-update-overlay): Do not use `symbol-value'.  Do
not let-bind `rfn-eshadow-overlay', assign it directly (due to
lexical binding).  (Bug#32550)
This commit is contained in:
Michael Albinus 2018-09-04 11:59:39 +02:00
parent 57bcdc76e0
commit 30d94e4b92

View file

@ -1892,7 +1892,6 @@ For definition of that list see `tramp-set-completion-function'."
;; The method related defaults. ;; The method related defaults.
(cdr (assoc method tramp-completion-function-alist)))) (cdr (assoc method tramp-completion-function-alist))))
;;; Fontification of `read-file-name': ;;; Fontification of `read-file-name':
(defvar tramp-rfn-eshadow-overlay) (defvar tramp-rfn-eshadow-overlay)
@ -1902,11 +1901,11 @@ For definition of that list see `tramp-set-completion-function'."
"Set up a minibuffer for `file-name-shadow-mode'. "Set up a minibuffer for `file-name-shadow-mode'.
Adds another overlay hiding filename parts according to Tramp's Adds another overlay hiding filename parts according to Tramp's
special handling of `substitute-in-file-name'." special handling of `substitute-in-file-name'."
(when (symbol-value 'minibuffer-completing-file-name) (when minibuffer-completing-file-name
(setq tramp-rfn-eshadow-overlay (setq tramp-rfn-eshadow-overlay
(make-overlay (minibuffer-prompt-end) (minibuffer-prompt-end))) (make-overlay (minibuffer-prompt-end) (minibuffer-prompt-end)))
;; Copy rfn-eshadow-overlay properties. ;; Copy rfn-eshadow-overlay properties.
(let ((props (overlay-properties (symbol-value 'rfn-eshadow-overlay)))) (let ((props (overlay-properties rfn-eshadow-overlay)))
(while props (while props
;; The `field' property prevents correct minibuffer ;; The `field' property prevents correct minibuffer
;; completion; we exclude it. ;; completion; we exclude it.
@ -1931,14 +1930,13 @@ This is intended to be used as a minibuffer `post-command-hook' for
been set up by `rfn-eshadow-setup-minibuffer'." been set up by `rfn-eshadow-setup-minibuffer'."
;; In remote files name, there is a shadowing just for the local part. ;; In remote files name, there is a shadowing just for the local part.
(ignore-errors (ignore-errors
(let ((end (or (overlay-end (symbol-value 'rfn-eshadow-overlay)) (let ((end (or (overlay-end rfn-eshadow-overlay)
(minibuffer-prompt-end))) (minibuffer-prompt-end)))
;; We do not want to send any remote command. ;; We do not want to send any remote command.
(non-essential t)) (non-essential t))
(when (when
(tramp-tramp-file-p (tramp-tramp-file-p
(buffer-substring-no-properties end (point-max))) (buffer-substring-no-properties end (point-max)))
(save-excursion
(save-restriction (save-restriction
(narrow-to-region (narrow-to-region
(1+ (or (string-match (1+ (or (string-match
@ -1946,11 +1944,10 @@ been set up by `rfn-eshadow-setup-minibuffer'."
(buffer-string) end) (buffer-string) end)
end)) end))
(point-max)) (point-max))
(let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay) (setq rfn-eshadow-overlay tramp-rfn-eshadow-overlay)
(rfn-eshadow-update-overlay-hook nil) (let (rfn-eshadow-update-overlay-hook file-name-handler-alist)
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)))))))
(add-hook 'rfn-eshadow-update-overlay-hook (add-hook 'rfn-eshadow-update-overlay-hook
'tramp-rfn-eshadow-update-overlay) 'tramp-rfn-eshadow-update-overlay)
@ -4616,8 +4613,6 @@ Only works for Bourne-like shells."
;; strange when doing zerop, we should kill the process and start ;; strange when doing zerop, we should kill the process and start
;; again. (Greg Stark) ;; again. (Greg Stark)
;; ;;
;; * Make shadowfile.el grok Tramp filenames. (Bug#4526, Bug#4846)
;;
;; * I was wondering if it would be possible to use tramp even if I'm ;; * I was wondering if it would be possible to use tramp even if I'm
;; actually using sshfs. But when I launch a command I would like ;; actually using sshfs. But when I launch a command I would like
;; to get it executed on the remote machine where the files really ;; to get it executed on the remote machine where the files really