[Top][All Lists]

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

[Patch] linum.el

From: kuanyui
Subject: [Patch] linum.el
Date: Wed, 25 Jun 2014 02:46:32 +0800

I make a patch, which add two custom to let user add space before/after
linum. This would make it easier to tell linum from buffer's content.

Take a look of screenshot:

--- linum-original.el   2014-06-25 02:33:16.046174067 +0800
+++ linum.el    2014-06-25 02:32:29.521176023 +0800
@@ -72,6 +72,17 @@
   :group 'linum
   :type 'boolean)
+(defcustom linum-right-space nil
+  "Add a space in right side of linum, to make it easier to tell
+linum from buffer's content."
+  :group 'linum
+  :type 'boolean)
+(defcustom linum-left-space nil
+  "Add a space in left side of linum."
+  :group 'linum
+  :type 'boolean)
 (define-minor-mode linum-mode
   "Toggle display of line numbers in the left margin (Linum mode).
@@ -146,8 +157,10 @@
         (fmt (cond ((stringp linum-format) linum-format)
                    ((eq linum-format 'dynamic)
                     (let ((w (length (number-to-string
-                                      (count-lines (point-min) (point-max))))))
-                      (concat " %" (number-to-string w) "d ")))))
+                                      (count-lines (point-min) (point-max)))))
+                          (r (cond (linum-right-space " ") (t nil)))
+                          (l (cond (linum-left-space " ") (t nil))))
+                      (concat l "%" (number-to-string w) "d" r)))))
         (width 0))
     (run-hooks 'linum-before-numbering-hook)
     ;; Create an overlay (or reuse an existing one) for each

reply via email to

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