$ brew install --use-llvm gauche
2013年2月7日木曜日
homebrewでgaucheをインストールする
何度も忘れてるので自分メモを兼ねて。
gaucheをインストールする際、mountain lionでは「--use-llvm」を付けないとうまくいかない。
フォントサイズを変更してもウインドウサイズが変わらないようにする
何いってるのかさっぱりわからん人も多いかと思いますが、Emacsを、Cygwinのminttyみたいに、フォントサイズをキーボードで変更してもウインドウサイズが変わらないようにするための設定を行なってみました。
以下のコードを.emacsのどっかに貼り付けるか、独立したファイルにしてrequireすれば良いです。
UbuntuやCentOS,OSXではうまく動いています。
NTEmacsだとなぜか微妙にウインドウサイズが変わっていってヤな感じ。
;;; -*- syntax: emacs-lisp; coding: iso-2022-jp-unix; -*-
;; フォントサイズを変更する
;; Emacsではフレームのサイズをピクセル単位で指定できない。
;; そのため、frame-parametersに
;; current-pixel-width-marginと
;; current-pixel-height-margin
;; という2つの属性を追加し、目標とするサイズと実際に設定されたサイズの誤差を記録しておく
;; 次回にサイズを設定するときにこれらの属性を用いて目標サイズを修正することで、
;; フォントサイズを変更してもEmacsのframeサイズがほぼ変化しないようにする。
;; *手動でframeサイズを変更した時に、以前の誤差が適用されてしまうのは許容する*
(defun change-font-size(sizediff)
(if window-system
((lambda ()
;; frame-parametersにcurrent-pixel-width-marginとcurrent-pixel-height-marginがなかったら0を設定する
(if (or (not (cdr (assoc 'current-pixel-width-margin (frame-parameters (selected-frame)))))
(not (cdr (assoc 'current-pixel-height-margin (frame-parameters (selected-frame))))))
(modify-frame-parameters (selected-frame)
(list '(current-pixel-width-margin . 0)
'(current-pixel-height-margin . 0))))
;; minttyみたいにフォントサイズを変更してもframeのサイズが変らないようにする
((lambda (current-pixel-width current-pixel-height)
;; フォントサイズ変更
(set-face-attribute 'default (selected-frame) :height
((lambda (current new) (if (<= new 0) height new))
(face-attribute 'default :height)
(+ sizediff (face-attribute 'default :height))))
;; フレームサイズ調整
(set-frame-size (selected-frame)
(/ current-pixel-width (frame-char-width))
(/ current-pixel-height (frame-char-height)))
;; 調整誤差をcurrent-pixel-width-marginとcurrent-pixel-height-marginに記録しておく
(modify-frame-parameters (selected-frame)
(list (cons 'current-pixel-width-margin (- current-pixel-width (frame-pixel-width)))
(cons 'current-pixel-height-margin (- current-pixel-height (frame-pixel-height))))))
;; current-pixel-width-marginとcurrent-pixel-height-marginを加味してフレームサイズを調整する
(+ (frame-pixel-width) (cdr (assoc 'current-pixel-width-margin (frame-parameters (selected-frame)))))
(+ (frame-pixel-height) (cdr (assoc 'current-pixel-height-margin (frame-parameters (selected-frame))))))))))
(defun increase-font-size ()
(interactive)
(change-font-size 10))
(defun decrease-font-size ()
(interactive)
(change-font-size -10))
(global-set-key [C-mouse-4] 'increase-font-size)
(global-set-key [C-wheel-up] 'increase-font-size)
(global-set-key [C-mouse-5] 'decrease-font-size)
(global-set-key [C-wheel-down] 'decrease-font-size)
(define-key global-map (kbd "C-+") 'increase-font-size)
(define-key global-map (kbd "C--") 'decrease-font-size)
登録:
コメント (Atom)