From 30d94e4b926fb62c4cb0d2635c7bb6b580c68c4a Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Tue, 4 Sep 2018 11:59:39 +0200 Subject: [PATCH] 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) --- lisp/net/tramp.el | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 13447575599..22fcccb8b65 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1892,7 +1892,6 @@ 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': (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'. Adds another overlay hiding filename parts according to Tramp's special handling of `substitute-in-file-name'." - (when (symbol-value 'minibuffer-completing-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 (symbol-value 'rfn-eshadow-overlay)))) + (let ((props (overlay-properties rfn-eshadow-overlay))) (while props ;; The `field' property prevents correct minibuffer ;; completion; we exclude it. @@ -1931,26 +1930,24 @@ This is intended to be used as a minibuffer `post-command-hook' for been set up by `rfn-eshadow-setup-minibuffer'." ;; In remote files name, there is a shadowing just for the local part. (ignore-errors - (let ((end (or (overlay-end (symbol-value 'rfn-eshadow-overlay)) + (let ((end (or (overlay-end rfn-eshadow-overlay) (minibuffer-prompt-end))) ;; We do not want to send any remote command. (non-essential t)) (when (tramp-tramp-file-p (buffer-substring-no-properties end (point-max))) - (save-excursion - (save-restriction - (narrow-to-region - (1+ (or (string-match - (tramp-rfn-eshadow-update-overlay-regexp) - (buffer-string) end) - end)) - (point-max)) - (let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay) - (rfn-eshadow-update-overlay-hook nil) - file-name-handler-alist) - (move-overlay rfn-eshadow-overlay (point-max) (point-max)) - (rfn-eshadow-update-overlay)))))))) + (save-restriction + (narrow-to-region + (1+ (or (string-match + (tramp-rfn-eshadow-update-overlay-regexp) + (buffer-string) end) + end)) + (point-max)) + (setq rfn-eshadow-overlay tramp-rfn-eshadow-overlay) + (let (rfn-eshadow-update-overlay-hook file-name-handler-alist) + (move-overlay rfn-eshadow-overlay (point-max) (point-max)) + (rfn-eshadow-update-overlay))))))) (add-hook 'rfn-eshadow-update-overlay-hook '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 ;; 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 ;; actually using sshfs. But when I launch a command I would like ;; to get it executed on the remote machine where the files really -- 2.39.2