branch: externals/auto-header
commit f29a1a45fe4808bfa699c776061707f8f0c672b3
Author: Philip Kaludercic <[email protected]>
Commit: Philip Kaludercic <[email protected]>

    Add auto-header-mode as a minor mode
---
 auto-header.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/auto-header.el b/auto-header.el
index 52750dcc9d..9ced1a55d1 100644
--- a/auto-header.el
+++ b/auto-header.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2022  Philip Kaludercic
 
 ;; Author: Philip Kaludercic <[email protected]>
-;; Version: $Id$
+;; Version: $Id: auto-header.el,v 1.1 2022/04/20 17:15:42 oj14ozun Exp 
oj14ozun $
 ;; Package-Version: 1.0
 ;; Keywords: c
 
@@ -142,5 +142,12 @@ NAME."
        (mapcan #'auto-header-find-headers
               headers)))))
 
+(define-minor-mode auto-header-mode
+  "Run `auto-header-buffer' before saving."
+  :lighter " AH"
+  (if auto-header-mode
+      (add-hook 'before-save-hook #'auto-header-buffer nil t)
+    (remove-hook 'before-save-hook #'auto-header-buffer t)))
+
 (provide 'auto-header)
 ;;; auto-header.el ends here

Reply via email to