c-x c-f のなかのひと
TRANSCRIPT
files.el : C-x C-fのなかのひと
はやみず
2008/6/28
1 / 17
Emacsを開いてまずすることといえば
2 / 17
C-x C-f
3 / 17
C-x C-f を実行したとき、何がおこっているのか
4 / 17
C-x C-f (find-file) はEmacs Lispで実装されている→ ソースが読める!
5 / 17
C-x C-f
ファイルを開いてるだけでしょ?
そんな難しいことしてないんじゃないの?
6 / 17
C-x C-f
ファイルを開いてるだけでしょ?そんな難しいことしてないんじゃないの?
7 / 17
ファイル処理を司る elisp: files.el
約1600行 いろいろ面白いものが埋まっていそうだ
8 / 17
ファイル処理を司る elisp: files.el
約1600行
いろいろ面白いものが埋まっていそうだ
9 / 17
ファイル処理を司る elisp: files.el
約1600行 いろいろ面白いものが埋まっていそうだ
10 / 17
読みはじめるときは
C-h C-k C-x C-fあるいは M-x help k C-x C-f ※ apt-get install emacs22-el などが必要
11 / 17
find-file
(defun find-file (filename &optional wildcards)(interactive (find-file-read-args "Find file: " nil))(let ((value (find-file-noselect filename nil nil wildcards)))(if (listp value)
(mapcar ’switch-to-buffer (nreverse value))(switch-to-buffer value))))
find-file-noselect がキモ
12 / 17
C-h C-f find-file-noselect してみる
Read file FILENAME into a buffer and returnthe buffer. If a buffer exists visiting FILENAME,return that one, but verify that the file has notchanged since visited or saved. The buffer is notselected, just returned to the caller. Optionalsecond arg NOWARN non-nil means suppress anywarning messages. Optional third arg RAWFILEnon-nil means the file is read literally. Optionalfourth arg WILDCARDS non-nil means do wildcardprocessing and visit all the matching files. Whenwildcards are actually used and expanded, return alist of buffers that are visiting the various files.
13 / 17
self-documenting
14 / 17
組み込みドキュメント
Emacs Lispは関数にドキュメントを書けるEmacs標準添付の elispは、ドキュメントが充実
ソース (実装)の前にドキュメント (意図)を読もう
15 / 17
組み込みドキュメント
Emacs Lispは関数にドキュメントを書けるEmacs標準添付の elispは、ドキュメントが充実 ソース (実装)の前にドキュメント (意図)を読もう
16 / 17
find-file-noselect
17 / 17