From 977f795e0304204b6d4a397dab426009ec3957f9 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 10 Dec 2019 23:16:15 -0800 Subject: Enable ‘auto-fill-mode’ for comments in most programming modes The ones that are already backed by a formatter, such as Java, Python and sh don’t need it. --- oni-c.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'oni-c.el') diff --git a/oni-c.el b/oni-c.el index b9313fc..843287a 100644 --- a/oni-c.el +++ b/oni-c.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0904.210340 +;; Version: 2019.1210.230144 ;; Package-Requires: (oni-flycheck oni-fci) ;; This program is free software; you can redistribute it and/or modify @@ -26,10 +26,16 @@ ;;; Code: +(defun oni-c--auto-fill-mode () + "Enable ‘auto-fill-mode’ only for comments." + (setq-local comment-auto-fill-only-comments t) + (auto-fill-mode)) + (add-hook 'c-mode-hook 'electric-pair-local-mode) (add-hook 'c-mode-hook 'electric-indent-local-mode) (add-hook 'c-mode-hook 'flycheck-mode) (add-hook 'c-mode-hook 'fci-mode) +(add-hook 'c-mode-hook 'oni-c--auto-fill-mode) ;;;###autoload(with-eval-after-load 'cc-mode (require 'oni-c)) -- cgit v1.2.3-54-g00ecf