mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-22 11:00:27 +10:00
Updating Doom Emacs.
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
;; appending an extension to `buffer-file-name' when we talk to editorconfig.
|
||||
(defvar +editorconfig-mode-alist
|
||||
'((emacs-lisp-mode . "el")
|
||||
(enh-ruby-mode . "rb")
|
||||
(js2-mode . "js")
|
||||
(perl-mode . "pl")
|
||||
(php-mode . "php")
|
||||
@@ -20,8 +19,11 @@
|
||||
;; Handles whitespace (tabs/spaces) settings externally. This way projects can
|
||||
;; specify their own formatting rules.
|
||||
(use-package! editorconfig
|
||||
:after-call doom-switch-buffer-hook after-find-file
|
||||
:hook (doom-first-buffer . editorconfig-mode)
|
||||
:config
|
||||
(when (require 'ws-butler nil t)
|
||||
(setq editorconfig-trim-whitespaces-mode 'ws-butler-mode))
|
||||
|
||||
(defadvice! +editorconfig--smart-detection-a (orig-fn)
|
||||
"Retrieve the properties for the current file. If it doesn't have an
|
||||
extension, try to guess one."
|
||||
@@ -31,25 +33,15 @@ extension, try to guess one."
|
||||
(file-name-extension buffer-file-name))
|
||||
buffer-file-name
|
||||
(format "%s%s" (buffer-file-name (buffer-base-buffer))
|
||||
(if-let* ((ext (cdr (assq major-mode +editorconfig-mode-alist))))
|
||||
(if-let (ext (alist-get major-mode +editorconfig-mode-alist))
|
||||
(concat "." ext)
|
||||
"")))))
|
||||
(funcall orig-fn)))
|
||||
|
||||
(add-hook! 'editorconfig-after-apply-functions
|
||||
(defun +editorconfig-disable-ws-butler-maybe-h (props)
|
||||
"Disable `ws-butler-mode' if trim_trailing_whitespace is true."
|
||||
(when (and (equal (gethash 'trim_trailing_whitespace props) "true")
|
||||
(bound-and-true-p ws-butler-mode))
|
||||
(ws-butler-mode -1))))
|
||||
|
||||
(add-hook! 'editorconfig-after-apply-functions
|
||||
(defun +editorconfig-disable-indent-detection-h (props)
|
||||
"Inhibit `dtrt-indent' if an explicit indent_style and indent_size is
|
||||
specified by editorconfig."
|
||||
(when (or (gethash 'indent_style props)
|
||||
(gethash 'indent_size props))
|
||||
(setq doom-inhibit-indent-detection 'editorconfig))))
|
||||
|
||||
;;
|
||||
(editorconfig-mode +1))
|
||||
(setq doom-inhibit-indent-detection 'editorconfig)))))
|
||||
|
||||
Reference in New Issue
Block a user