PIYO - Tech & Life -

Emacs26のdisplay-line-numbers-modeがlinum-modeよりちょっと速くて快適になりそう

Emacs

先日Emacsを26系にアップしました↓↓

Emacsを24.5から26.1にアップデートした - PIYO - Tech & Life -
長いこと古めのバージョンの24.5を使っていたようなのでEmacsのアップデートを試みました。もはや新機能とか把握していませんが、まあ、なんか良くなっているだろうという期待をこめて。 こちらによると24

どんな変更があるのかなとNEWSを眺めていると、こんな記述が↓↓。

** Emacs now supports optional display of line numbers in the buffer.
This is similar to what 'linum-mode' provides, but much faster and
doesn't usurp the display margin for the line numbers.  Customize the
buffer-local variable 'display-line-numbers' to activate this optional
display.  Alternatively, you can use the 'display-line-numbers-mode'
minor mode or the global 'global-display-line-numbers-mode'.  When
using these modes, customize 'display-line-numbers-type' with the same
value as you would use with 'display-line-numbers'.

平たく言うとlinum-modeより速い行番号表示ができるようになったよ、とのこと。

これまではlinum-modeってのを使えば行番号表示ができていたのですが、数千行(いや数百行でも?)ぐらいのファイルを開くと異様に重くなるのでした。そういうときは行番号表示をやめるとまともにスクロールできるので、時折切り替えながら使っていました。

Emacs 26.1ではdisplay-line-numbers-modeを有効にすることで新しい行番号表示を使うことができます。

僕は起動時にグローバルに有効にしたい派なので、initにglobal-display-line-numbers-modeを書いておくようにしました。

しばらくこれで様子見。