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.") "Major modes that `doom|check-large-file' will ignore.")
(setq-default (setq-default
vc-follow-symlinks t
;; Save clipboard contents into kill-ring before replacing them ;; Save clipboard contents into kill-ring before replacing them
save-interprogram-paste-before-kill t save-interprogram-paste-before-kill t
;; Bookmarks ;; Bookmarks
@ -43,21 +44,16 @@ modes are active and the buffer is read-only.")
trailing lines-tail) trailing lines-tail)
whitespace-display-mappings whitespace-display-mappings
'((tab-mark ?\t [? ?\t]) '((tab-mark ?\t [? ?\t])
(newline-mark 10 [36 10]) (newline-mark ?\n [ ?\n])
(space-mark 32 [183] [46])) (space-mark ?\ [] [?.])))
;; 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)
;; ediff: use existing frame instead of creating a new one (defun doom|ediff-use-existing-frame ()
(defun doom|init-ediff () "Use existing frame instead of creating a new one."
(setq ediff-diff-options "-w" (setq ediff-diff-options "-w"
ediff-split-window-function #'split-window-horizontally ediff-split-window-function #'split-window-horizontally
;; no extra frames ;; no extra frames
ediff-window-setup-function #'ediff-setup-windows-plain)) 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 () (defun doom|dont-kill-scratch-buffer ()
"Don't kill the 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-entry-hook #'turn-off-smartparens-mode)
(add-hook 'evil-replace-state-exit-hook #'turn-on-smartparens-mode) (add-hook 'evil-replace-state-exit-hook #'turn-on-smartparens-mode)
;; Auto-close more conservatively ;; Auto-close more conservatively
(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-pair "\"" nil :unless '(sp-point-before-word-p sp-point-after-word-p sp-point-before-same-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") ("| " " ")) (sp-pair "{" nil :post-handlers '(("||\n[i]" "RET") ("| " " "))
:unless '(sp-point-before-word-p sp-point-before-same-p)) :unless '(sp-point-before-word-p sp-point-before-same-p))
(sp-pair "(" nil :post-handlers '(("||\n[i]" "RET") ("| " " ")) (sp-pair "(" nil :post-handlers '(("||\n[i]" "RET") ("| " " "))
@ -197,21 +196,24 @@ fundamental-mode) for performance sake."
(sp-pair "[" nil :post-handlers '(("| " " ")) (sp-pair "[" nil :post-handlers '(("| " " "))
:unless '(sp-point-before-word-p sp-point-before-same-p)) :unless '(sp-point-before-word-p sp-point-before-same-p))
(sp-local-pair (sp-local-pair 'css-mode "/*" "*/"
'css-mode "/*" "*/" :post-handlers '(("[d-3]||\n[i]" "RET") ("| " "SPC"))) :post-handlers '(("[d-3]||\n[i]" "RET") ("| " "SPC")))
(sp-local-pair '(sh-mode markdown-mode) "`" nil (sp-local-pair '(sh-mode markdown-mode) "`" nil
:unless '(sp-point-before-word-p sp-point-before-same-p)) :unless '(sp-point-before-word-p sp-point-before-same-p))
(sp-local-pair '(xml-mode nxml-mode php-mode) (sp-local-pair '(xml-mode nxml-mode php-mode) "<!--" "-->"
"<!--" "-->" :post-handlers '(("| " "SPC")))) :post-handlers '(("| " "SPC"))))
;; Branching & persistent undo ;; Branching & persistent undo
(def-package! undo-tree (def-package! undo-tree
:demand t :demand t
:config :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." "Silence undo-tree load errors."
(quiet! (apply orig-fn args))) (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) (eldoc-mode +1)
(auto-compile-on-save-mode +1) (auto-compile-on-save-mode +1)
(rainbow-delimiters-mode +1)
(when (and buffer-file-name (when (and buffer-file-name
(not (file-in-directory-p buffer-file-name doom-emacs-dir))) (not (file-in-directory-p buffer-file-name doom-emacs-dir)))
(flycheck-mode +1)) (flycheck-mode +1))
;; improve fontification ;; improve fontification
(rainbow-delimiters-mode +1)
(highlight-quoted-mode +1) (highlight-quoted-mode +1)
(highlight-numbers-mode +1) (highlight-numbers-mode +1)
(font-lock-add-keywords (font-lock-add-keywords

View file

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