Remove support for editorconfig-exclude-*
When using the new hook, we can't support `editorconfig-exclude-modes` for the `charset` property. Also there are already other ways to get similar effects (e.g. setting `auto-coding-alist` or `enable-dir-local-variables`), so it's not clear those configurations will be needed in Emacs-30. * lisp/editorconfig.el (editorconfig-exclude-modes) (editorconfig-exclude-regexps): Remove custom vars. (recentf): Remove workaround (presumably not needed thanks to the fix to issue #246). (editorconfig--disabled-for-filename) (editorconfig--disabled-for-majormode): Delete functions. (editorconfig--advice-find-file-noselect): Remove call to those functions. (editorconfig-mode): Adjust docstring accordingly. * lisp/editorconfig-tools.el (editorconfig-apply): Adjust accordingly.
This commit is contained in:
parent
8cfa6fe801
commit
c5d86db811
2 changed files with 4 additions and 48 deletions
|
@ -80,10 +80,7 @@ This function does nothing when the major mode is listed in
|
|||
`editorconfig-exclude-modes', or variable `buffer-file-name' matches
|
||||
any of regexps in `editorconfig-exclude-regexps'."
|
||||
(interactive)
|
||||
(when (and major-mode
|
||||
(not (editorconfig--disabled-for-majormode major-mode))
|
||||
buffer-file-name
|
||||
(not (editorconfig--disabled-for-filename buffer-file-name)))
|
||||
(when (and major-mode buffer-file-name)
|
||||
(editorconfig-apply)))
|
||||
|
||||
|
||||
|
|
|
@ -191,24 +191,6 @@ This hook will be run even when there are no matching sections in
|
|||
"Alist of indentation setting methods by modes."
|
||||
:risky t)
|
||||
|
||||
(defcustom editorconfig-exclude-modes ()
|
||||
"Modes in which `editorconfig-mode-apply' will not run."
|
||||
:type '(repeat (symbol :tag "Major Mode"))
|
||||
:group 'editorconfig)
|
||||
|
||||
(defcustom editorconfig-exclude-regexps ()
|
||||
"List of regexp for buffer filenames `editorconfig-mode-apply' will not run.
|
||||
|
||||
When variable `buffer-file-name' matches any of the regexps, then
|
||||
`editorconfig-mode-apply' will not do its work."
|
||||
:type '(repeat string)
|
||||
:group 'editorconfig)
|
||||
(with-eval-after-load 'recentf
|
||||
(add-to-list 'editorconfig-exclude-regexps
|
||||
(rx-to-string '(seq string-start
|
||||
(eval (expand-file-name recentf-save-file)))
|
||||
t)))
|
||||
|
||||
(defcustom editorconfig-trim-whitespaces-mode nil
|
||||
"Buffer local minor-mode to use to trim trailing whitespaces.
|
||||
|
||||
|
@ -245,23 +227,6 @@ number - `lisp-indent-offset' is not set only if indent_size is
|
|||
Make a message by passing ARGS to `format-message'."
|
||||
(signal 'editorconfig-error (list (apply #'format-message args))))
|
||||
|
||||
(defun editorconfig--disabled-for-filename (filename)
|
||||
"Return non-nil when EditorConfig is disabled for FILENAME."
|
||||
(cl-assert (stringp filename))
|
||||
(cl-loop for regexp in editorconfig-exclude-regexps
|
||||
if (string-match regexp filename) return t
|
||||
finally return nil))
|
||||
|
||||
(defun editorconfig--disabled-for-majormode (majormode)
|
||||
"Return non-nil when Editorconfig is disabled for MAJORMODE."
|
||||
(cl-assert majormode)
|
||||
(or (provided-mode-derived-p majormode 'special-mode)
|
||||
;; Some special modes (like `archive-mode') are not derived from
|
||||
;; `special-mode'
|
||||
(eq (get majormode 'mode-class) 'special)
|
||||
(memq majormode
|
||||
editorconfig-exclude-modes)))
|
||||
|
||||
(defun editorconfig-string-integer-p (string)
|
||||
"Return non-nil if STRING represents integer."
|
||||
(and (stringp string)
|
||||
|
@ -495,8 +460,7 @@ F is that function, and FILENAME and ARGS are arguments passed to F."
|
|||
(coding-system nil)
|
||||
(ret nil))
|
||||
(condition-case err
|
||||
(when (and (stringp filename)
|
||||
(not (editorconfig--disabled-for-filename filename)))
|
||||
(when (stringp filename)
|
||||
(setq props (editorconfig-call-get-properties-function filename))
|
||||
(setq coding-system
|
||||
(editorconfig-merge-coding-systems (gethash 'end_of_line props)
|
||||
|
@ -515,9 +479,7 @@ F is that function, and FILENAME and ARGS are arguments passed to F."
|
|||
|
||||
(condition-case err
|
||||
(with-current-buffer ret
|
||||
(when (and props
|
||||
;; filename has already been checked
|
||||
(not (editorconfig--disabled-for-majormode major-mode)))
|
||||
(when props
|
||||
|
||||
;; When file path indicates it is a remote file and it actually
|
||||
;; does not exists, `buffer-file-coding-system' will not be set.
|
||||
|
@ -561,10 +523,7 @@ F is that function, and FILENAME and ARGS are arguments passed to F."
|
|||
|
||||
;;;###autoload
|
||||
(define-minor-mode editorconfig-mode
|
||||
"Toggle EditorConfig feature.
|
||||
|
||||
To disable EditorConfig in some buffers, modify
|
||||
`editorconfig-exclude-modes' or `editorconfig-exclude-regexps'."
|
||||
"Toggle EditorConfig feature."
|
||||
:global t
|
||||
:lighter editorconfig-mode-lighter
|
||||
(let ((modehooks '(prog-mode-hook
|
||||
|
|
Loading…
Reference in a new issue