From 65474a9f7c7012f5c463058c370c6ca103e1fb59 Mon Sep 17 00:00:00 2001 From: 10sr <8.slashes@gmail.com> Date: Tue, 28 Aug 2018 15:43:47 +0900 Subject: [PATCH] Add custom hook for readonly --- emacs.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/emacs.el b/emacs.el index 07c3190..b9a297f 100644 --- a/emacs.el +++ b/emacs.el @@ -643,6 +643,13 @@ found, otherwise returns nil." (add-hook 'editorconfig-custom-hooks 'editorconfig-custom-majormode)) +(add-hook 'editorconfig-custom-hooks + (lambda (props) + (let ((r (gethash 'readonly props))) + (when (and (string= r "true") + (not buffer-read-only)) + (read-only-mode 1))))) + ;; (when (fboundp 'editorconfig-charset-extras) ;; (add-hook 'editorconfig-custom-hooks ;; 'editorconfig-charset-extras))