Ver a proveniência

Implement editorconfig-auto-apply-mode

master
10sr há 6 anos
ascendente
cometimento
789b8db7a4
Assinados por: 10sr ID da chave GPG: 7BEC428194130EB2
2 ficheiros alterados com 32 adições e 0 eliminações
  1. +2
    -0
      .editorconfig
  2. +30
    -0
      emacs.el

+ 2
- 0
.editorconfig Ver ficheiro

@@ -11,6 +11,8 @@ trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 80

a=bhoehoe

[*.js]
indent_size = 2



+ 30
- 0
emacs.el Ver ficheiro

@@ -1600,6 +1600,36 @@ This mode is a simplified version of `adoc-mode'."
(buffer-substring-no-properties (point-min) (point-max))))
))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; editorconfig-auto-apply

(define-minor-mode editorconfig-auto-apply-mode
"When saving .editorconfig file update buffer configs."
:global t
:lighter ""
(if editorconfig-auto-apply-mode
(add-hook 'after-save-hook
'editorconfig-auto-apply-mode--when-save)
(remove-hook 'after-save-hook
'editorconfig-auto-apply-mode--when-save)))

(defun editorconfig-auto-apply-mode--when-save ()
"Function run when editorconfig"
(when (eq major-mode
'editorconfig-conf-mode)
(let ((dir (file-name-directory buffer-file-name)))
(cl-dolist (buf (buffer-list))
(when (and (buffer-file-name buf)
(file-in-directory-p (buffer-file-name buf)
dir))
(with-current-buffer buf
(editorconfig-mode-apply)))))))

(editorconfig-auto-apply-mode 1)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun my-file-head (filename &optional n)
"Return list of first N lines of file FILENAME."
;; Work with japanese text?


Carregando…
Cancelar
Guardar