emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] scratch/editorconfig-cc c02d94298b 082/351: Add editorocnfig-di


From: Stefan Monnier
Subject: [nongnu] scratch/editorconfig-cc c02d94298b 082/351: Add editorocnfig-display-current-properties
Date: Thu, 13 Jun 2024 18:38:43 -0400 (EDT)

branch: scratch/editorconfig-cc
commit c02d94298babd6e5a01db4a3b80c1f3c791eff38
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 3ea489d7a2..e1de827889 100644
--- a/editorconfig.el
+++ b/editorconfig.el
@@ -256,6 +256,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]