SlideShare a Scribd company logo
1 of 17
Download to read offline
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

More Related Content

Viewers also liked

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
 

Viewers also liked (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
 

Recently uploaded

Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。iPride Co., Ltd.
 
プレイマットのパターン生成支援ツールの評価
プレイマットのパターン生成支援ツールの評価プレイマットのパターン生成支援ツールの評価
プレイマットのパターン生成支援ツールの評価sugiuralab
 
PHP-Conference-Odawara-2024-04-000000000
PHP-Conference-Odawara-2024-04-000000000PHP-Conference-Odawara-2024-04-000000000
PHP-Conference-Odawara-2024-04-000000000Shota Ito
 
20240412_HCCJP での Windows Server 2025 Active Directory
20240412_HCCJP での Windows Server 2025 Active Directory20240412_HCCJP での Windows Server 2025 Active Directory
20240412_HCCJP での Windows Server 2025 Active Directoryosamut
 
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By DanielPostman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Danieldanielhu54
 
IoT in the era of generative AI, Thanks IoT ALGYAN.pptx
IoT in the era of generative AI, Thanks IoT ALGYAN.pptxIoT in the era of generative AI, Thanks IoT ALGYAN.pptx
IoT in the era of generative AI, Thanks IoT ALGYAN.pptxAtomu Hidaka
 
プレイマットのパターン生成支援ツール
プレイマットのパターン生成支援ツールプレイマットのパターン生成支援ツール
プレイマットのパターン生成支援ツールsugiuralab
 
新人研修のまとめ 2024/04/12の勉強会で発表されたものです。
新人研修のまとめ       2024/04/12の勉強会で発表されたものです。新人研修のまとめ       2024/04/12の勉強会で発表されたものです。
新人研修のまとめ 2024/04/12の勉強会で発表されたものです。iPride Co., Ltd.
 

Recently uploaded (8)

Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
 
プレイマットのパターン生成支援ツールの評価
プレイマットのパターン生成支援ツールの評価プレイマットのパターン生成支援ツールの評価
プレイマットのパターン生成支援ツールの評価
 
PHP-Conference-Odawara-2024-04-000000000
PHP-Conference-Odawara-2024-04-000000000PHP-Conference-Odawara-2024-04-000000000
PHP-Conference-Odawara-2024-04-000000000
 
20240412_HCCJP での Windows Server 2025 Active Directory
20240412_HCCJP での Windows Server 2025 Active Directory20240412_HCCJP での Windows Server 2025 Active Directory
20240412_HCCJP での Windows Server 2025 Active Directory
 
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By DanielPostman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Daniel
 
IoT in the era of generative AI, Thanks IoT ALGYAN.pptx
IoT in the era of generative AI, Thanks IoT ALGYAN.pptxIoT in the era of generative AI, Thanks IoT ALGYAN.pptx
IoT in the era of generative AI, Thanks IoT ALGYAN.pptx
 
プレイマットのパターン生成支援ツール
プレイマットのパターン生成支援ツールプレイマットのパターン生成支援ツール
プレイマットのパターン生成支援ツール
 
新人研修のまとめ 2024/04/12の勉強会で発表されたものです。
新人研修のまとめ       2024/04/12の勉強会で発表されたものです。新人研修のまとめ       2024/04/12の勉強会で発表されたものです。
新人研修のまとめ 2024/04/12の勉強会で発表されたものです。
 

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