Subject: linum-mode overwrites existing margin width

From: "Paul W. Rankin" <[email-masked]>
Date: Wed, 27 May 2015 17:56:03 +1000

I set the window left margin to 25 columns, then activated linum-mode,
which sets the left margin to 3 columns (to accommodate the number of
figures in the total line numbers).

Expected behaviour:

linum-mode should only expand left margin as needed, not
overwrite/shrink it.

Example steps to reproduce:

$ emacs -Q

;; in *scratch* buffer

M-: (set-window-margins (selected-window) N) ;; where N is any number > 1

;; window margins are set to N columns.

M-x linum-mode

;; left window margin is reduced to 1 column

Suggestions to remedy:

Either linum-mode.el ~ L167 should be changed to accommodate existing
margin width, setting width to the maximum of existing or calculated
value, or the function should test whether the calculated width exceeds
the current margin width, and only update the window if necessary.