[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
tramp simplified syntax and ido interaction
From: |
Robert Pluim |
Subject: |
tramp simplified syntax and ido interaction |
Date: |
Wed, 02 Aug 2017 11:34:34 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
Hi,
I'm using emacs master. I wanted to try out tramp's simplified syntax,
but this has a bad interaction with ido which I also use. I tracked it
down to ido-make-file-list, which does not handle empty strings in its
potential completion list. It's not clear to me if this is an ido or a
tramp bug, but one potential fix is attached.
Reproduction from emacs -Q :
; Eval this form
(custom-set-variables
'(ido-everywhere t)
'(ido-max-dir-file-cache 10)
'(ido-mode (quote both) nil (ido))
'(ido-use-filename-at-point (quote guess))
)
; find a file using normal tramp syntax, then eval the next two lines
(tramp-change-syntax 'simplified)
(setq debug-on-error t)
; C-x C-f /f
Debugger entered--Lisp error: (args-out-of-range "" 0 1)
substring("" 0 1)
(string-equal (substring x 0 1) ".")
(if (string-equal (substring x 0 1) ".") x)
(closure ((default . "etc/") ido-completing-read ido-context-switch-command
ido-find-literal ido-saved-vc-hb ido-pre-merge-state ido-try-merged-list
ido-use-merged-list ido-work-file-index ido-work-directory-index
ido-rotate-temp ido-temp-list ido-show-confirm-message ido-require-match
ido-entry-buffer ido-enable-virtual-buffers ido-process-ignore-lists-inhibit
ido-process-ignore-lists ido-keep-item-list ido-directory-too-big
ido-directory-nonreadable ido-ignored-list ido-choice-list ido-cur-list
ido-default-item ido-cur-item recentf-list t) (x) (if (string-equal (substring
x 0 1) ".") x))("")
mapcar((closure ((default . "etc/") ido-completing-read
ido-context-switch-command ido-find-literal ido-saved-vc-hb ido-pre-merge-state
ido-try-merged-list ido-use-merged-list ido-work-file-index
ido-work-directory-index ido-rotate-temp ido-temp-list ido-show-confirm-message
ido-require-match ido-entry-buffer ido-enable-virtual-buffers
ido-process-ignore-lists-inhibit ido-process-ignore-lists ido-keep-item-list
ido-directory-too-big ido-directory-nonreadable ido-ignored-list
ido-choice-list ido-cur-list ido-default-item ido-cur-item recentf-list t) (x)
(if (string-equal (substring x 0 1) ".") x)) ("" "" "bin/" "boot/" "cdrom/"
"dev/" "etc/" "home/" "initrd.img" "initrd.img.old" "lib/" "lib32/" "lib64/"
"lost+found/" "media/" "mnt/" "opt/" "proc/" "root/" "run/" "sbin/" "snap/"
"srv/" "sys/" "tmp/" "usr/" "var/" "vmlinuz" "vmlinuz.old" "fmail-3000:"
"fortimail-vm:" "fsiem:" "fsm-robert:" "kubuntu-vm:" "rpluim-ubuntu:"
"secops3700f:"))
(delq nil (mapcar (function (lambda (x) (if (string-equal (substring x 0 1)
".") x))) ido-temp-list))
(ido-to-end (delq nil (mapcar (function (lambda (x) (if (string-equal
(substring x 0 1) ".") x))) ido-temp-list)))
(let ((ido-temp-list (ido-make-file-list-1 ido-current-directory))) (setq
ido-temp-list (sort ido-temp-list (if ido-file-extensions-order (function
ido-file-extension-lessp) (function ido-file-lessp)))) (if (ido-is-tramp-root
ido-current-directory) nil (let ((default-directory ido-current-directory))
(ido-to-end (delq nil (mapcar (function (lambda (x) (if (or (and (string-match
".:\\'" x) (not (ido-local-file-exists-p x))) (and (not (ido-final-slash x))
(let (file-name-handler-alist) (get-file-buffer x)))) x))) ido-temp-list)))))
(ido-to-end (delq nil (mapcar (function (lambda (x) (if (string-equal
(substring x 0 1) ".") x))) ido-temp-list))) (if (and default (member default
ido-temp-list)) (if (or ido-rotate-temp ido-rotate-file-list-default) (if
(equal default (car ido-temp-list)) nil (let ((l ido-temp-list) k) (while (and
l (cdr l) (not (equal default (car (cdr l))))) (setq l (cdr l))) (setq k (cdr
l)) (setcdr l nil) (nconc k ido-temp-list) (setq ido-temp-list k))) (setq
ido-temp-list (delete default ido-temp-list)) (setq ido-temp-list (cons default
ido-temp-list)))) (if ido-show-dot-for-dired (progn (setq ido-temp-list (delete
"." ido-temp-list)) (setq ido-temp-list (cons "." ido-temp-list)))) (run-hooks
'ido-make-file-list-hook) ido-temp-list)
ido-make-file-list("etc/")
Regards
Robert
>From f8c25dd71b5e3e05f15b4ba2dc0fb6328f99513a Mon Sep 17 00:00:00 2001
From: Robert Pluim <address@hidden>
Date: Wed, 2 Aug 2017 11:17:01 +0200
Subject: [PATCH] Use string-match to check for dotfiles in ido
* lisp/ido.el (ido-make-file-list): Use string-match to check
for dotfiles instead of substring, as when using tramp
simplified syntax ido-temp-list may contain empty strings
---
lisp/ido.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/ido.el b/lisp/ido.el
index 7253a8c840..c4eb1bc11e 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -3679,7 +3679,7 @@ ido-make-file-list
ido-temp-list)))))
(ido-to-end ;; move . files to end
(delq nil (mapcar
- (lambda (x) (if (string-equal (substring x 0 1) ".") x))
+ (lambda (x) (if (string-match "^\." x) x))
ido-temp-list)))
(if (and default (member default ido-temp-list))
(if (or ido-rotate-temp ido-rotate-file-list-default)
--
2.14.0.rc1
- tramp simplified syntax and ido interaction,
Robert Pluim <=