From 61496a0b817e54d6b67e0ac09ab0fb1611bad9f3 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 29 May 2018 01:02:11 -0700 Subject: Move more from org-mode --- emacs/.emacs.d/init.el | 4 ++- emacs/.emacs.d/init/oni-align.el | 62 ++++++++++++++++++++++++++++++++++++ emacs/.emacs.d/init/oni-bookmark.el | 38 ++++++++++++++++++++++ emacs/.emacs.d/init/oni-bookmarks.el | 38 ---------------------- 4 files changed, 103 insertions(+), 39 deletions(-) create mode 100644 emacs/.emacs.d/init/oni-bookmark.el delete mode 100644 emacs/.emacs.d/init/oni-bookmarks.el (limited to 'emacs/.emacs.d') diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 058e86e..5fa6186 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -145,7 +145,9 @@ ;;;; Lazy configurations: -(with-eval-after-load 'bookmark (load "init/oni-bookmarks")) +(with-eval-after-load 'bookmark (load "init/oni-bookmark")) +(with-eval-after-load 'align (load "init/oni-align")) +(with-eval-after-load 'browse-url (load "init/oni-browse-url")) (provide 'init) ;;; init.el ends here diff --git a/emacs/.emacs.d/init/oni-align.el b/emacs/.emacs.d/init/oni-align.el index c42a5dd..9e42e3f 100644 --- a/emacs/.emacs.d/init/oni-align.el +++ b/emacs/.emacs.d/init/oni-align.el @@ -26,7 +26,69 @@ (require 'align) +;; Align CSS files like so: +;; body { color: #ffffff; } +;; .some-class { background-color: #ffffff; } +;; #some-id { width: 200px; } + +;; .some-more-class { +;; color: #ffffff; +;; background-color: #ffffff; +;; width: 200px; +;; } + +;; Keep these in order. They are each added to the _front_ of the +;; list and are applied in order. Changing their order will change +;; the results. +(add-to-list 'align-rules-list + `(css-closing-brace + (regexp . ,(rx (group (0+ whitespace)) "}" eol)) + (group . (1)) + (modes . '(scss-mode css-mode)))) + +(add-to-list 'align-rules-list + `(css-colons + (regexp . ,(rx bol + (0+ whitespace) + (1+ (any (?a . ?z) ?- ?$)) + ":" + (group (0+ whitespace)) + (0+ nonl) + ";" + eol)) + (group . (1)) + (modes . '(scss-mode css-mode)) + (repeat . t))) + +(add-to-list 'align-rules-list + `(css-opening-brace + (regexp . ,(rx bol + (0+ whitespace) + (0+ (any ?# ?. ?, ?\s ?& ?: ?- + (?a . ?z) (?A . ?Z) (?0 . ?9))) + (any (?a . ?z) (?A . ?Z) (?0 . ?9)) + (group (0+ whitespace)) + "{" + (0+ nonl))) + (group . (1)) + (modes . '(scss-mode css-mode)))) + +;; In PHP code it's nice to have any ~=>~ aligned. + +;; 'bar', +;; 'frob' => 'baz' +;; ); +;; ?> + +(add-to-list 'align-rules-list + `(php-array-arrow + (regexp . ,(rx any (group whitespace) "=>" any)) + (group . (1)) + (modes . '(php-mode web-mode)) + (repeat . t))) (provide 'oni-align) ;;; oni-align.el ends here diff --git a/emacs/.emacs.d/init/oni-bookmark.el b/emacs/.emacs.d/init/oni-bookmark.el new file mode 100644 index 0000000..2b7d637 --- /dev/null +++ b/emacs/.emacs.d/init/oni-bookmark.el @@ -0,0 +1,38 @@ +;;; oni-bookmarks.el --- Bookmarks settings -*- lexical-binding: t; -*- + +;; Copyright (C) 2018 Tom Willemse + +;; Author: Tom Willemse +;; 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 . + +;;; Commentary: + +;; Settings for `bookmarks.el'. Keeping these in the main file will +;; make the byte compiler complain, or require ugly code to shut it +;; up. + +;;; Code: + +(require 'bookmark) + +(defvar oni-bookmarks--bookmark-file-location + (locate-user-emacs-file "data/bookmarks") + "The location for Emacs bookmarks.") + +(setq bookmark-default-file oni-bookmarks--bookmark-file-location) + +(provide 'oni-bookmarks) +;;; oni-bookmarks.el ends here diff --git a/emacs/.emacs.d/init/oni-bookmarks.el b/emacs/.emacs.d/init/oni-bookmarks.el deleted file mode 100644 index 2b7d637..0000000 --- a/emacs/.emacs.d/init/oni-bookmarks.el +++ /dev/null @@ -1,38 +0,0 @@ -;;; oni-bookmarks.el --- Bookmarks settings -*- lexical-binding: t; -*- - -;; Copyright (C) 2018 Tom Willemse - -;; Author: Tom Willemse -;; 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 . - -;;; Commentary: - -;; Settings for `bookmarks.el'. Keeping these in the main file will -;; make the byte compiler complain, or require ugly code to shut it -;; up. - -;;; Code: - -(require 'bookmark) - -(defvar oni-bookmarks--bookmark-file-location - (locate-user-emacs-file "data/bookmarks") - "The location for Emacs bookmarks.") - -(setq bookmark-default-file oni-bookmarks--bookmark-file-location) - -(provide 'oni-bookmarks) -;;; oni-bookmarks.el ends here -- cgit v1.2.3-54-g00ecf