From 977f795e0304204b6d4a397dab426009ec3957f9 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 10 Dec 2019 23:16:15 -0800 Subject: [PATCH] =?UTF-8?q?Enable=20=E2=80=98auto-fill-mode=E2=80=99=20for?= =?UTF-8?q?=20comments=20in=20most=20programming=20modes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ones that are already backed by a formatter, such as Java, Python and sh don’t need it. --- oni-autohotkey.el | 8 +++++++- oni-c++.el | 8 +++++++- oni-c.el | 8 +++++++- oni-clojure.el | 8 +++++++- oni-cmake.el | 8 +++++++- oni-common-lisp.el | 8 +++++++- oni-conf/oni-conf.el | 9 ++++++++- oni-csharp.el | 8 +++++++- oni-css/oni-css.el | 8 +++++++- oni-elisp/oni-elisp.el | 8 +++++++- oni-groovy.el | 8 +++++++- oni-haml/oni-haml.el | 9 ++++++++- oni-html/oni-html.el | 8 +++++++- oni-js.el | 9 ++++++++- oni-makefile.el | 8 +++++++- oni-nxml/oni-nxml.el | 9 ++++++++- oni-php/oni-php.el | 8 +++++++- oni-powershell.el | 9 ++++++++- oni-python/oni-python.el | 2 +- oni-ruby/oni-ruby.el | 8 +++++++- oni-rust.el | 8 +++++++- oni-scheme.el | 8 +++++++- oni-twig/oni-twig.el | 9 ++++++++- oni-web.el | 9 ++++++++- oni-yaml.el | 8 +++++++- 25 files changed, 176 insertions(+), 25 deletions(-) diff --git a/oni-autohotkey.el b/oni-autohotkey.el index bacc35d..37f80bb 100644 --- a/oni-autohotkey.el +++ b/oni-autohotkey.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.1010.105642 +;; Version: 2019.1210.225944 ;; Package-Requires: (ahk-mode) ;; This program is free software; you can redistribute it and/or modify @@ -30,8 +30,14 @@ ;;; Code: +(defun oni-autohotkey--auto-fill-mode () + "Enable ‘auto-fill-mode’ only for comments." + (setq-local comment-auto-fill-only-comments t) + (auto-fill-mode)) + (add-hook 'ahk-mode-hook 'electric-pair-local-mode) (add-hook 'ahk-mode-hook 'electric-indent-local-mode) +(add-hook 'ahk-mode-hook 'oni-autohotkey--auto-fill-mode) ;;;###autoload(with-eval-after-load 'ahk-mode (require 'oni-autohotkey)) diff --git a/oni-c++.el b/oni-c++.el index 4866ee3..74cca5e 100644 --- a/oni-c++.el +++ b/oni-c++.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0904.210336 +;; Version: 2019.1210.230105 ;; Package-Requires: (oni-company oni-flycheck oni-fci) ;; This program is free software; you can redistribute it and/or modify @@ -26,11 +26,17 @@ ;;; 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 'company-mode) (add-hook 'c++-mode-hook 'electric-indent-local-mode) (add-hook 'c++-mode-hook 'electric-pair-local-mode) (add-hook 'c++-mode-hook 'fci-mode) (add-hook 'c++-mode-hook 'flycheck-mode) +(add-hook 'c++-mode-hook 'oni-c++--auto-fill-mode) ;;;###autoload(with-eval-after-load 'cc-mode (require 'oni-c++)) 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)) diff --git a/oni-clojure.el b/oni-clojure.el index 3f037ae..7a1ff32 100644 --- a/oni-clojure.el +++ b/oni-clojure.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0904.210349 +;; Version: 2019.1210.230345 ;; Package-Requires: (clojure-mode cider clojure-mode-extra-font-locking oni-paredit rainbow-delimiters oni-data-dir) ;; This program is free software; you can redistribute it and/or modify @@ -50,6 +50,11 @@ (define-clojure-indent (fact 1)) (define-clojure-indent (facts 1))) +(defun oni-clojure--auto-fill-mode () + "Enable ‘auto-fill-mode’ only for comments." + (setq-local comment-auto-fill-only-comments t) + (auto-fill-mode)) + (setq cider-repl-pop-to-buffer-on-connect t) (setq cider-show-error-buffer t @@ -64,6 +69,7 @@ (add-hook 'clojure-mode-hook 'oni-clojure-set-inferior-lisp) (add-hook 'clojure-mode-hook 'oni-clojure-add-font-lock) (add-hook 'clojure-mode-hook 'oni-clojure-add-indent) +(add-hook 'clojure-mode-hook 'oni-clojure--auto-fill-mode) (add-hook 'cider-repl-mode-hook 'paredit-mode) diff --git a/oni-cmake.el b/oni-cmake.el index 567c1c3..8bec57b 100644 --- a/oni-cmake.el +++ b/oni-cmake.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0904.210353 +;; Version: 2019.1210.230432 ;; Package-Requires: (cmake-mode oni-company oni-fci cmake-font-lock eldoc-cmake flycheck) ;; This program is free software; you can redistribute it and/or modify @@ -29,11 +29,17 @@ (require 'compile) (require 'flycheck) +(defun oni-cmake--auto-fill-mode () + "Enable ‘auto-fill-mode’ only for comments." + (setq-local comment-auto-fill-only-comments t) + (auto-fill-mode)) + (add-hook 'cmake-mode-hook 'cmake-font-lock-activate) (add-hook 'cmake-mode-hook 'company-mode) (add-hook 'cmake-mode-hook 'eldoc-cmake-enable) (add-hook 'cmake-mode-hook 'electric-pair-local-mode) (add-hook 'cmake-mode-hook 'fci-mode) +(add-hook 'cmake-mode-hook 'oni-cmake--auto-fill-mode) (add-to-list 'compilation-error-regexp-alist `(,(rx bol diff --git a/oni-common-lisp.el b/oni-common-lisp.el index d959048..db7f674 100644 --- a/oni-common-lisp.el +++ b/oni-common-lisp.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0904.210357 +;; Version: 2019.1210.230514 ;; Package-Requires: (oni-company oni-flycheck oni-paredit rainbow-delimiters slime slime-company) ;; This program is free software; you can redistribute it and/or modify @@ -33,6 +33,11 @@ (require 'slime) +(defun oni-common-lisp--auto-fill-mode () + "Enable ‘auto-fill-mode’ only for comments." + (setq-local comment-auto-fill-only-comments t) + (auto-fill-mode)) + (setq slime-lisp-implementations '((sbcl ("sbcl" "--noinform") :coding-system utf-8-unix) (clisp ("clisp") :coding-system utf-8-unix))) @@ -45,6 +50,7 @@ (add-hook 'lisp-mode-hook 'rainbow-delimiters-mode) (add-hook 'lisp-mode-hook 'flycheck-mode) (add-hook 'lisp-mode-hook 'company-mode) +(add-hook 'lisp-mode-hook 'oni-common-lisp--auto-fill-mode) ;;;###autoload (with-eval-after-load 'lisp-mode (require 'oni-common-lisp)) diff --git a/oni-conf/oni-conf.el b/oni-conf/oni-conf.el index 08bf6f9..5868a35 100644 --- a/oni-conf/oni-conf.el +++ b/oni-conf/oni-conf.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0904.210412 +;; Version: 2019.1210.225057 ;; Package-Requires: (oni-yasnippet) ;; This program is free software; you can redistribute it and/or modify @@ -45,6 +45,13 @@ (add-to-list 'yas-snippet-dirs oni-conf-snippets-dir t)) (yas-load-directory oni-conf-snippets-dir)) +(defun oni-conf--auto-fill-mode () + "Enable ‘auto-fill-mode’ only for comments." + (setq-local comment-auto-fill-only-comments t) + (auto-fill-mode)) + +(add-hook 'conf-mode-hook 'oni-conf--auto-fill-mode) + ;;;###autoload (with-eval-after-load 'conf-mode (with-eval-after-load 'yasnippet diff --git a/oni-csharp.el b/oni-csharp.el index 98318a0..95f077d 100644 --- a/oni-csharp.el +++ b/oni-csharp.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0904.210426 +;; Version: 2019.1210.230556 ;; Package-Requires: (csharp-mode omnisharp oni-company oni-flycheck) ;; This program is free software; you can redistribute it and/or modify @@ -76,6 +76,11 @@ (overlay-put current-overlay 'oni-csharp--overlayp t) (overlay-put current-overlay 'evaporate t))))) +(defun oni-csharp--auto-fill-mode () + "Enable ‘auto-fill-mode’ only for comments." + (setq-local comment-auto-fill-only-comments t) + (auto-fill-mode)) + (with-eval-after-load 'company (add-to-list 'company-backends 'company-omnisharp)) @@ -84,6 +89,7 @@ (add-hook 'csharp-mode-hook 'electric-pair-local-mode) (add-hook 'csharp-mode-hook 'flycheck-mode) (add-hook 'csharp-mode-hook 'omnisharp-mode) +(add-hook 'csharp-mode-hook 'oni-csharp--auto-fill-mode) ;;;###autoload(with-eval-after-load 'csharp-mode (require 'oni-csharp)) diff --git a/oni-css/oni-css.el b/oni-css/oni-css.el index cc8d441..ab2ae3f 100644 --- a/oni-css/oni-css.el +++ b/oni-css/oni-css.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0904.210438 +;; Version: 2019.1210.225029 ;; Package-Requires: (oni-company oni-fci hydra rainbow-mode yasnippet) ;; This program is free software; you can redistribute it and/or modify @@ -83,6 +83,11 @@ (oni-css-remove-important) (oni-css-add-important))) +(defun oni-css--auto-fill-mode () + "Enable ‘auto-fill-mode’ only for comments." + (setq-local comment-auto-fill-only-comments t) + (auto-fill-mode)) + (defhydra css-mode-hydra (:color blue) ("!" oni-css-mode-init--toggle-important)) @@ -93,6 +98,7 @@ (add-hook 'css-mode-hook 'electric-pair-local-mode) (add-hook 'css-mode-hook 'fci-mode) (add-hook 'css-mode-hook 'rainbow-mode) +(add-hook 'css-mode-hook 'oni-css--auto-fill-mode) (with-eval-after-load 'compile (let ((scss-error-regexp diff --git a/oni-elisp/oni-elisp.el b/oni-elisp/oni-elisp.el index 48f1264..ab8a575 100644 --- a/oni-elisp/oni-elisp.el +++ b/oni-elisp/oni-elisp.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0908.165508 +;; Version: 2019.1210.225238 ;; Package-Requires: (oni-company oni-flycheck oni-paredit oni-fci oni-yasnippet rainbow-delimiters nameless erefactor) ;; This program is free software; you can redistribute it and/or modify @@ -50,6 +50,11 @@ (add-to-list 'yas-snippet-dirs oni-elisp-snippets-dir t)) (yas-load-directory oni-elisp-snippets-dir)) +(defun oni-elisp--auto-fill-mode () + "Enable ‘auto-fill-mode’ only for comments." + (setq-local comment-auto-fill-only-comments t) + (auto-fill-mode)) + (add-hook 'emacs-lisp-mode-hook 'company-mode) (add-hook 'emacs-lisp-mode-hook 'electric-quote-local-mode) (add-hook 'emacs-lisp-mode-hook 'erefactor-lazy-highlight-turn-on) @@ -58,6 +63,7 @@ (add-hook 'emacs-lisp-mode-hook 'nameless-mode) (add-hook 'emacs-lisp-mode-hook 'paredit-mode) (add-hook 'emacs-lisp-mode-hook 'rainbow-delimiters-mode) +(add-hook 'emacs-lisp-mode-hook 'oni-elisp--auto-fill-mode) (add-hook 'ielm-mode-hook 'company-mode) (add-hook 'ielm-mode-hook 'paredit-mode) diff --git a/oni-groovy.el b/oni-groovy.el index b9ed7e5..cb6be5e 100644 --- a/oni-groovy.el +++ b/oni-groovy.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0904.210550 +;; Version: 2019.1210.230729 ;; Package-Requires: (groovy-mode groovy-imports rainbow-delimiters) ;; This program is free software; you can redistribute it and/or modify @@ -29,12 +29,18 @@ (require 'groovy-mode) (require 'groovy-imports) +(defun oni-groovy--auto-fill-mode () + "Enable ‘auto-fill-mode’ only for comments." + (setq-local comment-auto-fill-only-comments t) + (auto-fill-mode)) + (define-key groovy-mode-map (kbd "M-I") 'groovy-imports-add-import-dwim) (add-hook 'groovy-mode-hook 'electric-indent-local-mode) (add-hook 'groovy-mode-hook 'electric-pair-local-mode) (add-hook 'groovy-mode-hook 'groovy-imports-scan-file) (add-hook 'groovy-mode-hook 'rainbow-delimiters-mode) +(add-hook 'groovy-mode-hook 'oni-groovy--auto-fill-mode) ;;;###autoload(with-eval-after-load 'groovy-mode (require 'oni-groovy)) diff --git a/oni-haml/oni-haml.el b/oni-haml/oni-haml.el index 00a88d7..c184f1a 100644 --- a/oni-haml/oni-haml.el +++ b/oni-haml/oni-haml.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0904.210605 +;; Version: 2019.1210.225414 ;; Package-Requires: (oni-yasnippet) ;; This program is free software; you can redistribute it and/or modify @@ -45,6 +45,13 @@ (add-to-list 'yas-snippet-dirs oni-haml-snippets-dir t)) (yas-load-directory oni-haml-snippets-dir)) +(defun oni-haml--auto-fill-mode () + "Enable ‘auto-fill-mode’ only for comments." + (setq-local comment-auto-fill-only-comments t) + (auto-fill-mode)) + +(add-hook 'haml-mode-hook 'oni-haml--auto-fill-mode) + ;;;autoload (with-eval-after-load 'haml-mode (with-eval-after-load 'yasnippet diff --git a/oni-html/oni-html.el b/oni-html/oni-html.el index 0ea7cb6..48d3d82 100644 --- a/oni-html/oni-html.el +++ b/oni-html/oni-html.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0904.210616 +;; Version: 2019.1210.225526 ;; Package-Requires: (oni-yasnippet) ;; This program is free software; you can redistribute it and/or modify @@ -45,7 +45,13 @@ (add-to-list 'yas-snippet-dirs oni-html-snippets-dir t)) (yas-load-directory oni-html-snippets-dir)) +(defun oni-html--auto-fill-mode () + "Enable ‘auto-fill-mode’ only for comments." + (setq-local comment-auto-fill-only-comments t) + (auto-fill-mode)) + (add-hook 'html-mode-hook 'electric-pair-local-mode) +(add-hook 'html-mode-hook 'oni-html--auto-fill-mode) ;;;###autoload (with-eval-after-load 'sgml-mode diff --git a/oni-js.el b/oni-js.el index 7bdef55..534b0c8 100644 --- a/oni-js.el +++ b/oni-js.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0904.210640 +;; Version: 2019.1210.230928 ;; Package-Requires: (oni-company js2-mode js2-refactor oni-fci oni-flycheck tern company-tern fic-mode rjsx-mode) ;; This program is free software; you can redistribute it and/or modify @@ -40,6 +40,11 @@ (setq-local whitespace-style '(face tabs)) (whitespace-mode)) +(defun oni-js--auto-fill-mode () + "Enable ‘auto-fill-mode’ only for comments." + (setq-local comment-auto-fill-only-comments t) + (auto-fill-mode)) + (setq js-enabled-frameworks '(javascript)) (setq js2-include-node-externs t) @@ -49,6 +54,7 @@ (add-hook 'js-mode-hook 'electric-pair-local-mode) (add-hook 'js-mode-hook 'electric-indent-local-mode) +(add-hook 'js-mode-hook 'oni-js--auto-fill-mode) (add-hook 'js2-mode-hook 'company-mode) (add-hook 'js2-mode-hook 'electric-pair-local-mode) @@ -59,6 +65,7 @@ (add-hook 'js2-mode-hook 'oni-js-whitespace-mode) (add-hook 'js2-mode-hook 'subword-mode) (add-hook 'js2-mode-hook 'tern-mode) +(add-hook 'js2-mode-hook 'oni-js--auto-fill-mode) (js2r-add-keybindings-with-prefix "C-c r") diff --git a/oni-makefile.el b/oni-makefile.el index 418976e..74815ed 100644 --- a/oni-makefile.el +++ b/oni-makefile.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0904.210656 +;; Version: 2019.1210.231019 ;; Package-Requires: (oni-fci) ;; This program is free software; you can redistribute it and/or modify @@ -33,9 +33,15 @@ (setq-local whitespace-style '(face tabs)) (whitespace-mode)) +(defun oni-makefile--auto-fill-mode () + "Enable ‘auto-fill-mode’ only for comments." + (setq-local comment-auto-fill-only-comments t) + (auto-fill-mode)) + (add-hook 'makefile-mode-hook #'oni-makefile--whitespace-mode) (add-hook 'makefile-mode-hook 'electric-pair-local-mode) (add-hook 'makefile-mode-hook 'fci-mode) +(add-hook 'makefile-mode-hook 'oni-makefile--auto-fill-mode) ;;;###autoload(with-eval-after-load 'make-mode (require 'oni-makefile)) diff --git a/oni-nxml/oni-nxml.el b/oni-nxml/oni-nxml.el index fe188a5..07c1c87 100644 --- a/oni-nxml/oni-nxml.el +++ b/oni-nxml/oni-nxml.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0904.210700 +;; Version: 2019.1210.225630 ;; Package-Requires: (oni-yasnippet) ;; This program is free software; you can redistribute it and/or modify @@ -45,6 +45,13 @@ (add-to-list 'yas-snippet-dirs oni-nxml-snippets-dir t)) (yas-load-directory oni-nxml-snippets-dir)) +(defun oni-nxml--auto-fill-mode () + "Enable ‘auto-fill-mode’ only for comments." + (setq-local comment-auto-fill-only-comments t) + (auto-fill-mode)) + +(add-hook 'nxml-mode-hook 'oni-nxml--auto-fill-mode) + ;;;###autoload (add-to-list 'auto-mode-alist '("\\.targets\\'" . nxml-mode)) ;;;###autoload diff --git a/oni-php/oni-php.el b/oni-php/oni-php.el index 8070408..c6f4757 100644 --- a/oni-php/oni-php.el +++ b/oni-php/oni-php.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0904.210734 +;; Version: 2019.1210.224202 ;; Package-Requires: (php-mode oni-yasnippet oni-flycheck oni-company oni-fci ggtags fic-mode hydra company-php phpcbf) ;; This program is free software; you can redistribute it and/or modify @@ -61,6 +61,11 @@ nil for some reason." (setq-local whitespace-style '(face tabs)) (whitespace-mode)) +(defun oni-php--auto-fill-mode () + "Enable ‘auto-fill-mode’ only for comments." + (setq-local comment-auto-fill-only-comments t) + (auto-fill-mode)) + (defhydra php-mode-hydra (:color blue) ("a" align-current "Align current selection")) @@ -74,6 +79,7 @@ nil for some reason." (add-hook 'php-mode-hook 'flycheck-mode) (add-hook 'php-mode-hook 'ggtags-mode) (add-hook 'php-mode-hook 'phpcbf-enable-on-save) +(add-hook 'php-mode-hook 'oni-php--auto-fill-mode) (with-eval-after-load 'company (add-to-list 'company-backends 'company-ac-php-backend)) diff --git a/oni-powershell.el b/oni-powershell.el index cc8d9f2..f06b4a3 100644 --- a/oni-powershell.el +++ b/oni-powershell.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0927.093325 +;; Version: 2019.1210.231059 ;; Package-Requires: (powershell) ;; This program is free software; you can redistribute it and/or modify @@ -28,6 +28,13 @@ (require 'powershell) +(defun oni-powershell--auto-fill-mode () + "Enable ‘auto-fill-mode’ only for comments." + (setq-local comment-auto-fill-only-comments t) + (auto-fill-mode)) + +(add-hook 'powershell-mode-hook 'oni-powershell--auto-fill-mode) + ;;;###autoload(with-eval-after-load 'powershell (require 'powershell)) (provide 'oni-powershell) diff --git a/oni-python/oni-python.el b/oni-python/oni-python.el index 79ced5f..1496bf6 100644 --- a/oni-python/oni-python.el +++ b/oni-python/oni-python.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0904.210747 +;; Version: 2019.1210.230756 ;; Package-Requires: (oni-yasnippet oni-company company-jedi oni-fci oni-flycheck rainbow-delimiters reformatter traad hydra) ;; This program is free software; you can redistribute it and/or modify diff --git a/oni-ruby/oni-ruby.el b/oni-ruby/oni-ruby.el index 14b12d2..8e7b694 100644 --- a/oni-ruby/oni-ruby.el +++ b/oni-ruby/oni-ruby.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0904.210755 +;; Version: 2019.1210.225801 ;; Package-Requires: (ruby-mode oni-fci oni-yasnippet) ;; This program is free software; you can redistribute it and/or modify @@ -45,9 +45,15 @@ (add-to-list 'yas-snippet-dirs oni-ruby-snippets-dir)) (yas-load-directory oni-ruby-snippets-dir)) +(defun oni-ruby--auto-fill-mode () + "Enable ‘auto-fill-mode’ only for comments." + (setq-local comment-auto-fill-only-comments t) + (auto-fill-mode)) + (add-hook 'ruby-mode-hook 'electric-indent-local-mode) (add-hook 'ruby-mode-hook 'electric-pair-local-mode) (add-hook 'ruby-mode-hook 'fci-mode) +(add-hook 'ruby-mode-hook 'oni-ruby--auto-fill-mode) ;;;###autoload (with-eval-after-load 'ruby-mode diff --git a/oni-rust.el b/oni-rust.el index afc4263..5474d85 100644 --- a/oni-rust.el +++ b/oni-rust.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0904.210801 +;; Version: 2019.1210.231207 ;; Package-Requires: (rust-mode oni-flycheck rainbow-delimiters) ;; This program is free software; you can redistribute it and/or modify @@ -26,10 +26,16 @@ ;;; Code: +(defun oni-rust--auto-fill-mode () + "Enable ‘auto-fill-mode’ only for comments." + (setq-local comment-auto-fill-only-comments t) + (auto-fill-mode)) + (add-hook 'rust-mode-hook 'flycheck-mode) (add-hook 'rust-mode-hook 'electric-pair-local-mode) (add-hook 'rust-mode-hook 'electric-indent-local-mode) (add-hook 'rust-mode-hook 'rainbow-delimiters-mode) +(add-hook 'rust-mode-hook 'oni-rust--auto-fill-mode) ;;;###autoload(with-eval-after-load 'rust-mode (require 'oni-rust)) diff --git a/oni-scheme.el b/oni-scheme.el index 6a26ff5..817bab9 100644 --- a/oni-scheme.el +++ b/oni-scheme.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0904.210805 +;; Version: 2019.1210.231332 ;; Package-Requires: (oni-company oni-paredit oni-fci rainbow-delimiters) ;; This program is free software; you can redistribute it and/or modify @@ -26,10 +26,16 @@ ;;; Code: +(defun oni-scheme--auto-fill-mode () + "Enable ‘auto-fill-mode’ only for comments." + (setq-local comment-auto-fill-only-comments t) + (auto-fill-mode)) + (add-hook 'scheme-mode-hook 'company-mode) (add-hook 'scheme-mode-hook 'fci-mode) (add-hook 'scheme-mode-hook 'paredit-mode) (add-hook 'scheme-mode-hook 'rainbow-delimiters-mode) +(add-hook 'scheme-mode-hook 'oni-scheme--auto-fill-mode) (add-to-list 'interpreter-mode-alist '("scsh" . scheme-mode)) diff --git a/oni-twig/oni-twig.el b/oni-twig/oni-twig.el index 65b0cf3..0dbdbdc 100644 --- a/oni-twig/oni-twig.el +++ b/oni-twig/oni-twig.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0904.210836 +;; Version: 2019.1210.230023 ;; Package-Requires: (twig-mode oni-yasnippet) ;; This program is free software; you can redistribute it and/or modify @@ -45,6 +45,13 @@ (add-to-list 'yas-snippet-dirs oni-twig-snippets-dir)) (yas-load-directory oni-twig-snippets-dir)) +(defun oni-twig--auto-fill-mode () + "Enable ‘auto-fill-mode’ only for comments." + (setq-local comment-auto-fill-only-comments t) + (auto-fill-mode)) + +(add-hook 'twig-mode-hook 'oni-twig--auto-fill-mode) + ;;;###autoload (with-eval-after-load 'twig-mode (with-eval-after-load 'yasnippet diff --git a/oni-web.el b/oni-web.el index 6993220..2dc78df 100644 --- a/oni-web.el +++ b/oni-web.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0904.210848 +;; Version: 2019.1210.231451 ;; Package-Requires: (web-mode oni-flycheck) ;; This program is free software; you can redistribute it and/or modify @@ -27,12 +27,18 @@ ;;; Code: (require 'web-mode) +(require 'whitespace) (defun oni-web--whitespace-mode () "Enable whitespace mode with only tabs showing." (setq-local whitespace-style '(face tabs)) (whitespace-mode)) +(defun oni-web--auto-fill-mode () + "Enable ‘auto-fill-mode’ only for comments." + (setq-local comment-auto-fill-only-comments t) + (auto-fill-mode)) + (setq web-mode-attr-indent-offset 2) (setq web-mode-auto-quote-style 1) (setq web-mode-code-indent-offset 2) @@ -43,6 +49,7 @@ (add-hook 'web-mode-hook 'electric-pair-local-mode) (add-hook 'web-mode-hook 'flycheck-mode) (add-hook 'web-mode-hook #'oni-web--whitespace-mode) +(add-hook 'web-mode-hook 'oni-web--auto-fill-mode) ;;;###autoload(with-eval-after-load 'web-mode (require 'oni-web)) diff --git a/oni-yaml.el b/oni-yaml.el index e7a305a..b838062 100644 --- a/oni-yaml.el +++ b/oni-yaml.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.0904.210852 +;; Version: 2019.1210.231537 ;; Package-Requires: (yaml-mode oni-flycheck oni-fci oni-highlight-indent-guides flycheck-yamllint indent-tools yaml-imenu) ;; This program is free software; you can redistribute it and/or modify @@ -30,11 +30,17 @@ (require 'yaml-imenu) (require 'flycheck-yamllint) +(defun oni-yaml--auto-fill-mode () + "Enable ‘auto-fill-mode’ only for comments." + (setq-local comment-auto-fill-only-comments t) + (auto-fill-mode)) + (define-key yaml-mode-map (kbd "C-c >") 'indent-tools-hydra/body) (add-hook 'yaml-mode-hook 'fci-mode) (add-hook 'yaml-mode-hook 'highlight-indent-guides-mode) (add-hook 'yaml-mode-hook 'yaml-imenu-enable) +(add-hook 'yaml-mode-hook 'oni-yaml--auto-fill-mode) (flycheck-yamllint-setup)