Moved relative line-numbers code from behavior.el to appearance.el.

At the same time I also updated it to the latest code from the
StackOverFlow answer.
This commit is contained in:
2012-03-19 23:59:21 +00:00
parent 2f32571fcd
commit ec1acc0bf8
2 changed files with 18 additions and 12 deletions

View File

@@ -66,3 +66,21 @@
(add-hook 'after-make-frame-functions
(lambda (selected-frame)
(set-frame-parameter selected-frame 'alpha transparency-level)))
;; Relative line numbers -- from: http://stackoverflow.com/a/6928112/42146
;; (defvar my-linum-format-string "%3d ")
;; ;; (add-hook 'linum-before-numbering-hook 'my-linum-get-format-string)
;; (defun my-linum-get-format-string ()
;; (let* ((width (1+ (length (number-to-string
;; (count-lines (point-min) (point-max))))))
;; (format (concat "%" (number-to-string width) "d")))
;; (setq my-linum-format-string format)))
;; (defvar my-linum-current-line-number 0)
;; (setq linum-format 'my-linum-relative-line-numbers)
;; (defun my-linum-relative-line-numbers (line-number)
;; (let ((offset (abs(- line-number my-linum-current-line-number))))
;; (propertize (format my-linum-format-string offset) 'face 'linum)))
;; (defadvice linum-update (around my-linum-update)
;; (let ((my-linum-current-line-number (line-number-at-pos)))
;; ad-do-it))
;; (ad-activate 'linum-update)

View File

@@ -44,15 +44,3 @@
(xterm-mouse-mode 1)
(global-set-key [mouse-4] 'scroll-down-line)
(global-set-key [mouse-5] 'scroll-up-line))
;; Relative line numbers -- from: http://stackoverflow.com/a/6928112/42146
;; (defvar my-linum-current-line-number 0)
;; (setq linum-format 'my-linum-relative-line-numbers)
;; (defun my-linum-relative-line-numbers (line-number)
;; (propertize
;; (number-to-string (abs (- line-number my-linum-current-line-number)))
;; 'face 'linum))
;; (defadvice linum-update (around my-linum-update)
;; (let ((my-linum-current-line-number (line-number-at-pos)))
;; ad-do-it))
;; (ad-activate 'linum-update)