Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Brady Love
committed
Mar 21, 2015
1 parent
626ff8c
commit 71b7c37
Showing
3 changed files
with
84 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,47 @@ | ||
(global-linum-mode t) | ||
(setq linum-last-pos 0) | ||
;; (global-linum-mode t) | ||
;; (setq linum-last-pos 0) | ||
|
||
(eval-after-load "linum" | ||
'(defun linum-update (buffer) | ||
"Update line numbers for all windows displaying BUFFER." | ||
;; this is only change but couldn't find better way to do it, tried | ||
;; linum-before-update-hook but it runs in an excursion so I couldn't get | ||
;; current line number | ||
(setq linum-last-pos (line-number-at-pos)) | ||
(with-current-buffer buffer | ||
(when linum-mode | ||
(setq linum-available linum-overlays) | ||
(setq linum-overlays nil) | ||
(save-excursion | ||
(mapc #'linum-update-window | ||
(get-buffer-window-list buffer nil 'visible))) | ||
(mapc #'delete-overlay linum-available) | ||
(setq linum-available nil))))) | ||
;; (eval-after-load "linum" | ||
;; '(defun linum-update (buffer) | ||
;; "Update line numbers for all windows displaying BUFFER." | ||
;; ;; this is only change but couldn't find better way to do it, tried | ||
;; ;; linum-before-update-hook but it runs in an excursion so I couldn't get | ||
;; ;; current line number | ||
;; (setq linum-last-pos (line-number-at-pos)) | ||
;; (with-current-buffer buffer | ||
;; (when linum-mode | ||
;; (setq linum-available linum-overlays) | ||
;; (setq linum-overlays nil) | ||
;; (save-excursion | ||
;; (mapc #'linum-update-window | ||
;; (get-buffer-window-list buffer nil 'visible))) | ||
;; (mapc #'delete-overlay linum-available) | ||
;; (setq linum-available nil))))) | ||
|
||
(defface linum-zero | ||
'((t :inherit linum :foreground "white" :background "#FF0000" :weight bold)) | ||
"Face for displaying line number 0" | ||
:group 'linum) | ||
;; (defface linum-zero | ||
;; '((t :inherit linum :foreground "white" :background "#FF0000" :weight bold)) | ||
;; "Face for displaying line number 0" | ||
;; :group 'linum) | ||
|
||
(defface linum-top | ||
'((t :inherit linum :foreground "grey80" :background "grey40" :weight bold)) | ||
"Face for displaying top line number" | ||
:group 'linum) | ||
;; (defface linum-top | ||
;; '((t :inherit linum :foreground "grey80" :background "grey40" :weight bold)) | ||
;; "Face for displaying top line number" | ||
;; :group 'linum) | ||
|
||
(defface linum-line | ||
'((t :inherit linum :foreground "grey60" :background "grey30" :weight normal)) | ||
"Face for displaying absolute line number" | ||
:group 'linum) | ||
;; (defface linum-line | ||
;; '((t :inherit linum :foreground "grey60" :background "grey30" :weight normal)) | ||
;; "Face for displaying absolute line number" | ||
;; :group 'linum) | ||
|
||
(defun linum-relativenumber-format (line-number) | ||
(let ((diff (abs (- line-number linum-last-pos)))) | ||
(concat (propertize (format "%3d" line-number) | ||
'face 'linum-line) | ||
(propertize (format "%3d" diff) | ||
'face (cond ((zerop diff) 'linum-zero) | ||
((eq 1 line-number) 'linum-top) | ||
(t 'linum)))))) | ||
;; (defun linum-relativenumber-format (line-number) | ||
;; (let ((diff (abs (- line-number linum-last-pos)))) | ||
;; (concat (propertize (format "%3d" line-number) | ||
;; 'face 'linum-line) | ||
;; (propertize (format "%3d" diff) | ||
;; 'face (cond ((zerop diff) 'linum-zero) | ||
;; ((eq 1 line-number) 'linum-top) | ||
;; (t 'linum)))))) | ||
|
||
;; (setq linum-format 'dynamic) | ||
(setq linum-format 'linum-relativenumber-format) | ||
(setq linum-mode t) | ||
;; ;; (setq linum-format 'dynamic) | ||
;; (setq linum-format 'linum-relativenumber-format) | ||
;; (setq linum-mode t) |