Re: 分割したウィンドウの大きさをインタラクティヴに変更する

分割したウィンドウの大きさをインタラクティブに変更する - リタマス さんの記事より。



window-resizer を起動して、hjkl 以外のキーを押したとき、そのキーが動作しないのがちょっと気になったので、
昔書いたコードからひっぱってきて合わせてみました。

(defun my-window-resizer ()
  "Control window size and position."
  (interactive)
  (let ((window-obj (selected-window))
        (current-width (window-width))
        (current-height (window-height))
        (dx (if (= (nth 0 (window-edges)) 0) 1
              -1))
        (dy (if (= (nth 1 (window-edges)) 0) 1
              -1))
        action c)
    (catch 'end-flag
      (while t
        (setq action
              (read-key-sequence-vector (format "size[%dx%d]"
                                                (window-width)
                                                (window-height))))
        (setq c (aref action 0))
        (cond ((= c ?l)
               (enlarge-window-horizontally dx))
              ((= c ?h)
               (shrink-window-horizontally dx))
              ((= c ?j)
               (enlarge-window dy))
              ((= c ?k)
               (shrink-window dy))
              ;; otherwise
              (t
               (let ((last-command-char (aref action 0))
                     (command (key-binding action)))
                 (when command
                   (call-interactively command)))
               (message "Quit")
               (throw 'end-flag t)))))))

これで、window-resizer を実行したあとで、C-n とかやったら、無視されずに C-n として動作すると思います。


そんなこんなで。

更新時刻

  • 2010/01/19/21:30