LoginSignup
7

More than 5 years have passed since last update.

flymake で一時ファイルの出力先をファイルと同じディレクトリにしない

Posted at

Dropbox 内部でプログラムを書いていると、頻繁にファイルのアップロードと削除が行われて嫌だったので調べてみた。

結論としては、flymake-create-temp-inplace ではなく flymake-create-temp-with-folder-structure を使用すれば良さそうだ。例えば Ruby であればこんな感じ。

(defun flymake-ruby-init ()
  (let* ((temp-file   (flymake-init-create-temp-buffer-copy
                       ;; 'flymake-create-temp-inplace ← ここを変更
                       'flymake-create-temp-with-folder-structure))
         (local-file  (file-relative-name
                       temp-file
                       (file-name-directory buffer-file-name))))
    (list "ruby" (list "-c" local-file))))

まあ temp-file を書き換えればどうにでもなるわけだけど、わざわざ関数が用意されてるのでそれを使わせてもらうことにする。

ちなみに私の環境だとこの設定によって、/tmp 以下に絶対パスのディレクトリ構成を作成し、そこにソースファイルを作成するようになった。あと、パスの途中にピリオドの入ったディレクトリが存在するとエラーが出るようなので注意。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7