+(defcustom nlinum-format "%d"
+ "Format of the line numbers.
+Used by the default `nlinum-format-function'."
+ :type 'string
+ :group 'linum)
+
+(defvar nlinum-format-function
+ (lambda (line width)
+ (let ((str (format nlinum-format line)))
+ (when (< (length str) width)
+ ;; Left pad to try and right-align the line-numbers.
+ (setq str (concat (make-string (- width (length str)) ?\ ) str)))
+ (put-text-property 0 width 'face 'linum str)
+ str))
+ "Function to build the string representing the line number.
+Takes 2 arguments LINE and WIDTH, both of them numbers, and should return
+a string. WIDTH is the ideal width of the result. If the result is larger,
+it may cause the margin to be resized and line numbers to be recomputed.")
+