diff options
Diffstat (limited to 'emacs/.emacs.d')
-rw-r--r-- | emacs/.emacs.d/init.org | 21 | ||||
-rw-r--r-- | emacs/.emacs.d/init/oni-compilation-init.org | 32 | ||||
-rw-r--r-- | emacs/.emacs.d/init/oni-css-mode-init.org | 59 |
3 files changed, 100 insertions, 12 deletions
diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 8052c76..4893871 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -487,6 +487,15 @@ To start off, first I need to enable lexical binding. (add-hook 'minibuffer-setup-hook 'electric-pair-local-mode) #+END_SRC +* Shackle + + Shackle is an abstraction over =display-buffer-alist=. + + #+BEGIN_SRC emacs-lisp + (require 'shackle) + (shackle-mode) + #+END_SRC + * Libraries - [[file:init/oni-shr-init.org][shr]] @@ -763,7 +772,7 @@ To start off, first I need to enable lexical binding. - [[file:init/oni-compilation-init.org][compilation-mode]] #+BEGIN_SRC emacs-lisp - (with-eval-after-load 'compilation (load "oni-compilation-init")) + (with-eval-after-load 'compile (load "oni-compilation-init")) #+END_SRC ** Inferior Emacs lisp mode (ielm) @@ -1061,8 +1070,8 @@ To start off, first I need to enable lexical binding. #+BEGIN_SRC emacs-lisp (setq jabber-account-list - `((,(concat "ryuslash@dukgo.com/" (system-name))) - (:connection-type . starttls))) + `((,(concat "ryuslash@dukgo.com/" (system-name)) + (:connection-type . starttls)))) #+END_SRC Store any persistent data in the data directory. @@ -1076,11 +1085,11 @@ To start off, first I need to enable lexical binding. #+BEGIN_SRC emacs-lisp (setq jabber-chat-buffer-format "+%n" - jabber-chat-foreign-prompt-format "%t %u " - jabber-chat-local-prompt-format "%t %u " + jabber-chat-foreign-prompt-format "%t %n " + jabber-chat-local-prompt-format "%t %n " jabber-chat-delayed-time-format "%H:%M" jabber-groupchat-buffer-format "++%n" - jabber-groupchat-prompt-format "%t %u ") + jabber-groupchat-prompt-format "%t %n ") #+END_SRC Don't show avatars, publish or retrieve avatars. diff --git a/emacs/.emacs.d/init/oni-compilation-init.org b/emacs/.emacs.d/init/oni-compilation-init.org index 2813654..162f7d2 100644 --- a/emacs/.emacs.d/init/oni-compilation-init.org +++ b/emacs/.emacs.d/init/oni-compilation-init.org @@ -1,21 +1,41 @@ #+TITLE: Compilation mode configuration +#+BEGIN_SRC emacs-lisp + (require 'compile) + (require 'shackle) + (require 'subr-x) +#+END_SRC + Scroll output in compilation mode. #+BEGIN_SRC emacs-lisp (setq compilation-scroll-output t) #+END_SRC -Show compilation buffers in a side window. +Don't show the compilation window when compilation starts. #+BEGIN_SRC emacs-lisp - (add-to-list 'display-buffer-alist - `(,(rx bos "*compilation*" eos) - display-buffer-in-side-window)) + (defun oni:maybe-dont-show-window (buffer-or-name alist plist) + "Don't show BUFFER-OR-NAME unless it absolutely must." + (if (alist-get 'allow-no-window alist) + buffer-or-name + (funcall (plist-get plist :fallback) buffer-or-name alist + (plist-put (copy-sequence plist) :custom nil)))) + + (add-to-list 'shackle-rules + '(compilation-mode :custom oni:maybe-dont-show-window + :fallback shackle-display-buffer + :other t :select t)) #+END_SRC -Bury compilation buffers on successful compilation. +Show the compilation window when compilation has finished with a +non-zero exit status. #+BEGIN_SRC emacs-lisp - (bury-successful-compilation) + (defun oni:maybe-display-compilation-window (buffer status) + "Display BUFFER if STATUS is not finished." + (unless (string= (string-trim status) "finished") + (display-buffer buffer))) + + (add-hook 'compilation-finish-functions #'oni:maybe-display-compilation-window) #+END_SRC diff --git a/emacs/.emacs.d/init/oni-css-mode-init.org b/emacs/.emacs.d/init/oni-css-mode-init.org index c683af0..447f9ec 100644 --- a/emacs/.emacs.d/init/oni-css-mode-init.org +++ b/emacs/.emacs.d/init/oni-css-mode-init.org @@ -27,3 +27,62 @@ 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 |