General refactor + cleanup

This commit is contained in:
Henrik Lissner 2017-06-16 02:06:21 +02:00
parent 3e769dc43f
commit 4eb2a7cb41
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 24 additions and 22 deletions

View file

@ -11,6 +11,7 @@ modes are active and the buffer is read-only.")
"Major modes that `doom|check-large-file' will ignore.")
(setq-default
vc-follow-symlinks t
;; Save clipboard contents into kill-ring before replacing them
save-interprogram-paste-before-kill t
;; Bookmarks
@ -32,7 +33,7 @@ modes are active and the buffer is read-only.")
require-final-newline t
tab-always-indent t
tab-width 4
tabify-regexp "^\t* [ \t]+" ; for :retab
tabify-regexp "^\t* [ \t]+" ; for :retab
;; Wrapping
truncate-lines t
truncate-partial-width-windows 50
@ -43,21 +44,16 @@ modes are active and the buffer is read-only.")
trailing lines-tail)
whitespace-display-mappings
'((tab-mark ?\t [? ?\t])
(newline-mark 10 [36 10])
(space-mark 32 [183] [46]))
;; undo-tree
undo-tree-auto-save-history t
undo-tree-history-directory-alist (list (cons "." (concat doom-cache-dir "undo-tree-hist/")))
visual-fill-column-center-text nil
vc-follow-symlinks t)
(newline-mark ?\n [ ?\n])
(space-mark ?\ [] [?.])))
;; ediff: use existing frame instead of creating a new one
(defun doom|init-ediff ()
(defun doom|ediff-use-existing-frame ()
"Use existing frame instead of creating a new one."
(setq ediff-diff-options "-w"
ediff-split-window-function #'split-window-horizontally
;; no extra frames
ediff-window-setup-function #'ediff-setup-windows-plain))
(add-hook 'ediff-load-hook #'doom|init-ediff)
(add-hook 'ediff-load-hook #'doom|ediff-use-existing-frame)
(defun doom|dont-kill-scratch-buffer ()
"Don't kill the scratch buffer."
@ -188,8 +184,11 @@ fundamental-mode) for performance sake."
(add-hook 'evil-replace-state-entry-hook #'turn-off-smartparens-mode)
(add-hook 'evil-replace-state-exit-hook #'turn-on-smartparens-mode)
;; Auto-close more conservatively
(sp-pair "'" nil :unless '(sp-point-before-word-p sp-point-after-word-p sp-point-before-same-p))
(sp-pair "\"" nil :unless '(sp-point-before-word-p sp-point-after-word-p sp-point-before-same-p))
(let ((unless-list '(sp-point-before-word-p
sp-point-after-word-p
sp-point-before-same-p)))
(sp-pair "'" nil :unless unless-list)
(sp-pair "\"" nil :unless unless-list))
(sp-pair "{" nil :post-handlers '(("||\n[i]" "RET") ("| " " "))
:unless '(sp-point-before-word-p sp-point-before-same-p))
(sp-pair "(" nil :post-handlers '(("||\n[i]" "RET") ("| " " "))
@ -197,21 +196,24 @@ fundamental-mode) for performance sake."
(sp-pair "[" nil :post-handlers '(("| " " "))
:unless '(sp-point-before-word-p sp-point-before-same-p))
(sp-local-pair
'css-mode "/*" "*/" :post-handlers '(("[d-3]||\n[i]" "RET") ("| " "SPC")))
(sp-local-pair 'css-mode "/*" "*/"
:post-handlers '(("[d-3]||\n[i]" "RET") ("| " "SPC")))
(sp-local-pair '(sh-mode markdown-mode) "`" nil
:unless '(sp-point-before-word-p sp-point-before-same-p))
(sp-local-pair '(xml-mode nxml-mode php-mode)
"<!--" "-->" :post-handlers '(("| " "SPC"))))
:unless '(sp-point-before-word-p sp-point-before-same-p))
(sp-local-pair '(xml-mode nxml-mode php-mode) "<!--" "-->"
:post-handlers '(("| " "SPC"))))
;; Branching & persistent undo
(def-package! undo-tree
:demand t
:config
(defun doom*silent-undo-tree-load (orig-fn &rest args)
(setq undo-tree-auto-save-history t
undo-tree-history-directory-alist
(list (cons "." (concat doom-cache-dir "undo-tree-hist/"))))
(defun doom*silence-undo-tree-load (orig-fn &rest args)
"Silence undo-tree load errors."
(quiet! (apply orig-fn args)))
(advice-add #'undo-tree-load-history-hook :around #'doom*silent-undo-tree-load))
(advice-add #'undo-tree-load-history-hook :around #'doom*silence-undo-tree-load))
;;

View file

@ -21,13 +21,13 @@
(eldoc-mode +1)
(auto-compile-on-save-mode +1)
(rainbow-delimiters-mode +1)
(when (and buffer-file-name
(not (file-in-directory-p buffer-file-name doom-emacs-dir)))
(flycheck-mode +1))
;; improve fontification
(rainbow-delimiters-mode +1)
(highlight-quoted-mode +1)
(highlight-numbers-mode +1)
(font-lock-add-keywords

View file

@ -18,7 +18,7 @@
;; Favor local eslint over global, if available
(defun +javascript|init-flycheck-elint ()
(when (derived-mode-p 'js-mode 'js2-mode)
(when (derived-mode-p 'js-mode)
(when-let ((eslint (expand-file-name "node_modules/eslint/bin/eslint.js" (doom-project-root)))
(exists-p (file-exists-p eslint))
(executable-p (file-executable-p eslint)))