[Date Prev] [Date Index] [Date Next]
[Thread Prev] [Thread Index] [Thread Next]

[xyzzy:03603] Re: 空白を含むディレクトリ



薫です。



こんにちわ。

---
Subject: [xyzzy:03602] Re: 空白を含むディレクトリ
   Date: Fri, 19 Nov 1999 13:58:23 +0900
   From: Tetsuya Kamei <kamei@xxxxxxxxxxxx>

> 
> |   & "c:/p
> | 
> | で Tab 押したら出てきません?
> 
> てゆーか、勝手に`"'が追加される方が便利ですね。
> 次のバージョンが出るまで、とりあえずこれをどこかに書い
> ておいてください。

そうですか。
有り難き幸せであります。
では、こちらを引用させて頂きます。
# うう・・・LISP思い出さないと・・・(泣)。

> (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)))



では。
---
kaoru@xxxxxxxxxxxxxxxxx

Index Home