mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-05 22:20:24 -08:00
Fix editorconfig-display-current-properties
In Emacs-30, `editorconfig-display-current-properties` was broken in that it displayed only the properties set by `editorconfig-apply` but not those set in the "normal" way, i.e. by `hack-local-variables`. Fix that along with a few docstrings that had misleading old info. * lisp/editorconfig-tools.el (editorconfig-apply) (editorconfig-mode-apply): Fix docstring and declare obsolete. * lisp/editorconfig.el (editorconfig-properties-hash): (editorconfig-call-get-properties-function): Remove elements of docstring that aren't true any more. (editorconfig-call-get-properties-function): Set `editorconfig-properties-hash`.
This commit is contained in:
parent
788b39740a
commit
5e10b7fe4e
3 changed files with 20 additions and 17 deletions
6
etc/NEWS
6
etc/NEWS
|
|
@ -857,6 +857,12 @@ you could already use 'C-u C-x C-n' to clear the goal column.
|
||||||
|
|
||||||
* Changes in Specialized Modes and Packages in Emacs 31.1
|
* Changes in Specialized Modes and Packages in Emacs 31.1
|
||||||
|
|
||||||
|
** Editorconfig
|
||||||
|
---
|
||||||
|
*** 'editorconfig-apply' is declared obsolete.
|
||||||
|
You can now use 'editorconfig-display-current-properties' without having
|
||||||
|
to call 'editorconfig-apply'.
|
||||||
|
|
||||||
** Auth Source
|
** Auth Source
|
||||||
|
|
||||||
+++
|
+++
|
||||||
|
|
|
||||||
|
|
@ -41,11 +41,8 @@
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun editorconfig-apply ()
|
(defun editorconfig-apply ()
|
||||||
"Get and apply EditorConfig properties to current buffer.
|
"Get and apply EditorConfig properties to current buffer."
|
||||||
|
(declare (obsolete hack-local-variables "31.1"))
|
||||||
This function does not respect the values of `editorconfig-exclude-modes' and
|
|
||||||
`editorconfig-exclude-regexps' and always applies available properties.
|
|
||||||
Use `editorconfig-mode-apply' instead to make use of these variables."
|
|
||||||
(interactive)
|
(interactive)
|
||||||
(when buffer-file-name
|
(when buffer-file-name
|
||||||
(condition-case err
|
(condition-case err
|
||||||
|
|
@ -76,14 +73,12 @@ Use `editorconfig-mode-apply' instead to make use of these variables."
|
||||||
:error)))))
|
:error)))))
|
||||||
|
|
||||||
(defun editorconfig-mode-apply ()
|
(defun editorconfig-mode-apply ()
|
||||||
"Get and apply EditorConfig properties to current buffer.
|
"Get and apply EditorConfig properties to current buffer."
|
||||||
|
(declare (obsolete editorconfig-apply "31.1"))
|
||||||
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)
|
(interactive)
|
||||||
(when (and major-mode buffer-file-name)
|
(when (and major-mode buffer-file-name)
|
||||||
(editorconfig-apply)))
|
(with-suppressed-warnings ((obsolete editorconfig-apply))
|
||||||
|
(editorconfig-apply))))
|
||||||
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
|
|
||||||
|
|
@ -251,9 +251,7 @@ Otherwise, use `delete-trailing-whitespace'."
|
||||||
:type 'function)
|
:type 'function)
|
||||||
|
|
||||||
(defvar-local editorconfig-properties-hash nil
|
(defvar-local editorconfig-properties-hash nil
|
||||||
"Hash object of EditorConfig properties that was enabled for current buffer.
|
"Hash object of EditorConfig properties that was enabled for current buffer.")
|
||||||
Set by `editorconfig-apply' and nil if that is not invoked in
|
|
||||||
current buffer yet.")
|
|
||||||
(put 'editorconfig-properties-hash 'permanent-local t)
|
(put 'editorconfig-properties-hash 'permanent-local t)
|
||||||
|
|
||||||
(defvar editorconfig-lisp-use-default-indent nil
|
(defvar editorconfig-lisp-use-default-indent nil
|
||||||
|
|
@ -527,9 +525,7 @@ This function will revert buffer when the coding-system has been changed."
|
||||||
|
|
||||||
(defun editorconfig-call-get-properties-function (filename)
|
(defun editorconfig-call-get-properties-function (filename)
|
||||||
"Call `editorconfig-core-get-properties-hash' with FILENAME and return result.
|
"Call `editorconfig-core-get-properties-hash' with FILENAME and return result.
|
||||||
|
This function also removes `unset' properties."
|
||||||
This function also removes `unset' properties and calls
|
|
||||||
`editorconfig-hack-properties-functions'."
|
|
||||||
(if (stringp filename)
|
(if (stringp filename)
|
||||||
(setq filename (expand-file-name filename))
|
(setq filename (expand-file-name filename))
|
||||||
(editorconfig-error "Invalid argument: %S" filename))
|
(editorconfig-error "Invalid argument: %S" filename))
|
||||||
|
|
@ -541,6 +537,12 @@ This function also removes `unset' properties and calls
|
||||||
err)))
|
err)))
|
||||||
(cl-loop for k being the hash-keys of props using (hash-values v)
|
(cl-loop for k being the hash-keys of props using (hash-values v)
|
||||||
when (equal v "unset") do (remhash k props))
|
when (equal v "unset") do (remhash k props))
|
||||||
|
;; E.g. for `editorconfig-display-current-properties'.
|
||||||
|
;; FIXME: Use it for memoization as well to avoid the duplicate
|
||||||
|
;; calls to `editorconfig-core-get-properties-hash' (one for
|
||||||
|
;; `editorconfig--get-coding-system' and one for
|
||||||
|
;; `editorconfig--get-dir-local-variables')?
|
||||||
|
(setq editorconfig-properties-hash props)
|
||||||
props))
|
props))
|
||||||
|
|
||||||
(defvar editorconfig-get-local-variables-functions
|
(defvar editorconfig-get-local-variables-functions
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue