SlideShare una empresa de Scribd logo
1 de 17
Descargar para leer sin conexión
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




                           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 return
    the buffer. If a buffer exists visiting FILENAME,
    return that one, but verify that the file has not
    changed since visited or saved. The buffer is not
    selected, just returned to the caller. Optional
    second arg NOWARN non-nil means suppress any
    warning messages. Optional third arg RAWFILE
    non-nil means the file is read literally. Optional
    fourth arg WILDCARDS non-nil means do wildcard
    processing and visit all the matching files. When
    wildcards are actually used and expanded, return a
    list 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

Más contenido relacionado

Destacado

Linux Performance Analysis: New Tools and Old Secrets
Linux Performance Analysis: New Tools and Old SecretsLinux Performance Analysis: New Tools and Old Secrets
Linux Performance Analysis: New Tools and Old SecretsBrendan Gregg
 
Linux Systems Performance 2016
Linux Systems Performance 2016Linux Systems Performance 2016
Linux Systems Performance 2016Brendan Gregg
 
Broken Linux Performance Tools 2016
Broken Linux Performance Tools 2016Broken Linux Performance Tools 2016
Broken Linux Performance Tools 2016Brendan Gregg
 
BPF: Tracing and more
BPF: Tracing and moreBPF: Tracing and more
BPF: Tracing and moreBrendan Gregg
 
Velocity 2015 linux perf tools
Velocity 2015 linux perf toolsVelocity 2015 linux perf tools
Velocity 2015 linux perf toolsBrendan Gregg
 
性能測定道 実践編
性能測定道 実践編性能測定道 実践編
性能測定道 実践編Yuto Hayamizu
 
性能測定道 事始め編
性能測定道 事始め編性能測定道 事始め編
性能測定道 事始め編Yuto Hayamizu
 
Linux Profiling at Netflix
Linux Profiling at NetflixLinux Profiling at Netflix
Linux Profiling at NetflixBrendan Gregg
 

Destacado (8)

Linux Performance Analysis: New Tools and Old Secrets
Linux Performance Analysis: New Tools and Old SecretsLinux Performance Analysis: New Tools and Old Secrets
Linux Performance Analysis: New Tools and Old Secrets
 
Linux Systems Performance 2016
Linux Systems Performance 2016Linux Systems Performance 2016
Linux Systems Performance 2016
 
Broken Linux Performance Tools 2016
Broken Linux Performance Tools 2016Broken Linux Performance Tools 2016
Broken Linux Performance Tools 2016
 
BPF: Tracing and more
BPF: Tracing and moreBPF: Tracing and more
BPF: Tracing and more
 
Velocity 2015 linux perf tools
Velocity 2015 linux perf toolsVelocity 2015 linux perf tools
Velocity 2015 linux perf tools
 
性能測定道 実践編
性能測定道 実践編性能測定道 実践編
性能測定道 実践編
 
性能測定道 事始め編
性能測定道 事始め編性能測定道 事始め編
性能測定道 事始め編
 
Linux Profiling at Netflix
Linux Profiling at NetflixLinux Profiling at Netflix
Linux Profiling at Netflix
 

C-x C-f のなかのひと