|
Namazu for hns による簡易全文検索 詳しくは 詳細指定/ヘルプを参照して下さい |
||||||||||||||||||||||||||||||||||||||||||||||||
2010年04月08日(木) 旧暦 [n年日記] [更新:"2010/04/08 08:32:52"]#1 [Emacs] batch M-x sort-lines
batch で、譜の内容を emacs 内部コードで整列するには、
どうすれば良いのだろうか。
(provide 'batch-sort-file) (defun batch-sort-file() "Just sort file, important thing is: done by emacs internal code order" (interactive) (insert-file-contents "/tmp/1") (sort-lines nil (point-min) (point-max)) (write-file "/tmp/1.out") )以上のようなものを batch-sort-file.el という名前で 用意しておいて、次のように入力すると、 emacs -batch -q -no-site-file -l batch-sort-file.el -f batch-sort-file/tmp/1 -> /tmp/1.out に期待される動作をするけれど、この /tmp/1, /tmp/1.out に任意の名前を与えるにはどうすれば良いのだろう。 command-line-args-left という変数に引数のリストが入るらしい 次のように書いておいて、 (provide 'batch-sort-file) (defun batch-sort-file() "Just sort file, important thing is: done by emacs internal code order" (interactive) (set 'in_file (car command-line-args-left)) (set 'out_file(car (cdr command-line-args-left))) (insert-file-contents in_file) (sort-lines nil (point-min) (point-max)) (write-file out_file) ) ;;; batch-sort-file.el ends here次のようにシェルで起動すれば input-file -> output-file と書替えてくれる emacs -batch -q -no-site-file -l batch-sort-file.el -f batch-sort-file \ input-file output-file ( つっこみ )
|
最近の日記 2024年05月06日 ・py-setuptools (python 3.11.1) ・make release took 1 hours and 10 min ・qemu invocation for 10.99.10 2024年05月05日 ・Windows 10 version ・serial connection ・bc bench 2024年05月04日 ・Trial on 10.99.10 ・another version (later trial) to succeed 2024年04月29日 ・dkim 2024年03月10日 ・停電 (瞬電) | ||