first commit

This commit is contained in:
Iñaki
2016-09-12 15:56:54 +02:00
commit 14edab9bcf
8 changed files with 289 additions and 0 deletions

40
my-linum.el Normal file
View 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)))