Drafts

@cm3 の草稿置場 / 少々Wikiっぽく使っているので中身は適宜追記修正されます。

atom の python の highlighting が変→修正しました

下記の件はupdate builtin functions by cm3 · Pull Request #72 · atom/language-pythonでマージされて修正済みです

f:id:cm3ak:20150422173845p:plain

range とか min とか len は色づけされているのに str が色づけされてないのはなぜ?

atom/package.json at ecd04446434e47c505d7f1d3d8cb0fb76e91aa64 · atom/atom · GitHub に依存が書かれているlanguage-python/python.cson at master · atom/language-python · GitHubの問題だと思う。

str を検索すると、builtin_functionsではなく、builtin_typesmagic_function_namesに入っている。後者は正確には __str__ 関数が入っているので関係ない。(行が長くて見にくいが、例えば冒頭が'match': '(?x)\\b(__(?:... となっている)

このファイルは、syntaxes/Python.json → grammars/python.json → grammars/python.cson となっており、str の扱いに関しては initial commit language-python/Python.json at a57f00e3e42c9e73356bd25faada3e864e7bd348 · atom/language-python · GitHub から変化なく、その元は、TextMate のものだ。python.tmbundle/Python.tmLanguage at master · textmate/python.tmbundle · GitHub

そしてそのファイルの中で builtin_functions が追加されたのは* Improved handling of class/function defintions. Keywords are now mark... · textmate/python.tmbundle@29b0f6b · GitHub のコミットであり、そこにはやはり str は含まれておらず、next や print も含まれていないことやコミット日時からして python 2.5 時代のものだと推測される。ちなみに str も 2.5 では既に含まれているが。というわけで、現状の関数を元に一括追加してもいい気もする。

ちなみにユーザディレクトリ以下のAppData\Local\atom\app-0.192.0\resources\app\node_modules\language-python\grammars\python.jsonにそのような変更を加えたところ問題なく起動し、期待通り動いた。

f:id:cm3ak:20150422192205p:plain

たぶんプルリク送る時間が無いけれど、Contributing to Atom見ながら時間あれば。

追記:30分後

...とか思ってたらですね、後ろでAtomがアップデートして、\resources\app\node_modules\language-python\grammars\python.jsonなんて無くなったわけですよ!!!!

コマンドプロンプトから、apm install language-pythonってやると

The language-python package is bundled with Atom and should not be explicitly installed.
You can run `apm uninstall language-python` to uninstall it and then the version bundled
with Atom will be used.
Installing language-python to C:\Users\User\.atom\packages done

文句言いながらもやってくれる。そこで、このpackagesフォルダ内のファイルを同様にいじりました。

因みに、Community と Core で反映がずれるんだな。前者は Github の merge 後すぐに反映された。

f:id:cm3ak:20150627021050p:plain