[xyzzy:03602] Re: 空白を含むディレクトリ
- Subject: [xyzzy:03602] Re: 空白を含むディレクトリ
- From: Tetsuya Kamei <kamei@xxxxxxxxxxxx>
- X-mailer: Denshin 8 Go V321.2b5
- X-yzzy-version: 0.1.1.111
Fri, 19 Nov 1999 13:43:33 +0900 の
“[xyzzy:03600] Re: 空白を含むディレクトリ”
への返事です.
| & "c:/p
|
| で Tab 押したら出てきません?
てゆーか、勝手に`"'が追加される方が便利ですね。
次のバージョンが出るまで、とりあえずこれをどこかに書い
ておいてください。
(in-package "editor")
(defun complete-command-line (from word)
(let ((point (point))
beg end
cmdb cmde
quote
slash
clist)
(save-excursion
(save-restriction
(narrow-to-region from point)
(goto-char from)
(while (< (point) point)
(skip-chars-forward " \t")
(cond ((looking-for "\"")
(forward-char 1)
(setq quote t)
(setq beg (point))
(setq end (if (skip-chars-forward "^\"")
(prog1
(point)
(forward-char 1))
(progn
(goto-char point)
point))))
(t
(setq quote nil)
(setq beg (point))
(skip-chars-forward "^ \t")
(setq end (point))))
(setq end (min end point))
(setq beg (min beg end))
(or cmdb
(setq cmdb beg cmde end)))
(or beg
(setq beg point end point cmdb point cmde point))
(unless quote
(save-restriction
(narrow-to-region beg end)
(goto-char end)
(skip-chars-backward "^&|<>(")
(setq beg (point))))
(unless (= beg cmdb)
(goto-char beg)
(when quote
(forward-char -1))
(skip-chars-backward " \t")
(and (forward-char -1)
(looking-at "[&|(]")
(setq cmdb beg)))
(setq slash (progn
(goto-char end)
(and (scan-buffer "[:/\\]" :reverse t :regexp t :limit beg :tail t)
(point)))))
(let ((d (if slash
(buffer-substring beg slash)
".")))
(cond ((= cmdb beg)
(or slash
(setq clist (or *executable-list*
(progn
(build-executable-list)
*executable-list*))))
(setq clist (nconc (directory d :directory-only t :show-dots t)
(directory d :wild *executable-file-suffixes*)
clist)))
(t
(setq clist (directory d :show-dots t))))))
(let ((status (do-completion-internal (or slash beg) point :list-ignore-case
clist nil word)))
(save-excursion
(let ((end (point)))
(goto-char beg)
(if (or (string-matchp *shell* "command.com$")
(string-matchp *shell* "cmd.exe$"))
(replace-buffer "/" "\\" :limit end)
(replace-buffer "\\" "/" :limit end))
(unless quote
(goto-char beg)
(when (scan-buffer " " :limit end)
(goto-char beg)
(insert "\"")
(setq quote t)))))
(when (eq status :solo-match)
(or (looking-at " \t")
(insert (if quote "\" " " "))))
status)))
--
亀井哲弥(Tetsuya Kamei)
kamei@xxxxxxxxxxxx/JCA00343@xxxxxxxxxxx