From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.devel Subject: Re: Patch to highlight current line number [nlinum.el] Date: Tue, 19 Jul 2016 12:40:22 +0000 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113df30e02fc3c0537fc642a X-Trace: ger.gmane.org 1468932052 25561 80.91.229.3 (19 Jul 2016 12:40:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 19 Jul 2016 12:40:52 +0000 (UTC) Cc: code.falling@gmail.com, Emacs developers To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 19 14:40:52 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bPUKQ-00029l-AI for ged-emacs-devel@m.gmane.org; Tue, 19 Jul 2016 14:40:50 +0200 Original-Received: from localhost ([::1]:55599 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPUKK-0004Th-Gd for ged-emacs-devel@m.gmane.org; Tue, 19 Jul 2016 08:40:44 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPUKD-0004TZ-Ae for emacs-devel@gnu.org; Tue, 19 Jul 2016 08:40:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPUK9-0000MW-Ut for emacs-devel@gnu.org; Tue, 19 Jul 2016 08:40:36 -0400 Original-Received: from mail-oi0-x22f.google.com ([2607:f8b0:4003:c06::22f]:33082) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPUK9-0000MH-HO for emacs-devel@gnu.org; Tue, 19 Jul 2016 08:40:33 -0400 Original-Received: by mail-oi0-x22f.google.com with SMTP id j185so23288604oih.0 for ; Tue, 19 Jul 2016 05:40:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9xuLNhjLQ25SQMwiqp4c5SZoZUxf29zGQRZCo9uEo/M=; b=oYq48w5XyRDBZ71gbUes1a1/FEN3oZsjbLzetW7lCo7QjGmBt+xxrpe0LYf/nGRuhd A2VuzU98EchnkC/V9QTFfESV+6z0Ag/IkP+Nj+Jd9Zx7Ls7xZwTLZalJcLzfIszolsfw 4bJW2DtFnn6EYiqsLS1RfuNbspFhMZRgb/8m8oTlmR63mQkXgpEYxWoMC5lXbDwETsiz nQgra4IDVsP6klsbzXIkhf5ZvOBhPr87p8N2jQifpWqTIZapYN4pmyW2mIATRn/Xq1Sm dioWgQIc97hgT5/iUwtRBorI2No/FwtDmFjmxYvoWsVS3VjUehmuaSLGyvEy+EaVfCtG oSUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9xuLNhjLQ25SQMwiqp4c5SZoZUxf29zGQRZCo9uEo/M=; b=U2HuU/NW2vvbqS0pVyfol9GZ1EQMU1A32Lx00uuvKt6tPPqsCp2JHpxONItkNvX3F4 y3+0wQxneNZhkM1wU7BBSQ9WX7YZK1BVIzV/KGUMXxfM8DgedfjHcyeNJlLpQeXYOTEu VO4aDU/SqpfpdI+fYL7IUXfA8dk6izWDBE1aA5c7W6aawKL3DmhAonK9bmKG2AB9UzGL v1Atn1vvyMBjNLbsfrmIxc8ediHrRcpGS0iua7juSo50RPcnJfpzeM0opW2AmJnL+fyG wh6lki5PuP7s0sLNzmvXW2NjTpDqbjKAjf9SEtai84YT5HkLOFOH3J9ITTmfSKIgL68w YYhw== X-Gm-Message-State: ALyK8tJSQrstaXtEwncHOxtk1lfw0U4Vf6ykeWI+gk+y0sWGPNAjO4QxaxSe6aAZnyjnz8U0mDSW+J1Obyed+A== X-Received: by 10.202.207.17 with SMTP id f17mr19457996oig.52.1468932032754; Tue, 19 Jul 2016 05:40:32 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::22f X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:205840 Archived-At: --001a113df30e02fc3c0537fc642a Content-Type: text/plain; charset=UTF-8 On Tue, Jul 19, 2016 at 8:28 AM Stefan Monnier wrote: > > I need the line-diff to get the line begin/end positions for the > last-line. > > Exactly: if you have a marker showing you where is that "last-line", you > don't need the line-diff. If you really want the beg/end of that line, > you `goto-char' to that marker and then use line-beginning-position and > line-end-position from there with no argument. > Got it. I will work on that optimization as soon as I get chance. > Oh, the gloabl-nlinum-mode was missing a ":group 'linum" argument! > OK, I added ":group 'nlinum" in the latest patch now. > > ===== patch follows > > Please install it, and thank you very much. The final (for now) patch is below. Thanks for all your help. Can you please commit it? I do not have commit rights, but my copyright assignment is on file. ===== >From c9c5e4a5a158cde292353ba8e0669e5877365a5a Mon Sep 17 00:00:00 2001 From: Kaushal Modi Date: Mon, 18 Jul 2016 17:42:45 -0400 Subject: [PATCH] Add ability to highlight current line number * nlinum.el (nlinum-highlight-current-line): New defcustom to enable highlighting current line number when non-nil (default is nil). (nlinum-current-line): New face for highlighting the current line number. --- packages/nlinum/nlinum.el | 90 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 78 insertions(+), 12 deletions(-) diff --git a/packages/nlinum/nlinum.el b/packages/nlinum/nlinum.el index 98c9cbc..0e7cf06 100644 --- a/packages/nlinum/nlinum.el +++ b/packages/nlinum/nlinum.el @@ -4,7 +4,7 @@ ;; Author: Stefan Monnier ;; Keywords: convenience -;; Version: 1.6 +;; Version: 1.7 ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -26,6 +26,11 @@ ;;; News: +;; v1.7: +;; - Add ability to highlight current line number. +;; - New custom variable `nlinum-highlight-current-line' and +;; face `nlinum-current-line'. + ;; v1.3: ;; - New custom variable `nlinum-format'. ;; - Change in calling convention of `nlinum-format-function'. @@ -36,11 +41,32 @@ ;;; Code: -(require 'linum) ;For its face. +(require 'linum) ; for its face + +(defgroup nlinum nil + "Show line numbers in the margin, (hopefully) more efficiently." + :group 'convenience + :prefix "nlinum") + +(defcustom nlinum-highlight-current-line nil + "Whether the current line number should be highlighted. +When non-nil, the current line number is highlighted in `nlinum-current-line' +face. " + :group 'nlinum + :type 'boolean) + +(defface nlinum-current-line + '((t :inherit linum :weight bold)) + "Face for displaying current line." + :group 'nlinum) (defvar nlinum--width 2) (make-variable-buffer-local 'nlinum--width) +(defvar nlinum--current-line 0 + "Store current line number.") +(make-variable-buffer-local 'nlinum--current-line) + ;; (defvar nlinum--desc "") ;;;###autoload @@ -53,9 +79,10 @@ if ARG is omitted or nil. Linum mode is a buffer-local minor mode." :lighter nil ;; (" NLinum" nlinum--desc) (jit-lock-unregister #'nlinum--region) - (remove-hook 'window-configuration-change-hook #'nlinum--setup-window t) - (remove-hook 'text-scale-mode-hook #'nlinum--setup-window t) - (remove-hook 'after-change-functions #'nlinum--after-change t) + (remove-hook 'window-configuration-change-hook #'nlinum--setup-window :local) + (remove-hook 'text-scale-mode-hook #'nlinum--setup-window :local) + (remove-hook 'after-change-functions #'nlinum--after-change :local) + (remove-hook 'post-command-hook #'nlinum--current-line-update :local) (kill-local-variable 'nlinum--line-number-cache) (remove-overlays (point-min) (point-max) 'nlinum t) ;; (kill-local-variable 'nlinum--ol-counter) @@ -64,10 +91,13 @@ Linum mode is a buffer-local minor mode." ;; FIXME: Another approach would be to make the mode permanent-local, ;; which might indeed be preferable. (add-hook 'change-major-mode-hook (lambda () (nlinum-mode -1))) - (add-hook 'text-scale-mode-hook #'nlinum--setup-window nil t) - (add-hook 'window-configuration-change-hook #'nlinum--setup-window nil t) - (add-hook 'after-change-functions #'nlinum--after-change nil t) - (jit-lock-register #'nlinum--region t)) + (add-hook 'text-scale-mode-hook #'nlinum--setup-window nil :local) + (add-hook 'window-configuration-change-hook #'nlinum--setup-window nil :local) + (add-hook 'after-change-functions #'nlinum--after-change nil :local) + (if nlinum-highlight-current-line + (add-hook 'post-command-hook #'nlinum--current-line-update nil :local) + (remove-hook 'post-command-hook #'nlinum--current-line-update :local)) + (jit-lock-register #'nlinum--region :contextual)) (nlinum--setup-windows)) (defun nlinum--face-height (face) @@ -131,6 +161,35 @@ Linum mode is a buffer-local minor mode." (point-min) (point-max) '(fontified))))) (current-buffer))) +(defun nlinum--current-line-update () + "Update current line number." + (let ((last-line nlinum--current-line)) + (setq nlinum--current-line (save-excursion + (unless (bolp) + (forward-line 0)) + (nlinum--line-number-at-pos))) + + (let ((line-diff (- last-line nlinum--current-line)) + beg end) + ;; Remove the text properties only if the current line has changed + (when (not (zerop line-diff)) + ;; If point is moving upwards + (if (natnump line-diff) + (progn + (setq beg (line-beginning-position)) ; beginning of the current line + (setq end (line-end-position (1+ line-diff))) ; end of the last line + ;; Handle the case of blank lines too. + (setq end (min (point-max) (1+ end)))) + ;; If point is moving downwards + (setq beg (line-beginning-position (1+ line-diff))) ; beginning of the last line + (setq end (line-end-position)) ; end of the current line + ;; Handle the case of blank lines too. + (setq end (min (point-max) (1+ end)))) + ;; (message "curr-line:%d [beg/end:%d/%d] -- last-line:%d" + ;; nlinum--current-line beg end last-line) + (with-silent-modifications + (remove-text-properties beg end '(fontified))))))) + ;; (defun nlinum--ol-count () ;; (let ((i 0)) ;; (dolist (ol (overlays-in (point-min) (point-max))) @@ -215,11 +274,17 @@ Used by the default `nlinum-format-function'." (defvar nlinum-format-function (lambda (line width) - (let ((str (format nlinum-format line))) + (let* ((is-current-line (= line nlinum--current-line)) + (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) + (put-text-property 0 width 'face + (if (and nlinum-highlight-current-line + is-current-line) + 'nlinum-current-line + '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 @@ -260,7 +325,8 @@ it may cause the margin to be resized and line numbers to be recomputed.") ;;;###autoload (define-globalized-minor-mode global-nlinum-mode nlinum-mode - (lambda () (unless (minibufferp) (nlinum-mode)))) + (lambda () (unless (minibufferp) (nlinum-mode))) + :group 'nlinum) (provide 'nlinum) ;;; nlinum.el ends here -- 2.6.0.rc0.24.gec371ff -- Kaushal Modi --001a113df30e02fc3c0537fc642a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Tue, Jul 19= , 2016 at 8:28 AM Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> I need the line-diff to get the line begin/end positions fo= r the last-line.

Exactly: if you have a marker showing you where is that "last-line&quo= t;, you
don't need the line-diff.=C2=A0 If you really want the beg/end of that = line,
you `goto-char' to that marker and then use line-beginning-position and=
line-end-position from there with no argument.

Got it. I will work on that optimization as soon as I get chance.
=C2=A0
Oh, the gloabl-nlinum-mode was missing a ":group 'linum" argu= ment!

OK, I added ":group 'nli= num" in the latest patch now.
=C2=A0
> =3D=3D=3D=3D=3D patch follows

Please install it, and thank you very much.

The final (for now) patch is below. Thanks for all your help. Can you plea= se commit it? I do not have commit rights, but my copyright assignment is o= n file.

=3D=3D=3D=3D=3D
From c9c5e4a5a15= 8cde292353ba8e0669e5877365a5a Mon Sep 17 00:00:00 2001
From: Kaus= hal Modi <kaushal.modi@gmail.c= om>
Date: Mon, 18 Jul 2016 17:42:45 -0400
Subjec= t: [PATCH] Add ability to highlight current line number

* nlinum.el (nlinum-highlight-current-line): New defcustom to enable<= /div>
= highlighting current line number when non-nil (default is nil).
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 (nlinum-current-line): New face for highlightin= g the current
line number.
---
=C2=A0packages/nlinum/nl= inum.el | 90 ++++++++++++++++++++++++++++++++++++++++-------
=C2= =A01 file changed, 78 insertions(+), 12 deletions(-)

diff --git a/packages/nlinum/nlinum.el b/packages/nlinum/nlinum.el
=
index 98c9cbc..0e7cf06 100644
--- a/packages/nlinum/nlinum.e= l
+++ b/packages/nlinum/nlinum.el
@@ -4,7 +4,7 @@
=
=C2=A0
=C2=A0;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
=C2= =A0;; Keywords: convenience
-;; Version: 1.6
+;; Versio= n: 1.7
=C2=A0
=C2=A0;; This program is free software; y= ou can redistribute it and/or modify
=C2=A0;; it under the terms = of the GNU General Public License as published by
@@ -26,6 +26,11= @@
=C2=A0
=C2=A0;;; News:
=C2=A0
+= ;; v1.7:
+;; - Add ability to highlight current line number.
+;; - New custom variable `nlinum-highlight-current-line' and
+;; =C2=A0 face `nlinum-current-line'.
+
=C2= =A0;; v1.3:
=C2=A0;; - New custom variable `nlinum-format'.
=C2=A0;; - Change in calling convention of `nlinum-format-function= '.
@@ -36,11 +41,32 @@
=C2=A0
=C2=A0;;; C= ode:
=C2=A0
-(require 'linum) =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;For its face= .
+(require 'linum) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0; for its face
+
<= div>+(defgroup nlinum nil
+ =C2=A0"Show line numbers in the = margin, (hopefully) more efficiently."
+ =C2=A0:group 'c= onvenience
+ =C2=A0:prefix "nlinum")
+
<= div>+(defcustom nlinum-highlight-current-line nil
+ =C2=A0"W= hether the current line number should be highlighted.
+When non-n= il, the current line number is highlighted in `nlinum-current-line'
+face. "
+ =C2=A0:group 'nlinum
+ =C2= =A0:type 'boolean)
+
+(defface nlinum-current-line<= /div>
+ =C2=A0'((t :inherit linum :weight bold))
+ =C2=A0= "Face for displaying current line."
+ =C2=A0:group '= ;nlinum)
=C2=A0
=C2=A0(defvar nlinum--width 2)
=C2=A0(make-variable-buffer-local 'nlinum--width)
=C2=A0
+(defvar nlinum--current-line 0
+ =C2=A0"Store curre= nt line number.")
+(make-variable-buffer-local 'nlinum--= current-line)
+
=C2=A0;; (defvar nlinum--desc "&qu= ot;)
=C2=A0
=C2=A0;;;###autoload
@@ -53,9 +79= ,10 @@ if ARG is omitted or nil.
=C2=A0Linum mode is a buffer-loc= al minor mode."
=C2=A0 =C2=A0:lighter nil ;; (" NLinum&= quot; nlinum--desc)
=C2=A0 =C2=A0(jit-lock-unregister #'nlinu= m--region)
- =C2=A0(remove-hook 'window-configuration-change-= hook #'nlinum--setup-window t)
- =C2=A0(remove-hook 'text= -scale-mode-hook #'nlinum--setup-window t)
- =C2=A0(remove-ho= ok 'after-change-functions #'nlinum--after-change t)
+ = =C2=A0(remove-hook 'window-configuration-change-hook #'nlinum--setu= p-window :local)
+ =C2=A0(remove-hook 'text-scale-mode-hook #= 'nlinum--setup-window :local)
+ =C2=A0(remove-hook 'after= -change-functions #'nlinum--after-change :local)
+ =C2=A0(rem= ove-hook 'post-command-hook #'nlinum--current-line-update :local)
=C2=A0 =C2=A0(kill-local-variable 'nlinum--line-number-cache)<= /div>
=C2=A0 =C2=A0(remove-overlays (point-min) (point-max) 'nlinum= t)
=C2=A0 =C2=A0;; (kill-local-variable 'nlinum--ol-counter)=
@@ -64,10 +91,13 @@ Linum mode is a buffer-local minor mode.&quo= t;
=C2=A0 =C2=A0 =C2=A0;; FIXME: Another approach would be to mak= e the mode permanent-local,
=C2=A0 =C2=A0 =C2=A0;; which might in= deed be preferable.
=C2=A0 =C2=A0 =C2=A0(add-hook 'change-maj= or-mode-hook (lambda () (nlinum-mode -1)))
- =C2=A0 =C2=A0(add-ho= ok 'text-scale-mode-hook #'nlinum--setup-window nil t)
- = =C2=A0 =C2=A0(add-hook 'window-configuration-change-hook #'nlinum--= setup-window nil t)
- =C2=A0 =C2=A0(add-hook 'after-change-fu= nctions #'nlinum--after-change nil t)
- =C2=A0 =C2=A0(jit-loc= k-register #'nlinum--region t))
+ =C2=A0 =C2=A0(add-hook '= ;text-scale-mode-hook #'nlinum--setup-window nil :local)
+ = =C2=A0 =C2=A0(add-hook 'window-configuration-change-hook #'nlinum--= setup-window nil :local)
+ =C2=A0 =C2=A0(add-hook 'after-chan= ge-functions #'nlinum--after-change nil :local)
+ =C2=A0 =C2= =A0(if nlinum-highlight-current-line
+ =C2=A0 =C2=A0 =C2=A0 =C2= =A0(add-hook 'post-command-hook #'nlinum--current-line-update nil := local)
+ =C2=A0 =C2=A0 =C2=A0(remove-hook 'post-command-hook = #'nlinum--current-line-update :local))
+ =C2=A0 =C2=A0(jit-lo= ck-register #'nlinum--region :contextual))
=C2=A0 =C2=A0(nlin= um--setup-windows))
=C2=A0
=C2=A0(defun nlinum--face-he= ight (face)
@@ -131,6 +161,35 @@ Linum mode is a buffer-local min= or mode."
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (point-min) (point-max) '(fon= tified)))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(current-buffer)))
=C2=A0
+(defun nlin= um--current-line-update ()
+ =C2=A0"Update current line numb= er."
+ =C2=A0(let ((last-line nlinum--current-line))
+ =C2=A0 =C2=A0(setq nlinum--current-line (save-excursion
+ = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (unless (bolp)
+ =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (forward-line 0))
+ =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (nlinum--line-number-at-pos)))
+<= /div>
+ =C2=A0 =C2=A0(let ((line-diff (- last-line nlinum--current-line= ))
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0beg end)
+ =C2= =A0 =C2=A0 =C2=A0;; Remove the text properties only if the current line has= changed
+ =C2=A0 =C2=A0 =C2=A0(when (not (zerop line-diff))
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0;; If point is moving upwards
= + =C2=A0 =C2=A0 =C2=A0 =C2=A0(if (natnump line-diff)
+ =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(progn
+ =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(setq beg (line-beginning-position)) ; beginning of= the current line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(setq end (line-end-position (1+ line-diff))) ; end of the last line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; Handle the case= of blank lines too.
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(setq end (min (point-max) (1+ end))))
+ =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0;; If point is moving downwards
+ =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(setq beg (line-beginning-position (1+ line-diff))) ; b= eginning of the last line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(se= tq end (line-end-position)) ; end of the current line
+ =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0;; Handle the case of blank lines too.
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq end (min (point-max) (1+ end))))=
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0;; (message "curr-line:%d [beg= /end:%d/%d] -- last-line:%d"
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0;;= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0nlinum--current-line beg end last-line)<= /div>
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0(with-silent-modifications
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(remove-text-properties beg end '(= fontified)))))))
+
=C2=A0;; (defun nlinum--ol-count ()<= /div>
=C2=A0;; =C2=A0 (let ((i 0))
=C2=A0;; =C2=A0 =C2=A0 (do= list (ol (overlays-in (point-min) (point-max)))
@@ -215,11 +274,1= 7 @@ Used by the default `nlinum-format-function'."
=C2= =A0
=C2=A0(defvar nlinum-format-function
=C2=A0 =C2=A0(= lambda (line width)
- =C2=A0 =C2=A0(let ((str (format nlinum-form= at line)))
+ =C2=A0 =C2=A0(let* ((is-current-line (=3D line nlinu= m--current-line))
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (str (form= at nlinum-format line)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0(when (< (= length str) width)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; Left pad = to try and right-align the line-numbers.
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(setq str (concat (make-string (- width (length str)) ?\ ) str)))=
- =C2=A0 =C2=A0 =C2=A0(put-text-property 0 width 'face '= linum str)
+ =C2=A0 =C2=A0 =C2=A0(put-text-property 0 width '= face
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (and nlinum-highlight-current-line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0is-current-line)
= + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 'nlinum-current-line
+ =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 'linum)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 str)
=C2=A0 =C2=A0 =C2=A0 = =C2=A0str))
=C2=A0 =C2=A0"Function to build the string repre= senting the line number.
=C2=A0Takes 2 arguments LINE and WIDTH, = both of them numbers, and should return
@@ -260,7 +325,8 @@ it ma= y cause the margin to be resized and line numbers to be recomputed.")<= /div>
=C2=A0
=C2=A0;;;###autoload
=C2=A0(define-glo= balized-minor-mode global-nlinum-mode nlinum-mode
- =C2=A0(lambda= () (unless (minibufferp) (nlinum-mode))))
+ =C2=A0(lambda () (un= less (minibufferp) (nlinum-mode)))
+ =C2=A0:group 'nlinum)
=C2=A0
=C2=A0(provide 'nlinum)
=C2=A0;;; nl= inum.el ends here
--=C2=A0
2.6.0.rc0.24.gec371ff
<= div>
=C2=A0
--

Kaush= al Modi

--001a113df30e02fc3c0537fc642a--