all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: kuanyui <azazabc123@gmail.com>
To: emacs-devel@gnu.org
Subject: [Patch] linum.el
Date: Wed, 25 Jun 2014 02:45:31 +0800	[thread overview]
Message-ID: <87ha3arvsk.fsf@kuanyui-laptop.site> (raw)

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

             reply	other threads:[~2014-06-24 18:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-24 18:45 kuanyui [this message]
2014-06-24 18:56 ` [Patch] linum.el kuanyui
2014-06-24 19:30 ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2014-06-24 18:46 kuanyui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ha3arvsk.fsf@kuanyui-laptop.site \
    --to=azazabc123@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.