first commit
This commit is contained in:
40
my-linum.el
Normal file
40
my-linum.el
Normal file
@@ -0,0 +1,40 @@
|
||||
(defvar linum-current-line 1 "Current line number.")
|
||||
|
||||
(defface linum-current-line
|
||||
`((t :inherit linum
|
||||
:foreground "chocolate"
|
||||
;; :weight bold
|
||||
))
|
||||
"Face for displaying the current line number."
|
||||
:group 'linum)
|
||||
|
||||
(defadvice linum-update (before advice-linum-update activate)
|
||||
"Set the current line."
|
||||
(setq linum-current-line (line-number-at-pos)))
|
||||
|
||||
(unless window-system
|
||||
(add-hook 'linum-before-numbering-hook
|
||||
(lambda ()
|
||||
(setq-local linum-format-fmt
|
||||
(let ((w (length (number-to-string
|
||||
(count-lines
|
||||
(point-min)
|
||||
(point-max))))))
|
||||
(concat "%" (number-to-string w) "d "))))))
|
||||
|
||||
|
||||
(defun linum-format-func (line)
|
||||
(let ((face
|
||||
(if (= line linum-current-line)
|
||||
'linum-current-line
|
||||
'linum)))
|
||||
(concat
|
||||
(propertize (format linum-format-fmt line) 'face face)
|
||||
"")))
|
||||
(unless window-system
|
||||
(setq linum-format 'linum-format-func))
|
||||
|
||||
(add-hook 'find-file-hook (lambda ()
|
||||
(linum-mode 1)))
|
||||
(add-hook 'eshell-mode-hook (lambda ()
|
||||
(linum mode -1)))
|
||||
Reference in New Issue
Block a user