From 4eb2a7cb41fe55254726ad113c93df623f2c1df2 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 16 Jun 2017 02:06:21 +0200 Subject: [PATCH] General refactor + cleanup --- core/core-editor.el | 42 ++++++++++++++++--------------- modules/lang/emacs-lisp/config.el | 2 +- modules/lang/javascript/config.el | 2 +- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/core/core-editor.el b/core/core-editor.el index 550758d48..b8d1f504e 100644 --- a/core/core-editor.el +++ b/core/core-editor.el @@ -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)) ;; diff --git a/modules/lang/emacs-lisp/config.el b/modules/lang/emacs-lisp/config.el index b6453040e..00022fba2 100644 --- a/modules/lang/emacs-lisp/config.el +++ b/modules/lang/emacs-lisp/config.el @@ -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 diff --git a/modules/lang/javascript/config.el b/modules/lang/javascript/config.el index 04f860ec9..cbcda88bc 100644 --- a/modules/lang/javascript/config.el +++ b/modules/lang/javascript/config.el @@ -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)))