Clean up core-ui.el
This commit is contained in:
parent
76ac7c4801
commit
84fbf01811
1 changed files with 51 additions and 45 deletions
|
@ -1,20 +1,6 @@
|
||||||
;;; core-ui.el --- interface settings
|
;;; core-ui.el --- interface settings
|
||||||
;; see lib/ui-defuns.el
|
;; see lib/ui-defuns.el
|
||||||
|
|
||||||
(if window-system
|
|
||||||
(progn
|
|
||||||
(fringe-mode '(3 . 6))
|
|
||||||
(setq frame-title-format '(buffer-file-name "%f" ("%b")))
|
|
||||||
(setq initial-frame-alist '((width . 120) (height . 80)))
|
|
||||||
|
|
||||||
(set-frame-font narf-default-font)
|
|
||||||
(set-face-attribute 'default t :font narf-default-font)
|
|
||||||
|
|
||||||
(define-fringe-bitmap 'tilde [0 0 0 113 219 142 0 0] nil nil 'center)
|
|
||||||
(setcdr (assq 'empty-line fringe-indicator-alist) 'tilde)
|
|
||||||
(set-fringe-bitmap-face 'tilde 'font-lock-comment-face))
|
|
||||||
(menu-bar-mode -1))
|
|
||||||
|
|
||||||
(setq-default
|
(setq-default
|
||||||
blink-matching-paren nil
|
blink-matching-paren nil
|
||||||
show-paren-delay 0.075
|
show-paren-delay 0.075
|
||||||
|
@ -32,14 +18,29 @@
|
||||||
indicate-buffer-boundaries nil
|
indicate-buffer-boundaries nil
|
||||||
indicate-empty-lines t
|
indicate-empty-lines t
|
||||||
fringes-outside-margins t
|
fringes-outside-margins t
|
||||||
hl-line-sticky-flag nil
|
hl-line-sticky-flag nil ; only highlight in one window
|
||||||
|
|
||||||
jit-lock-defer-time 0
|
jit-lock-defer-time 0
|
||||||
jit-lock-stealth-time 1
|
jit-lock-stealth-time nil
|
||||||
|
|
||||||
resize-mini-windows t)
|
resize-mini-windows t)
|
||||||
|
|
||||||
(blink-cursor-mode 1) ; do blink cursor
|
(defvar narf-fringe-size 6)
|
||||||
|
(if window-system
|
||||||
|
(progn
|
||||||
|
(fringe-mode narf-fringe-size)
|
||||||
|
(setq frame-title-format '(buffer-file-name "%f" ("%b")))
|
||||||
|
(setq initial-frame-alist '((width . 120) (height . 80)))
|
||||||
|
|
||||||
|
(set-frame-font narf-default-font)
|
||||||
|
(set-face-attribute 'default t :font narf-default-font)
|
||||||
|
|
||||||
|
(define-fringe-bitmap 'tilde [64 168 16] nil nil 'center)
|
||||||
|
(setcdr (assq 'empty-line fringe-indicator-alist) 'tilde)
|
||||||
|
(set-fringe-bitmap-face 'tilde 'font-lock-comment-face))
|
||||||
|
(menu-bar-mode -1))
|
||||||
|
|
||||||
|
(blink-cursor-mode -1) ; do blink cursor
|
||||||
(tooltip-mode -1) ; show tooltips in echo area
|
(tooltip-mode -1) ; show tooltips in echo area
|
||||||
|
|
||||||
;; Highlight line
|
;; Highlight line
|
||||||
|
@ -71,7 +72,7 @@
|
||||||
(font-lock-add-keywords nil '(("\\<\\(NOTE\\((.+)\\)?:?\\)" 1 'narf-note-face prepend))))
|
(font-lock-add-keywords nil '(("\\<\\(NOTE\\((.+)\\)?:?\\)" 1 'narf-note-face prepend))))
|
||||||
|
|
||||||
;; Prettify code folding in emacs ;;;;;;
|
;; Prettify code folding in emacs ;;;;;;
|
||||||
(define-fringe-bitmap 'hs-marker [0 0 8 8 62 8 8 0])
|
(define-fringe-bitmap 'hs-marker [16 48 112 240 112 48 16] nil nil 'center)
|
||||||
(defface hs-face '((t (:background "#ff8")))
|
(defface hs-face '((t (:background "#ff8")))
|
||||||
"Face to hightlight the ... area of hidden regions"
|
"Face to hightlight the ... area of hidden regions"
|
||||||
:group 'hideshow)
|
:group 'hideshow)
|
||||||
|
@ -79,24 +80,24 @@
|
||||||
"Face used to highlight the fringe on folded regions"
|
"Face used to highlight the fringe on folded regions"
|
||||||
:group 'hideshow)
|
:group 'hideshow)
|
||||||
|
|
||||||
(defun display-code-line-counts (ov)
|
(setq hs-set-up-overlay
|
||||||
|
(lambda (ov)
|
||||||
(when (eq 'code (overlay-get ov 'hs))
|
(when (eq 'code (overlay-get ov 'hs))
|
||||||
(let* ((marker-string "*fringe-dummy*")
|
(let* ((marker-string "*fringe-dummy*")
|
||||||
(marker-length (length marker-string))
|
(marker-length (length marker-string))
|
||||||
(display-string (format " ... "
|
(display-string (format " ... " (count-lines (overlay-start ov)
|
||||||
(count-lines (overlay-start ov)
|
|
||||||
(overlay-end ov)))))
|
(overlay-end ov)))))
|
||||||
(put-text-property 0 marker-length 'display (list 'right-fringe 'hs-marker 'hs-fringe-face) marker-string)
|
(put-text-property 0 marker-length 'display
|
||||||
|
(list 'right-fringe 'hs-marker 'hs-fringe-face) marker-string)
|
||||||
(put-text-property 0 (length display-string) 'face 'hs-face display-string)
|
(put-text-property 0 (length display-string) 'face 'hs-face display-string)
|
||||||
(overlay-put ov 'before-string marker-string)
|
(overlay-put ov 'before-string marker-string)
|
||||||
(overlay-put ov 'display display-string))))
|
(overlay-put ov 'display display-string)))))
|
||||||
(setq hs-set-up-overlay 'display-code-line-counts)
|
|
||||||
|
|
||||||
;; Fade out when unfocused ;;;;;;;;;;;;;
|
;; Fade out when unfocused ;;;;;;;;;;;;;
|
||||||
(defun narf|focus-in-alpha ()
|
(defun narf|focus-in-alpha ()
|
||||||
(set-frame-parameter nil 'alpha 100))
|
(set-frame-parameter nil 'alpha 100))
|
||||||
(defun narf|focus-out-alpha ()
|
(defun narf|focus-out-alpha ()
|
||||||
(set-frame-parameter nil 'alpha 90))
|
(set-frame-parameter nil 'alpha 80))
|
||||||
|
|
||||||
(add-hook! focus-in 'narf|focus-in-alpha)
|
(add-hook! focus-in 'narf|focus-in-alpha)
|
||||||
(add-hook! focus-out 'narf|focus-out-alpha)
|
(add-hook! focus-out 'narf|focus-out-alpha)
|
||||||
|
@ -140,9 +141,11 @@
|
||||||
("*Apropos*" :position bottom :height 40 :stick t :dedicated t)
|
("*Apropos*" :position bottom :height 40 :stick t :dedicated t)
|
||||||
("*quickrun*" :position bottom :height 10 :stick t)
|
("*quickrun*" :position bottom :height 10 :stick t)
|
||||||
("*helm-ag-edit*" :position bottom :height 20 :stick t)
|
("*helm-ag-edit*" :position bottom :height 20 :stick t)
|
||||||
(help-mode :position bottom :height 15 :stick t)
|
(help-mode :position bottom :height 15 :stick t :noselect t)
|
||||||
("*Backtrace*" :position bottom :height 15 :stick t)
|
("*Backtrace*" :position bottom :height 15 :stick t)
|
||||||
("*Flycheck errors*" :position bottom :height 15 :stick t)
|
("*Flycheck errors*" :position bottom :height 15 :stick t)
|
||||||
|
(org-src-mode :position bottom :height 25 :stick t)
|
||||||
|
(org-agenda-mode :position bottom :height 25 :stick t)
|
||||||
("^\\*[Hh]elm.*?\\*\\'" :regexp t :position bottom :height 15)
|
("^\\*[Hh]elm.*?\\*\\'" :regexp t :position bottom :height 15)
|
||||||
("^\\*Org-Babel.*\\*$" :regexp t :position bottom :height 15)
|
("^\\*Org-Babel.*\\*$" :regexp t :position bottom :height 15)
|
||||||
("^\\*Org .*\\*$" :regexp t :position bottom :height 15)
|
("^\\*Org .*\\*$" :regexp t :position bottom :height 15)
|
||||||
|
@ -156,6 +159,9 @@
|
||||||
(vhl/define-extension 'my-undo-tree-highlights
|
(vhl/define-extension 'my-undo-tree-highlights
|
||||||
'undo-tree-undo 'undo-tree-redo)
|
'undo-tree-undo 'undo-tree-redo)
|
||||||
(vhl/install-extension 'my-undo-tree-highlights)
|
(vhl/install-extension 'my-undo-tree-highlights)
|
||||||
|
(vhl/define-extension 'my-yank-highlights
|
||||||
|
'evil-yank 'evil-paste-after 'evil-paste-before 'evil-paste-pop)
|
||||||
|
(vhl/install-extension 'my-yank-highlights)
|
||||||
(volatile-highlights-mode t))
|
(volatile-highlights-mode t))
|
||||||
|
|
||||||
(use-package nlinum
|
(use-package nlinum
|
||||||
|
@ -168,7 +174,7 @@
|
||||||
:init
|
:init
|
||||||
(defun narf|nlinum-enable ()
|
(defun narf|nlinum-enable ()
|
||||||
(nlinum-mode +1)
|
(nlinum-mode +1)
|
||||||
(add-hook 'post-command-hook 'narf|nlinum-hl-line))
|
(add-hook 'post-command-hook 'narf|nlinum-hl-line t))
|
||||||
|
|
||||||
(defun narf|nlinum-disable ()
|
(defun narf|nlinum-disable ()
|
||||||
(nlinum-mode -1)
|
(nlinum-mode -1)
|
||||||
|
@ -180,7 +186,7 @@
|
||||||
'narf|nlinum-enable)
|
'narf|nlinum-enable)
|
||||||
:config
|
:config
|
||||||
(defun narf|nlinum-unhl-line ()
|
(defun narf|nlinum-unhl-line ()
|
||||||
"Highlight line number"
|
"Unhighlight line number"
|
||||||
(when narf--hl-nlinum-overlay
|
(when narf--hl-nlinum-overlay
|
||||||
(let* ((ov narf--hl-nlinum-overlay)
|
(let* ((ov narf--hl-nlinum-overlay)
|
||||||
(disp (get-text-property 0 'display (overlay-get ov 'before-string)))
|
(disp (get-text-property 0 'display (overlay-get ov 'before-string)))
|
||||||
|
@ -190,13 +196,13 @@
|
||||||
narf--hl-nlinum-line nil))))
|
narf--hl-nlinum-line nil))))
|
||||||
|
|
||||||
(defun narf|nlinum-hl-line (&optional line)
|
(defun narf|nlinum-hl-line (&optional line)
|
||||||
"Unhighlight line number"
|
"Highlight line number"
|
||||||
(let ((line-no (or line (line-number-at-pos (point)))))
|
(let ((line-no (or line (string-to-number (format-mode-line "%l")))))
|
||||||
(when (and nlinum-mode (not (eq line-no narf--hl-nlinum-line)))
|
(when (and nlinum-mode (not (eq line-no narf--hl-nlinum-line)))
|
||||||
(let* ((pbol (if line (save-excursion (goto-char (point-min))
|
(let* ((pbol (if line (save-excursion (goto-char (point-min))
|
||||||
(forward-line line-no)
|
(forward-line line-no)
|
||||||
(point-at-bol))
|
(point-at-bol))
|
||||||
(point-at-bol)))
|
(line-beginning-position)))
|
||||||
(peol (1+ pbol)))
|
(peol (1+ pbol)))
|
||||||
;; Handle EOF case
|
;; Handle EOF case
|
||||||
(let ((max (point-max)))
|
(let ((max (point-max)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue