6
7

More than 5 years have passed since last update.

emacsの行間隔を変更する

Last updated at Posted at 2016-06-02

webページなどの長い文書を読んでいると目が疲れるので、emacsのフォントサイズを変更したり、各バッファの行間隔をインタラクティブに変更したい。
検索すると似たようなことをやっている記事もあるが、自分なりの設定。

;;; 行間のスペースの設定(バッファローカル)
(defun ls0 (ls)
  (interactive "P")
  (setq line-spacing (if (integerp ls) ls nil)))

(defun ls4 () (interactive) (ls0 4))
(defun ls8 () (interactive) (ls0 8))
(defun ls12 () (interactive) (ls0 12))

(defun ls+ ()
  (interactive)
  (setq line-spacing (+ (or line-spacing 0) 1))
  (redraw-frame))

(defun ls- ()
  (interactive)
  (unless (or (null line-spacing) (<= line-spacing 0))
    (setq line-spacing (- line-spacing 1))
    (redraw-frame)))

(global-set-key "\M-]" 'ls+)
(global-set-key "\M-[" 'ls-)

M-x ls0で隙間なし。
M-x ls4で4ピクセル空ける。以下同様。
数前置子指定可 (M-2 M-0 M-x ls0など)。
M-]で1ピクセルずつ広げる。
M-[で1ピクセルずつ狭める。

参考:
さっとEmacsのフォント・行間のサイズを変更する

6
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
7