aboutsummaryrefslogtreecommitdiffstats
path: root/emacs
diff options
context:
space:
mode:
authorGravatar Tom Willemse2018-07-09 18:49:12 -0700
committerGravatar Tom Willemse2018-07-09 18:49:12 -0700
commitaccea011e3640de1f64568ef2c7595e405b5373e (patch)
treee02e671cecea0ad460445a067a5799e96a78ce06 /emacs
parenta2227eb50a350f944ee1546df006937db825be93 (diff)
downloadnew-dotfiles-accea011e3640de1f64568ef2c7595e405b5373e.tar.gz
new-dotfiles-accea011e3640de1f64568ef2c7595e405b5373e.zip
Move CSS configuration out of Org-mode
Diffstat (limited to 'emacs')
-rw-r--r--emacs/.emacs.d/init/oni-css-mode-init.el80
-rw-r--r--emacs/.emacs.d/init/oni-css-mode-init.org88
2 files changed, 80 insertions, 88 deletions
diff --git a/emacs/.emacs.d/init/oni-css-mode-init.el b/emacs/.emacs.d/init/oni-css-mode-init.el
new file mode 100644
index 0000000..0a57104
--- /dev/null
+++ b/emacs/.emacs.d/init/oni-css-mode-init.el
@@ -0,0 +1,80 @@
+;;; oni-css-mode-init.el --- CSS Mode configuration -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Tom Willemse
+
+;; Author: Tom Willemse <tom@ryuslash.org>
+;; Keywords: local
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Configuration for `css-mode'.
+
+;;; Code:
+
+(require 'css-mode)
+(eval-when-compile (require 'compile))
+
+(defun oni:css-property-important-p ()
+ "Return whether or not the current property is important."
+ (save-excursion
+ (beginning-of-line)
+ (re-search-forward "!important" (line-end-position) :noerror)))
+
+(defun oni:css-add-important ()
+ "Add an important flag to the property on the current line."
+ (interactive)
+ (unless (oni:css-property-important-p)
+ (save-excursion
+ (end-of-line)
+ (when (re-search-backward ";" (line-beginning-position) :noerror)
+ (insert " !important")))))
+
+(defun oni:css-remove-important ()
+ "Remove the important flag from the property on the current line."
+ (interactive)
+ (when (oni:css-property-important-p)
+ (save-excursion
+ (end-of-line)
+ (when (re-search-backward " !important" (line-beginning-position) :noerror)
+ (replace-match "")))))
+
+(defun oni:css-toggle-important ()
+ "Toggle the important flag on the property on the current line."
+ (interactive)
+ (if (oni:css-property-important-p)
+ (oni:css-remove-important)
+ (oni:css-add-important)))
+
+(add-hook 'css-mode-hook 'electric-pair-local-mode)
+(add-hook 'css-mode-hook 'electric-indent-local-mode)
+(add-hook 'css-mode-hook 'company-mode)
+(add-hook 'css-mode-hook 'fci-mode)
+
+(with-eval-after-load 'compile
+ (defvar oni:scss-error-regexp
+ (rx (and bol
+ (zero-or-more space) "on line "
+ (group (one-or-more digit)) " of "
+ (group (one-or-more (or word punct (syntax symbol))))
+ eol)))
+
+ (add-to-list 'compilation-error-regexp-alist
+ (list oni:scss-error-regexp 2 1 nil 2 2)))
+
+(define-key css-mode-map (kbd "C-c !") #'oni:css-toggle-important)
+
+(provide 'oni-css-mode-init)
+;;; oni-css-mode-init.el ends here
diff --git a/emacs/.emacs.d/init/oni-css-mode-init.org b/emacs/.emacs.d/init/oni-css-mode-init.org
deleted file mode 100644
index 447f9ec..0000000
--- a/emacs/.emacs.d/init/oni-css-mode-init.org
+++ /dev/null
@@ -1,88 +0,0 @@
-#+TITLE: CSS
-
-scss-mode is based on css-mode, so any settings for css-mode also
-automatically should work for scss-mode.
-
-Enable electric pairing.
-
-#+BEGIN_SRC emacs-lisp
- (add-hook 'css-mode-hook 'electric-pair-local-mode)
-#+END_SRC
-
-Enable electric indenting.
-
-#+BEGIN_SRC emacs-lisp
- (add-hook 'css-mode-hook 'electric-indent-local-mode)
-#+END_SRC
-
-Enable company mode.
-
-#+BEGIN_SRC emacs-lisp
- (add-hook 'css-mode-hook 'company-mode)
-#+END_SRC
-
-Enable rainbow mode to see all the color specifications (well, most)
-as pretty colors.
-
-#+BEGIN_SRC emacs-lisp
- (add-hook 'css-mode-hook 'rainbow-mode)
-#+END_SRC
-
-Add the scssc compiler's error message output to the compilation error
-regexps.
-
-#+BEGIN_SRC emacs-lisp
- (eval-when-compile (require 'compile))
-
- (with-eval-after-load 'compile
- (defvar oni:scss-error-regexp
- (rx (and bol
- (zero-or-more space) "on line "
- (group (one-or-more digit)) " of "
- (group (one-or-more (or word punct (syntax symbol))))
- eol)))
-
- (add-to-list 'compilation-error-regexp-alist
- (list oni:scss-error-regexp 2 1 nil 2 2)))
-#+END_SRC
-
-Add a command to toggle the =!important= flag on CSS properties.
-
-#+BEGIN_SRC emacs-lisp
- (defun oni:css-property-important-p ()
- "Return whether or not the current property is important."
- (save-excursion
- (beginning-of-line)
- (re-search-forward "!important" (line-end-position) :noerror)))
-
- (defun oni:css-add-important ()
- "Add an important flag to the property on the current line."
- (interactive)
- (unless (oni:css-property-important-p)
- (save-excursion
- (end-of-line)
- (when (re-search-backward ";" (line-beginning-position) :noerror)
- (insert " !important")))))
-
- (defun oni:css-remove-important ()
- "Remove the important flag from the property on the current line."
- (interactive)
- (when (oni:css-property-important-p)
- (save-excursion
- (end-of-line)
- (when (re-search-backward " !important" (line-beginning-position) :noerror)
- (replace-match "")))))
-
- (defun oni:css-toggle-important ()
- "Toggle the important flag on the property on the current line."
- (interactive)
- (if (oni:css-property-important-p)
- (oni:css-remove-important)
- (oni:css-add-important)))
-#+END_SRC
-
-Add a keybinding to toggle the =!important= flag on the current line.
-
-#+BEGIN_SRC emacs-lisp
- (global-set-key (kbd "C-c !") #'oni:css-toggle-important)
-#+END_SRC