all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [Patch] linum.el
@ 2014-06-24 18:45 kuanyui
  2014-06-24 18:56 ` kuanyui
  2014-06-24 19:30 ` Stefan Monnier
  0 siblings, 2 replies; 4+ messages in thread
From: kuanyui @ 2014-06-24 18:45 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 206 bytes --]

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:
http://paste.opensuse.org/93255945


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch file --]
[-- Type: text/x-patch, Size: 1307 bytes --]

--- 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)
+
 ;;;###autoload
 (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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Patch] linum.el
@ 2014-06-24 18:46 kuanyui
  0 siblings, 0 replies; 4+ messages in thread
From: kuanyui @ 2014-06-24 18:46 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 206 bytes --]

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:
http://paste.opensuse.org/93255945


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch file --]
[-- Type: text/x-patch, Size: 1307 bytes --]

--- 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)
+
 ;;;###autoload
 (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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch] linum.el
  2014-06-24 18:45 kuanyui
@ 2014-06-24 18:56 ` kuanyui
  2014-06-24 19:30 ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: kuanyui @ 2014-06-24 18:56 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 415 bytes --]

By the way, may I push a pull request or something?
And license is GPL v3.
Sorry, this is my first time to send patch via mailing list.


2014-06-25 2:45 GMT+08:00 kuanyui <azazabc123@gmail.com>:

> 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:
> http://paste.opensuse.org/93255945
>
>

[-- Attachment #2: Type: text/html, Size: 838 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch] linum.el
  2014-06-24 18:45 kuanyui
  2014-06-24 18:56 ` kuanyui
@ 2014-06-24 19:30 ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2014-06-24 19:30 UTC (permalink / raw)
  To: kuanyui; +Cc: emacs-devel

> 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.

Can't you get the same with `linum-format'?
At least, you can get the same with `nlinum-format' (tho you have to
use `nlinum' for that, but I recommend it).


        Stefan



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-06-24 19:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-24 18:46 [Patch] linum.el kuanyui
  -- strict thread matches above, loose matches on Subject: below --
2014-06-24 18:45 kuanyui
2014-06-24 18:56 ` kuanyui
2014-06-24 19:30 ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.