2011/01/27

frame-arrange.el 設定例(再)

自分用の設定がまた変わったので、のせておきます。
(require 'frame-arrange)
(frame-arrange-mode t)

;; key-map - 「control + shift + 矢印 」で少しずつ位置を変更する
(define-key global-map [(C shift down)]
  'frange:increment-position-top/current-frame)
(define-key global-map [(C shift up)]
  'frange:increment-position-bottom/current-frame)
(define-key global-map [(C shift left)]
  'frange:increment-position-right/current-frame)
(define-key global-map [(C shift right)]
  'frange:increment-position-left/current-frame)

;; key-chord.el を使用した位置の変更
;; ;; (auto-install-from-emacswiki "key-chord.el")
;; (require 'key-chord nil t)
;; (setq key-chord-two-keys-delay 0.04)
;; (key-chord-mode 1)
(key-chord-define-global "qw" 'frange:arrange/top-left-most/current-frame)
(key-chord-define-global "we" 'frange:arrange/top-most/current-frame)
(key-chord-define-global "er" 'frange:arrange/top-right-most/current-frame)
(key-chord-define-global "as" 'frange:arrange/left-most/current-frame)
(key-chord-define-global "df" 'frange:arrange/right-most/current-frame)
(key-chord-define-global "zx" 'frange:arrange/bottom-left-most/current-frame)
(key-chord-define-global "xc" 'frange:arrange/bottom-most/current-frame)
(key-chord-define-global "cv" 'frange:arrange/bottom-right-most/current-frame)

;; 名前を付けて保存してある設定を復元する
;; この場合 min, max という名前で保存してある設定
(define-key global-map (kbd "C-c m")
  #'(lambda ()
      (interactive)
      (frange:restore-frame-position-parameter
       (selected-frame)
       'min)))

(define-key global-map (kbd "C-c M")
  #'(lambda ()
      (interactive)
      (frange:restore-frame-position-parameter
       (selected-frame)
       'max)))

;; 移動距離を設定する
(setq frange:position-incremental-value 10)

;; サイズを変更する関数を生成する
(def:frange/current-frame increment-size-top
  (nil height #'(lambda (v frame)
               (+ v frange:size-incremental-value))))
(def:frange/current-frame decrement-size-top
  (nil height #'(lambda (v frame)
               (- v frange:size-incremental-value))))
(def:frange/current-frame increment-size-left
  (nil width #'(lambda (v frame)
               (+ v frange:size-incremental-value))))
(def:frange/current-frame decrement-size-left
  (nil width #'(lambda (v frame)
               (- v frange:size-incremental-value))))

;; 「Alt + 矢印」でサイズを変更する
(define-key global-map [(M down)]
  'frange:increment-size/current-frame)
(define-key global-map [(M up)]
  'frange:decrement-size/current-frame)
(define-key global-map [(M down)]
  'frange:increment-size-top/current-frame)
(define-key global-map [(M up)]
  'frange:decrement-size-top/current-frame)
(define-key global-map [(M right)]
  'frange:increment-size-left/current-frame)
(define-key global-map [(M left)]
  'frange:decrement-size-left/current-frame)

;; M-x から呼ぶので短かい名前の関数でラップ
;; regist
(defun my-reg-frame ()
  (interactive)
  (frange:regist-frame-position-parameter-interactive))

;; restore
(defun my-res-frame ()
  (interactive)
  (frange:restore-frame-position-parameter-interactive))

;; remove
(defun my-rem-frame ()
  (interactive)
  (frange:remove-arrange-config-alist-interactive))

(defun my-print-frange ()
  (interactive)
  (frange:print-frame-position-parameter/current-frame))

(defun my-print-frange-n ()
  (interactive)
  (frange:print-arrange-config-names))

(defun my-print-frange-e ()
  (interactive)
  (frange:print-arrange-config-alist-entries))

;; F12 連打で保存してある設定(位置とサイズ)を順番に適用する
(define-key global-map [f12]
  (frange:cycle-arrange-config-gen))
設定(位置とサイズ)の保存は frange:regist-frame-position-parameter-interactive から。


入門 GNU Emacs 第3版

0 件のコメント:

コメントを投稿