No Such Blog or Diary
リージョンを シェルコマンドの実行結果で置換2
- 2007-01-30 (Tue)
- ソフトウェア ( Meadow/Emacs )
ついでなので,元のリージョンの内容を出力の上部にコメントとして出力するものも作った.
(defun perform-command-region (start end command)
(interactive
(let (string)
(unless (mark)
(error "The mark is not set now, so there is no region"))
;; Do this before calling region-beginning
;; and region-end, in case subprocess output
;; relocates them while we are in the minibuffer.
(setq string (read-from-minibuffer "Shell command on region: "
nil nil nil
'shell-command-history))
;; call-interactively recognizes region-beginning and
;; region-end specially, leaving them in the history.
(list (region-beginning) (region-end) string)))
(let (exit-status)
;; Replace specified region with output from command.
(let ((swap (< start end)))
(goto-char start)
(kill-region start end)
(yank)
(push-mark (point) 'nomsg)
(setq exit-status
;; see describe-function
;; error output is marged into standard output
(call-process-region start end shell-file-name t
(list t t)
nil shell-command-switch command))
;; swap the point and mark if necessary
(and swap (exchange-point-and-mark))
;; mark current position
(setq p1 (point-marker))
(set-marker-insertion-type p1 nil)
;; yank the original contents
(yank nil)
(setq p2 (point-marker))
;; comment the yanked contents
(comment-region (marker-position p1) (marker-position p2))
(setq p1 nil)
(setq p1 nil))
exit-status))
(define-key global-map [(control meta ?!)] 'perform-command-region)
そして C-M-! で発動すると.これって comment-region がない場合にどうなるんだろう?
- Comments: 0
- TrackBack (Close): -
Emacs Lisp の関数定義を探す
- 2007-01-27 (Sat)
- ソフトウェア ( Meadow/Emacs )
describe-function というコマンドで見つかるらしい.
- Comments: 0
- TrackBack (Close): -
MacOS をいじる
サーバのセッティングが仕事として降ってきたのでラックに載せたりしてみた.旧サーバの電源のファン辺りから異音がしているのでさっさと移行しないとやばそうかも.しかしながら,なるべくGUIの設定ツールで設定してくれといわれたため作業進まず.
- Comments: 0
- TrackBack (Close): -
ps2pdf でなく ps2pdf14 を使う
dvipsk と ps2pdf を使って dvi -> ps -> pdf と変換してたらいつの間にか”無効なフォント「MS-Mincho-H」が文書から削除されました”みたいなことを Acrobat が文句たれるようになっていた.この文句がでると文章全体がゴシック体になってしまうらしく困ってたのだが,ps2pdf14 を使って作成する PDF のバージョンを変えたら文句を吐かれないと分かった.何が違うんだろう?
- Comments: 0
- TrackBack (Close): -
MoinMoinWiki で reStructured Text を
- 2006-12-29 (Fri)
- ソフトウェア ( Meadow/Emacs )
MoinMoin wiki で reStructuredText を使うのに Docutils が必要なので落としてきてインストールした.http://docutils.sourceforge.net/ から docutils-snapshot.tgz を落として展開.展開したディレクトリで次のコマンドを実行.これにてインストール完了.
python setup.py install
あとはページ先頭に
#format rst
としていすると reST を使える.
ついでに, アーカイブ内に入ってる docutils\tools\editors\emacs\rst.el を使うとMeadow とかで reSTmode が使えるのでちょっといいかも.微妙にセクション名とかのフォントカラーがあってなかった気もするが...
- Comments: 0
- TrackBack (Close): -
Axis と Axis2
Axis の吐く WSDL だと動くけど Axis2 が吐く WSDL だとうまくスタブが生成されないとかなんとか.面倒だがしょうがないので Axis 用のサービスインストール一式を用意.Axis のデプロイがもう少し楽だといいのだけど… 説明書くのが面倒.
- Comments: 0
- TrackBack (Close): -