[xyzzy:04127] Re: set-buffer で得られるバッファの point など
- Subject: [xyzzy:04127] Re: set-buffer で得られるバッファの point など
- From: Hiroshi Saito <HiroshiSaito@xxxxxxx>
- X-mailer: Becky! ver 1.23
亀井さんこんにちは、サイトウです。
毎度ありがとうございます。
なるほど、 save-excursion が保持するのは、
save-excurionをよんだだ時点でのカレントバッファなのですね。
よく理解していませんでした。
これで、またひとつ利口になりました。
> たぶん。save-excursion は呼んだ時点のカレントバッファ
> のポイントしか戻さないので。
> こうすればカレントバッファが*scratch*でなくてもずれな
> いはずです。
>
> (save-excursion
> (set-buffer "*scratch*")
> (save-excursion
> (goto-line (current-line-number))
> (delete-region (point) (progn (goto-eol) (1+ (point))))
> (insert "new line\n")))
>
>
> # あーでも、いまいち動きが変かも。
え? 試したところでは、うまく行っているような気がしますが。
-----------------------------------
サイトウ ヒロシ
HiroshiSaito@xxxxxxx