Hatena::ブログ(Diary)

ヒルズで働くholidays-lの技ログ このページをアンテナに追加 RSSフィード Twitter

2010年10月16日

[]windows.elのsee-you-again上書きをdefadviceで書き換える

自分のinit.el見てたら

(defun see-you-again ()
  "Save all of the window configurations if you say yes, and kill-emacs."
  (interactive)
  (when win:current-config
    (if (yes-or-no-p "Save All Configurations? ")
        (win-save-all-configurations))
    (save-buffers-kill-emacs)))

ってのがC-x C-cに割り当てられていて、

てっきり独自の関数かと思ってたらwindows.elでdefunされてるやつを上書きしてたみたい。


調べたら何かみんな同じようなコードで上書きしてるんだけど、

これってdefadviceでいいんじゃないの?って思って書き直した。

(defadvice see-you-again (around see-you-again-around activate)
  "Save all of the window configurations if you say yes, and kill-emacs."
  (if (yes-or-no-p "Save All Configurations? ") ad-do-it)
  (save-buffers-kill-emacs))

これがベストかどうかは知らない。皆上書きしてるから何か理由があるのかなぁと思ったり。

Emacs先生が周りにいないのです。id:odz先生〜)

スパム対策のためのダミーです。もし見えても何も入力しないでください
ゲスト


画像認証

トラックバック - http://d.hatena.ne.jp/holidays-l/20101016/p1