[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] scratch/editorconfig-cc a4b8e55bf4 032/351: Make EditorConfig c
From: |
Stefan Monnier |
Subject: |
[nongnu] scratch/editorconfig-cc a4b8e55bf4 032/351: Make EditorConfig core function pluggable |
Date: |
Thu, 13 Jun 2024 18:38:38 -0400 (EDT) |
branch: scratch/editorconfig-cc
commit a4b8e55bf4dea4567f165ad5f71694f659610b3d
Author: 10sr <8slashes+git@gmail.com>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
Make EditorConfig core function pluggable
Close #41
Squashed commit of the following:
commit e91aca6f38d9c42be19cc49aafc75ac086907b00
Author: 10sr <8slashes+git@gmail.com>
Date: Sun Oct 25 03:19:26 2015 +0900
Fix typo in docstring
commit 76ce139cd0a0ff6bc250615ca7bb94868c85c41d
Author: 10sr <8slashes+git@gmail.com>
Date: Tue Oct 13 13:51:13 2015 +0900
Implement edconf-get-properties-from-exec
commit 23baf520c83a7cb68634cd173ce28f9a6842f593
Author: 10sr <8slashes+git@gmail.com>
Date: Mon Oct 12 03:18:54 2015 +0900
Add variable edconf-get-properties-function
---
editorconfig.el | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/editorconfig.el b/editorconfig.el
index 6f5ce71cff..f362ea7061 100644
--- a/editorconfig.el
+++ b/editorconfig.el
@@ -44,6 +44,16 @@
:type 'string
:group 'editorconfig)
+(defcustom edconf-get-properties-function
+ 'edconf-get-properties-from-exec
+ "Function to get EditorConofig properties for current buffer.
+This function will be called with no argument and should return a hash object
+containing properties, or nil if any core program is not available.
+The hash object should have symbols of property names as keys and strings of
+property values as values."
+ :type 'function
+ :group 'editorconfig)
+
(defcustom edconf-custom-hooks ()
"A list of custom hooks after loading common EditorConfig settings
@@ -104,10 +114,24 @@ property emacs_linum to decide whether to show line
numbers on the left
(defun edconf-parse-properties (props-string)
)
+(defun edconf-get-properties-from-exec ()
+ "Get EditorConfig properties of current buffer by calling
`edconf-exec-path'."
+ (if (executable-find edconf-exec-path)
+ (edconf-parse-properties (edconf-get-properties))
+ (display-warning :error
+ "Unable to find editorconfig executable.")
+ nil))
+
(defun edconf-find-file-hook ()
+ (let ((props (and (functionp edconf-get-properties-function)
+ (funcall edconf-get-properties-function))))
+ (if props
+ (progn
(edconf-set-line-length (gethash 'max_line_length props))
(dolist (hook edconf-custom-hooks)
(funcall hook props)))
+ (display-warning :error "EditorConfig core program is not available.
Styles will not be applied."))))
+
;;;###autoload
(add-to-list 'auto-mode-alist '("/\\.editorconfig\\'" . conf-unix-mode))
- [nongnu] branch scratch/editorconfig-cc created (now 3764c87538), Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc ef90cfda83 009/351: Update package information., Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc a4b8e55bf4 032/351: Make EditorConfig core function pluggable,
Stefan Monnier <=
- [nongnu] scratch/editorconfig-cc 68ad326706 002/351: Update EditorConfig url., Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 45afbe1bc9 007/351: Add a link to `editorconfig.el` in README, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc a8ca8c46f7 005/351: Update EditorConfig Core URL., Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 871a69ab90 028/351: Add Hong Xu to contributor list., Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc e69ebeeaa1 010/351: Reset the indentation rule., Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 8ee7d0b533 008/351: Set indent_size for lisp mode and ruby mode., Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc d744546fc6 003/351: Add root=true to the top .editorconfig., Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 10be4fd165 006/351: provide feature, use symbol prefix, add commentary,, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 5bc887b015 017/351: Support web-mode., Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc ac28a9fd1d 015/351: Bump version number, Stefan Monnier, 2024/06/13