bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#12428: 23.4; Add padding for rendering of the line numbers by linum-


From: Sean Perry
Subject: bug#12428: 23.4; Add padding for rendering of the line numbers by linum-mode
Date: Wed, 12 Sep 2012 12:57:08 PDT

I was experiencing the issue discussed here at StackOverflow
http://stackoverflow.com/questions/4920210/what-causes-this-graphical-error-in-emacs-with-linum-mode-on-os-x.
 The
suggestions boil down to a few choices

* stop using dynamic format and explicitly set a format like "%7d ".
  Note the trailing space.
* specify a function to return the format which will include the
  trailing space
* edit the source to ensure a space is added when the line number is
  finally rendered.

I dislike all three choices. Choice 1 will usually eat too much room
on the left. That is why dynamic was created in the first place. The
format handler routine option in Choice 2 is inefficient to implement
since the user will need to basically reimplement the dynamic logic and
this is called for every line in the file. If you follow some of the links on
StackOverflow there are several solutions to this and similar problems
that all reproduce the dynamic logic.

I finally chose to implement a variation of option 3 which is attached as a
patch. Basically it lets the user specify a padding value to added when
the line is rendered. The patch is small, easy for a user to implement
and efficient in execution. It certainly seems easier than the solutions
involving defadvice and the dynamic format logic.

For now I have a fork of linum in my .emacs.d/site-lisp. My patch to
linum is attached. Feel free to change the name of the customization
variable or improve the help text.

Sean

Attachment: linum.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]