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

[xyzzy:07213] Re: ヘッダのタグジャンプ?



toyoshiさん、こんにちは。

	      From: toyoshi.kabata@xxxxxxxxx
	      Date: Fri, 29 Jun 2001 00:30:07 +0900
	   Subject: [xyzzy:07208] ヘッダのタグジャンプ?
	Message-ID: <200106281530.AAA13144@xxxxxxxxxxxxxxxxx>


c-mode 様ではありませんが,一応こんなのもあります。

(defvar *delphi-search-path* '("." "D:/programming/delphi/Delphi5/Source/Vcl/"))
;; "." はカレント

(defun delphi-is-directory (path)
  (and (file-exist-p path)
	   (file-directory-p path)))

(defun delphi-is-file (path)
  (and (file-exist-p path)
	   (not (file-directory-p path))))

(defun delphi-search-directory (unit dir &optional recurse)
  (when (delphi-is-directory dir)
		(let* ((dir-name (append-trail-slash dir))
					 (files (directory dir-name)))
			(catch 'done
				;; Search for the file
				(mapcar #'(lambda (file)
										(let ((path (concat dir-name file)))
											(if (and (string-equal unit file)
															 (delphi-is-file path))
													(throw 'done path))))
								files)
				;; Search subdirectories
				(when recurse
					(mapcar #'(lambda (subdir)
											(let ((path (delphi-search-directory
																	 unit (concat dir-name subdir) recurse)))
												(if path (throw 'done path))))
									files))
				;; Not found
				nil))))

(defun delphi-find-unit-in-directory (unit dir)
  (let ((dir-name dir)
				(recurse nil))
		(when (string-match "^\\(.+\\)\\.\\.\\.$" dir-name)
			(setq dir-name (match-string 1))
			(setq recurse t))
		(when (string-match "^\\(.+\\)[\\\\/]$" dir-name)
			(setq dir-name (match-string 1)))
		(delphi-search-directory unit dir-name recurse)))

(defun delphi-find-unit (unit)
  (interactive "sDelphi unit name: ")
	(let* ((unit-file (if (string-match "^\\(.*\\)\\.[a-z]+$" unit)
												unit
											(concat unit ".pas")))
				 (file (delphi-find-unit-file unit-file)))
		(if (null file)
				(plain-error "unit not found: ~a" unit-file)
			(ed::find-file-internal file))))

けど,これだと find-file とあまり変わらないので,

>   この"hoge.h"を一発でオープンするようにするには、どのようにすればいいの
> でしょうか?

の様にしたい場合,カーソル位置の文字列を抜き出すような関数を用意
しておけば hyper-link の要領で扱えると思います。


**
quarto <quarto@xxxxxxxxxx>

Index Home