emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/emacs-editorconfig 33b0716c668 082/364: Add editorocnfig-display


From: Stefan Monnier
Subject: scratch/emacs-editorconfig 33b0716c668 082/364: Add editorocnfig-display-current-properties
Date: Tue, 18 Jun 2024 01:40:40 -0400 (EDT)

branch: scratch/emacs-editorconfig
commit 33b0716c668685e177ffbe28efb7a95011b405b1
Author: 10sr <8slashes+git@gmail.com>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    Add editorocnfig-display-current-properties
    
    A function useful for debugging.
---
 editorconfig.el | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/editorconfig.el b/editorconfig.el
index 3a541f19840..b8ebdb8aaa4 100644
--- a/editorconfig.el
+++ b/editorconfig.el
@@ -199,6 +199,25 @@ It calls `editorconfig-get-properties-from-exec' if
     (editorconfig-get-propergies-from-exec)
     (editorconfig-core-get-properties-hash)))
 
+(defun editorconfig-display-current-properties ()
+  "Display EditorConfig properties extracted for current buffer."
+  (interactive)
+  (if editorconfig-properties-hash
+    (let (
+           (buf (get-buffer-create "*EditorConfig Properties*"))
+           (file buffer-file-name)
+           (props editorconfig-properties-hash))
+      (with-current-buffer buf
+        (erase-buffer)
+        (insert (format "# EditorConfig for %s\n" file))
+        (maphash (lambda (k v)
+                   (insert (format "%S = %s\n" k v)))
+          props))
+      (display-buffer buf))
+    (message "Properties are not applied to current buffer yet.")
+    nil))
+
+;;;###autoload
 (defun editorconfig-apply ()
   "Apply EditorConfig properties for current buffer."
   (interactive)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]