widen-window.elをインストールしてみた+パッチ

widen-window.el をリリース - 日記を書く [・w・] はやみずさん

(install-elisp "http://coderepos.org/share/browser/lang/elisp/widen-window-mode/trunk/widen-window.el?format=txt" "widen-window.el")

Emacsで画面を2分割や3分割して作業をしている人は多いと思うのですが、ディスプレイが小さ い場合に1つのバッファが表示される領域(Emacsの用語でwindowという)が小さくなってしまい 、作業しづらくてイライラする!ということはないでしょうか。

大あり。

ウィンドウを分割していると、どうしても狭いウィンドウで作業しないといけない。このイライラを解消するEmacs Lisp。フォーカスのあるウィンドウが選択されたら自動的に大きくなるやつ。よさげ。さっそくインストール。

ww-rationで拡大する割合を指定できる。デフォルトじゃちょっと小さめだったので0.75にしてみた。さらに、mode-lineの" WidenWindow"が長すぎるのでdiminishで短くしてみた。

(require 'widen-window)
(setq ww-ratio 0.75)
(global-widen-window-mode 1)
(diminish 'widen-window-mode " WW")

俺はwindows.el + ratpoisonなのでフレームいっぱいに開くのがデフォなのだが、これがあると少しはウィンドウ分割してみようかなという気になれた。

バイトコンパイルの警告をある程度潰しておいた。→本家に反映された

--- widen-window.el	2008/11/13 11:26:05	1.1
+++ widen-window.el	2008/11/13 11:27:16
@@ -43,6 +43,7 @@
 
 ;;; Code:
 
+(eval-when-compile (require 'cl))
 (defgroup widen-window nil
   "Widen selected window"
   :group 'convenience
@@ -147,6 +148,7 @@
 	   (not (memq major-mode ww-nonwide-modes)))
       (widen-window-mode t)))
 
+(defvar global-widen-window-mode nil)
 (if (fboundp 'define-global-minor-mode)
     (define-global-minor-mode global-widen-window-mode
       widen-window-mode widen-window-mode-maybe

それでもいくつか出るなぁ。うーん。「(fboundp 'define-global-minor-mode)」のチェックってはたして必要なのかな?定義されていないemacsenってどれだろうか。

In toplevel form:
widen-window.el:152:15:Warning: `make-variable-buffer-local' should be called
    at toplevel

In end of data:
widen-window.el:173:1:Warning: the function
    `global-widen-window-mode-enable-in-buffers' is not known to be defined.
Wrote /m/home/rubikitch/emacs/lisp/widen-window.elc

[2008/11/14]追記:anything.elとの相性問題を解決

anything.elとの相性が悪いようなのでアドバイスを定義してみた。

(defadvice anything (around disable-ww-mode activate)
  (ad-deactivate-regexp "widen-window")
  (unwind-protect
      ad-do-it
    (ad-activate-regexp "widen-window")))