SlideShare uma empresa Scribd logo
1 de 17
Baixar para ler 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

Mais conteúdo relacionado

Destaque

BPF: Tracing and more
BPF: Tracing and moreBPF: Tracing and more
BPF: Tracing and more
Brendan Gregg
 

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

Último

Último (11)

新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
 
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
 
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native IntegrationsUtilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
 
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
 
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
 
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
 
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
 
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイスLoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
 
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
 
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
 

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