|
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 ( つっこみ )
|
最近の日記 2025年02月13日 ・dvipdfmx ICC profile format spec. version 4.3.0 2025年01月29日 ・ham/wsjtx 2025年01月27日 ・wip/wsjtx 5.4.2 2025年01月25日 ・ham/wsjtx 2025年01月15日 ・今更 advent calendar | ||