Fix Eshell electric slash when used from the root directory of a remote host
* lisp/eshell/em-elecslash.el (eshell-electric-forward-slash): Insert the remote prefix as determined by 'file-remote-p'. Copyright-paperwork-exempt: Yes
This commit is contained in:
parent
c088cdad9e
commit
777b383dd0
1 changed files with 5 additions and 9 deletions
|
@ -74,8 +74,9 @@ insertion."
|
||||||
(command (save-excursion
|
(command (save-excursion
|
||||||
(eshell-bol)
|
(eshell-bol)
|
||||||
(skip-syntax-forward " ")
|
(skip-syntax-forward " ")
|
||||||
(thing-at-point 'sexp))))
|
(thing-at-point 'sexp)))
|
||||||
(if (and (file-remote-p default-directory)
|
(prefix (file-remote-p default-directory)))
|
||||||
|
(if (and prefix
|
||||||
;; We can't formally parse the input. But if there is
|
;; We can't formally parse the input. But if there is
|
||||||
;; one of these operators behind us, then looking at
|
;; one of these operators behind us, then looking at
|
||||||
;; the first command would not be sensible. So be
|
;; the first command would not be sensible. So be
|
||||||
|
@ -93,14 +94,9 @@ insertion."
|
||||||
(or eshell-prefer-lisp-functions
|
(or eshell-prefer-lisp-functions
|
||||||
(not (eshell-search-path command))))))))
|
(not (eshell-search-path command))))))))
|
||||||
(let ((map (make-sparse-keymap))
|
(let ((map (make-sparse-keymap))
|
||||||
(start (if tilde-before (1- (point)) (point)))
|
(start (if tilde-before (1- (point)) (point))))
|
||||||
(localname
|
|
||||||
(tramp-file-name-localname
|
|
||||||
(tramp-dissect-file-name default-directory))))
|
|
||||||
(when tilde-before (delete-char -1))
|
(when tilde-before (delete-char -1))
|
||||||
(insert
|
(insert prefix)
|
||||||
(substring default-directory 0
|
|
||||||
(string-search localname default-directory)))
|
|
||||||
(unless tilde-before (insert "/"))
|
(unless tilde-before (insert "/"))
|
||||||
;; Typing a second slash undoes the insertion, for when
|
;; Typing a second slash undoes the insertion, for when
|
||||||
;; you really do want to type a local absolute file name.
|
;; you really do want to type a local absolute file name.
|
||||||
|
|
Loading…
Add table
Reference in a new issue