+ ;; restore margins if needed FIXME: This still fails if the
+ ;; "other" mode has incidentally set margins to exactly what linum
+ ;; had: see bug#20674 for a similar workaround in nlinum.el
+ (let ((set-margins (window-parameter w 'linum--set-margins))
+ (current-margins (window-margins w)))
+ (when (and set-margins
+ (equal set-margins current-margins))
+ (set-window-margins w 0 (cdr current-margins))
+ (set-window-parameter w 'linum--set-margins nil)))))