Merge remote-tracking branch 'origin/index' into index

This commit is contained in:
Tom Willemse 2017-01-08 13:33:08 +01:00
commit 0ee856c6f3
80 changed files with 1182 additions and 270 deletions

View file

@ -1 +1,2 @@
-/emacs/.emacs.d/.python-environments
-/emacs/.emacs.d/.cask

6
GNUmakefile Normal file
View file

@ -0,0 +1,6 @@
.PHONY: all zsh
all: zsh
zsh:
$(MAKE) -C $@

View file

@ -38,6 +38,7 @@ one window in the group has focus.
#+BEGIN_SRC conf
shadow-exclude = [
"name = 'mowedline'",
"class_g = 'trayer'",
"bounding_shaped"
];
#+END_SRC

View file

@ -98,3 +98,33 @@ Add the ~site-js/~ directory to the load path.
define_key(default_global_keymap, 'p', 'scuttle-post');
define_key(default_global_keymap, 'P', 'scuttle-post-link');
#+END_SRC
* Emacs integration
Using org-protocol we can add information from the page.
#+BEGIN_SRC js
function org_capture(url, title, selection, window) {
var cmd_str = 'emacsclient "org-protocol://capture://b/' + url + '/' + title + '/' + selection + '"';
if (window !== null) {
window.minibuffer.message('Issuing ' + cmd_str);
}
shell_command_blind(cmd_str);
}
function org_capture_command(I) {
var url = encodeURIComponent(I.buffer.display_uri_string);
var title = encodeURIComponent(I.buffer.document.title);
var selection = encodeURIComponent(I.buffer.top_frame.getSelection());
org_capture(url, title, selection, I.window);
}
interactive("org-capture",
"Clip url, title and selection to capture via org-protocol",
org_capture_command);
define_key(content_buffer_normal_keymap, "C-c b", "org-capture");
#+END_SRC

View file

@ -1,9 +1,12 @@
EMACS = /usr/bin/emacs
SCHEME_IMPLEMENTATION = guile
define tangle =
@echo -e "\e[35mOBT\e[0m" $<
@$(EMACS) -batch \
-eval "(package-initialize)" \
-load ob-tangle \
-eval "(setq sh-make-vars-local nil)" \
-eval "(setq geiser-default-implementation '$(SCHEME_IMPLEMENTATION))" \
-eval "(org-babel-tangle-file \"$<\" \"$(notdir $@)\" \"$(1)\")"
endef

View file

@ -6,7 +6,8 @@ SITE_LISPS = $(addsuffix c,$(filter-out $(UNWANTED),$(wildcard site-lisp/*.el)))
INIT_LISPS = $(addsuffix .elc,$(basename $(wildcard init/*.org)))
VENDOR_DIRS = $(wildcard vendor-lisp/*)
all: $(SITE_LISPS) init.elc $(INIT_LISPS) $(AUTOLOADS_FILE)
.PHONE: all snippets
all: $(SITE_LISPS) init.elc $(INIT_LISPS) $(AUTOLOADS_FILE) snippets
%.el: %.org
$(call tangle,emacs-lisp)
@ -28,3 +29,17 @@ $(AUTOLOADS_FILE): $(SITE_LISPS)
@$(EMACS) -batch \
-eval "(setq generated-autoload-file \"$(CURDIR)/$@\")" \
-eval "(update-directory-autoloads \"$(CURDIR)/site-lisp/\")"
### Snippets
SNIPPET_DIRS = $(wildcard snippets/*)
COMPILED_SNIPPETS = $(addsuffix /.yas-compiled-snippets.el, $(SNIPPET_DIRS))
%/.yas-compiled-snippets.el: %/*
@echo -e "\e[36mYAS\e[0m $(CURDIR)/snippets"
@$(EMACS) -batch \
-eval "(package-initialize)" \
-l yasnippet \
-eval "(yas-compile-directory \"$(CURDIR)/snippets\")"
snippets: $(COMPILED_SNIPPETS)

View file

@ -264,12 +264,33 @@ To start off, first I need to enable lexical binding.
* Theme
Load my personal theme. I sometimes change it to a different theme,
but for some reason I always come crawling back to it.
#+BEGIN_SRC emacs-lisp
(add-to-list 'custom-theme-load-path
(concat user-emacs-directory "vendor-lisp/yoshi-theme"))
(load-theme 'yoshi :no-confirm)
#+END_SRC
Load my personal SVG mode-line theme.
#+BEGIN_SRC emacs-lisp
(require 'svg-mode-line-themes)
(require 'oni-smt)
(smt/enable)
(smt/set-theme 'oni-smt)
#+END_SRC
Because SVG mode-line themes doesn't include the box around the
mode-line, remove it (my personal theme adds it as padding).
#+BEGIN_SRC emacs-lisp
(set-face-attribute 'mode-line nil :box nil)
(set-face-attribute 'mode-line-inactive nil :box nil)
#+END_SRC
* Diminish
I really don't need to see some of the minor modes.
@ -466,6 +487,14 @@ To start off, first I need to enable lexical binding.
(add-hook 'minibuffer-setup-hook 'electric-pair-local-mode)
#+END_SRC
* Libraries
- [[file:init/oni-shr-init.org][shr]]
#+BEGIN_SRC emacs-lisp
(with-eval-after-load 'shr (load "oni-shr-init"))
#+END_SRC
* Minor modes
- [[file:init/oni-company-init.org][Company mode]] :: A better auto completion system than auto
@ -728,7 +757,13 @@ To start off, first I need to enable lexical binding.
- [[file:init/oni-scheme-init.org][scheme-mode]] :: Scheme is an awesome lisp variant.
#+BEGIN_SRC emacs-lisp
(with-eval-after-load 'scheme-mode (load "oni-scheme-init"))
(with-eval-after-load 'scheme (load "oni-scheme-init"))
#+END_SRC
- [[file:init/oni-compilation-init.org][compilation-mode]]
#+BEGIN_SRC emacs-lisp
(with-eval-after-load 'compilation (load "oni-compilation-init"))
#+END_SRC
** Inferior Emacs lisp mode (ielm)

View file

@ -5,6 +5,7 @@
(require 'circe-color-nicks)
(require 'circe-serenity)
(require 'oni-circe)
(require 'mowedline)
#+END_SRC
I switched to Circe from ERC because I couldn't make the
@ -21,7 +22,9 @@ I spend most of my time on IRC on Freenode.
"#ninthfloor"
"#dispass"
"#linuxvoice"
"#conkeror")
"#conkeror"
"#emacs-circe"
"#chicken")
:nickserv-password
,(oni-circe-get-password-for "irc.freenode.net")))
#+END_SRC
@ -50,3 +53,66 @@ Serenity.
#+BEGIN_SRC emacs-lisp
(enable-circe-serenity)
#+END_SRC
Add external tracking. Show the status of tracked buffers in
mowedline instead in the mode-line. With color!
This code has been generously donated by [[http://retroj.net][retroj]], the author of
mowedline.
First define a function to parse the text properties from the tracking
buffers list so that highlights (from mentions) also appear in
mowedline.
#+BEGIN_SRC emacs-lisp
(defun mowedline-colorize-mode-line-spec (s)
(cond
((stringp s) (string-trim s))
((eq ':propertize (car s))
(let ((s (cadr s))
(face (plist-get (cddr s) 'face)))
(if face
`(color ,(face-foreground face)
,(substring-no-properties s))
s)))
(t "")))
#+END_SRC
Also tell mowedline to use the dbus interface directly, instead of
going through the command-line interface.
#+BEGIN_SRC emacs-lisp
(setq mowedline-update-function 'mowedline-update/dbus)
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defvar jjf-tracking-buffers '())
(defvar jjf-external-tracking-timer nil)
(defun jjf-external-tracking ()
(setq jjf-external-tracking-timer nil)
(mowedline-update
'irc
(if (stringp jjf-tracking-buffers)
(mowedline-colorize jjf-tracking-buffers t)
(format "%S" (mapcar #'mowedline-colorize-mode-line-spec
jjf-tracking-buffers)))))
(defun oni:clear-irc-mowedline-widget ()
(mowedline-clear 'irc))
(defun jjf-external-tracking-advice (orig-fun &rest args)
"Update my external status bar when tracking computes a new
status line, and suppress tracking in the mode-line. Since
tracking-status may be called many times in quick succession, for
example on a make-frame-visible event, we use a short timer to
only call the updater once within a minimum duration."
(setq jjf-tracking-buffers (apply orig-fun args))
(when jjf-external-tracking-timer
(cancel-timer jjf-external-tracking-timer))
(setq jjf-external-tracking-timer
(run-at-time 0.2 nil 'jjf-external-tracking))
nil)
(advice-add 'tracking-status :around #'jjf-external-tracking-advice)
(add-hook 'kill-emacs-hook 'oni:clear-irc-mowedline-widget)
#+END_SRC

View file

@ -0,0 +1,21 @@
#+TITLE: Compilation mode configuration
Scroll output in compilation mode.
#+BEGIN_SRC emacs-lisp
(setq compilation-scroll-output t)
#+END_SRC
Show compilation buffers in a side window.
#+BEGIN_SRC emacs-lisp
(add-to-list 'display-buffer-alist
`(,(rx bos "*compilation*" eos)
display-buffer-in-side-window))
#+END_SRC
Bury compilation buffers on successful compilation.
#+BEGIN_SRC emacs-lisp
(bury-successful-compilation)
#+END_SRC

View file

@ -24,3 +24,9 @@ Enable flycheck mode to help me avoid errors.
#+BEGIN_SRC emacs-lisp
(add-hook 'emacs-lisp-mode-hook 'flycheck-mode)
#+END_SRC
Enable namesless mode to help with viewing name-prefixed symbols.
#+BEGIN_SRC emacs-lisp
(add-hook 'emacs-lisp-mode-hook 'nameless-mode)
#+END_SRC

View file

@ -2,6 +2,7 @@
#+BEGIN_SRC emacs-lisp
(require 'org)
(require 'org-capture)
#+END_SRC
Tell org-mode to fontify code blocks in their specified languages.
@ -21,3 +22,22 @@ Enable automatic text filling for org-mode.
#+BEGIN_SRC emacs-lisp
(add-hook 'org-mode-hook 'auto-fill-mode)
#+END_SRC
* Org protocol
Load org-protocol to let external applications add information to
org.
#+BEGIN_SRC emacs-lisp
(require 'org-protocol)
#+END_SRC
This template is used by Conkeror to capture a bookmark into my
bookmarks file.
#+BEGIN_SRC emacs-lisp
(add-to-list 'org-capture-templates
'("b" "Bookmark" entry (file "~/documents/org/bookmarks.org")
"* %c\n\n %i"
:empty-lines 1))
#+END_SRC

View file

@ -0,0 +1,28 @@
#+TITLE: shr configuration
#+BEGIN_SRC emacs-lisp
(require 'shr)
#+END_SRC
* Remove background colors
Define a procedure that removes the last argument it gets if there
are more than 3.
#+BEGIN_SRC emacs-lisp
(defun oni:shr-colorize-remove-last-arg (args)
"If ARGS has more than 3 items, remove the last one."
(if (> (length args) 3)
(butlast args)
args))
#+END_SRC
Add the function as a filter-args advice to
=shr-colorize-region=. The last (fourth) argument to that function
is the background color to use, it's optional, so removing it
effectively stops shr from adding background colors.
#+BEGIN_SRC emacs-lisp
(advice-add #'shr-colorize-region :filter-args
#'oni:shr-colorize-remove-last-arg)
#+END_SRC

View file

@ -0,0 +1,252 @@
;;; oni-smt.el --- My SVG mode-line theme -*- lexical-binding: t; -*-
;; Copyright (C) 2014 Tom Willemse
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: faces
;; 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 <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;;; Code:
(require 'svg-mode-line-themes)
(require 'flycheck)
;; (require 'mode-icons)
(defun oni-smt-flycheck-errors-text (_)
"Show an indicator of the number of errors and warnings from flycheck."
(when flycheck-mode
(let* ((counts (flycheck-count-errors flycheck-current-errors))
(err-color (if (smt/window-active-p) "#a85454" "#969696"))
(warn-color (if (smt/window-active-p) "#a88654" "#969696"))
(info-color (if (smt/window-active-p) "#5476a8" "#969696"))
(err-count (alist-get 'error counts 0))
(warn-count (alist-get 'warning counts 0))
(info-count (alist-get 'info counts 0)))
`(tspan " " (tspan :fill ,err-color ,err-count)
"/" (tspan :fill ,warn-color ,warn-count)
"/" (tspan :fill ,info-color ,info-count)))))
(smt/defwidget oni-smt-flycheck-errors
:text #'oni-smt-flycheck-errors-text)
(defun oni-smt-jabber-activity-text (_)
"Show jabber activity indicator."
(if (and (smt/window-active-p)
(boundp 'jabber-activity-mode-string)
(not (equal jabber-activity-mode-string "")))
(concat jabber-activity-mode-string " ")))
(smt/defwidget oni-smt-jabber-activity
:text #'oni-smt-jabber-activity-text)
;;; TODO Turn:
;; #("message: (FORMAT-STRING &rest ARGS)"
;; 0 7 (face font-lock-function-name-face)
;; 10 23 (face eldoc-highlight-function-argument))
;;; into:
;;; (tspan (tspan :fill (fg-color font-lock-function-name-face) "message:")
;;; " ("
;;; (tspan :fill (fg-color highlight-function-argument) "FORMAT-STRING")
;;; " &rest ARGS)")
(defvar oni-smt-eldoc-message nil)
(defun oni-smt-eldoc-minibuffer-message (format-string &rest args)
(if (minibufferp)
(progn
(add-hook 'minibuffer-exit-hook
(lambda () (setq oni-smt-eldoc-message nil
eldoc-mode-line-string nil
eldoc-last-message nil))
nil t)
(setq oni-smt-eldoc-message
(when (stringp format-string)
(apply 'format format-string args)))
(force-mode-line-update t))
(apply 'message format-string args)))
(smt/defwidget oni-smt-eldoc-message
:text (lambda (widget)
(ignore widget)
(when oni-smt-eldoc-message
`(tspan :fill "#bfbfbf" " (" (tspan :fill "#5476a8" ,oni-smt-eldoc-message) ")"))))
(defun oni-smt-yoshi-title-style (_)
"Fill color for either active or inactive windows."
(list :fill (if (smt/window-active-p) "#65a854" "#969696")
:font-weight (if (smt/window-active-p) "bold" "normal")))
(smt/defwidget oni-smt-po-counters
:text (lambda (widget)
(ignore widget)
(when (eql major-mode 'po-mode)
(format " %dt+%df+%du+%do" po-translated-counter
po-fuzzy-counter po-untranslated-counter
po-obsolete-counter))))
(smt/defwidget oni-smt-buffer-identification
:style 'oni-smt-yoshi-title-style
:text (lambda (widget)
(ignore widget)
(concat
(string-trim
(substring-no-properties
(format-mode-line mode-line-buffer-identification)))
(when (and (or buffer-file-name
buffer-offer-save)
(buffer-modified-p))
"*"))))
(smt/defwidget oni-smt-current-dictionary
:text (lambda (widget)
(ignore widget)
(if flyspell-mode
(concat " " (or ispell-current-dictionary
ispell-local-dictionary
flyspell-default-dictionary)))))
(smt/defwidget oni-smt-erc
:text (lambda (_)
(when (boundp 'erc-modified-channels-alist)
erc-modified-channels-object)))
(smt/defwidget oni-smt-position
:text (lambda (_) (format-mode-line "%l/%c:%p")))
(defun oni-smt-read-only/write (_)
"Show a locked or unlocked icon."
`(tspan :font-family "FontAwesome"
:font-size 13
,(if buffer-read-only "" "")))
(smt/defwidget oni-smt-rwo
:text #'oni-smt-read-only/write)
(defun oni-smt-extra-minor-modes (minor-modes)
"Add some more info to MINOR-MODES."
(if (boundp 'evil-state)
(let ((l (capitalize (elt (symbol-name evil-state) 0))))
`(tspan ,minor-modes (tspan :fill "#54a875" ,(char-to-string l))))
minor-modes))
(add-function
:filter-return
(symbol-function 'smt/minor-mode-indicator-text)
#'oni-smt-extra-minor-modes)
(smt/defrow oni-smt-right
:prototype 'default-right
:widgets '(oni-smt-jabber-activity
oni-smt-erc
major-mode
oni-smt-current-dictionary
oni-smt-flycheck-errors
version-control
minor-modes)
:margin 17)
;; (defun smt/r-export-image (row theme)
;; `(image
;; :x ,(if (equal (smt/r-align row) "left")
;; (* (smt/r-margin row)
;; (frame-char-width))
;; (- (smt/window-pixel-width)
;; (* (smt/r-margin row)
;; (frame-char-width))))
;; :y 2
;; :width 16
;; :height 16
;; :xlink:href ,(concat "data:image/png;base64,"
;; (let ((name (nth 1 (mode-icons-get-icon-spec mode-name))))
;; (if name
;; (with-temp-buffer
;; (insert-file-contents (concat (mode-icons-get-icon-file name) ".png"))
;; (base64-encode-region (point-min) (point-max))
;; (buffer-substring-no-properties (point-min) (point-max)))
;; mode-name)))))
;; (smt/defrow oni-smt-major-mode
;; :prototype 'default-right
;; :export 'smt/r-export-image
;; :margin 40)
(smt/defrow oni-smt-left
:prototype 'default-left
:widgets '(buffer-info
oni-smt-rwo
oni-smt-buffer-identification
oni-smt-po-counters
which-function
oni-smt-eldoc-message))
(smt/defrow oni-smt-position
:prototype 'default-position
:widgets '(oni-smt-position))
(defun oni-smt-major-mode-style (widget)
(ignore widget)
'(:fill "#ccc" :font-family "Signika" :filter nil
:font-weight "regular" :font-style "italic"))
(defun oni-smt-background (_)
""
(let ((stops '(("0%" "#484848" 0.3)
("25%" "#484848" 0.3)
("75%" "#484848" 0.3)
("100%" "#111111" 0.3))))
`((\defs
(linearGradient
:id "twisted" :x1 "0%" :y1 "0%" :x2 "100%" :y2 "25%"
(stop :offset ,(first (nth 1 stops)) :stop-color ,(second (nth 1 stops)) :stop-opacity ,(third (nth 1 stops)))
(stop :offset ,(first (nth 2 stops)) :stop-color ,(second (nth 2 stops)) :stop-opacity ,(third (nth 2 stops)))
(stop :offset ,(first (nth 3 stops)) :stop-color ,(second (nth 3 stops)) :stop-opacity ,(third (nth 3 stops)))
(stop :offset ,(first (nth 4 stops)) :stop-color ,(second (nth 4 stops)) :stop-opacity ,(third (nth 4 stops)))))
(rect :width "100%" :height "100%" :x 0 :y 0 :fill "url(#twisted)"))))
(defun oni-smt-overlay (_)
""
(let ((stops '(("0%" "#FFFFFF" 0.1)
("20%" "#111111" 0.0)
("90%" "#111111" 0.5)
("100%" "#111111" 0.8))))
`((\defs
(linearGradient
:id "over-gradient" :x1 "0%" :y1 "0%" :x2 "0%" :y2 "100%"
(stop :offset ,(first (nth 1 stops)) :stop-color ,(second (nth 1 stops)) :stop-opacity ,(third (nth 1 stops)))
(stop :offset ,(first (nth 2 stops)) :stop-color ,(second (nth 2 stops)) :stop-opacity ,(third (nth 2 stops)))
(stop :offset ,(first (nth 3 stops)) :stop-color ,(second (nth 3 stops)) :stop-opacity ,(third (nth 3 stops)))
(stop :offset ,(first (nth 4 stops)) :stop-color ,(second (nth 4 stops)) :stop-opacity ,(third (nth 4 stops)))))
(rect :width "100%" :height "100%" :x 0 :y 0 :fill "url(#over-gradient)"))))
(smt/deftheme oni-smt
:prototype 'black-crystal
:overlay 'oni-smt-overlay
:background 'oni-smt-background
:local-widgets (list (cons 'major-mode
(smt/make-widget
:prototype 'major-mode
:style 'oni-smt-major-mode-style)))
:rows '(oni-smt-left oni-smt-position oni-smt-right))
(add-function :override (symbol-function 'eldoc-minibuffer-message)
#'oni-smt-eldoc-minibuffer-message)
(provide 'oni-smt)
;;; oni-smt.el ends here

View file

@ -0,0 +1,2 @@
((nil
(require-final-newline . nil)))

View file

@ -0,0 +1,8 @@
;;; Compiled snippets and support files for `conf-mode'
;;; Snippet definitions:
;;;
(yas-define-snippets 'conf-mode
'(("Section" "Section \"$1\"\n Identifier \"$2\"\n $0\nEndSection\n" "Xorg Section" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/conf-mode/section" nil nil)))
;;; Do not edit! File generated at Tue Nov 22 15:37:52 2016

View file

@ -0,0 +1,8 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: Xorg Section
# key: Section
# --
Section "$1"
Identifier "$2"
$0
EndSection

View file

@ -0,0 +1,8 @@
;;; Compiled snippets and support files for `css-mode'
;;; Snippet definitions:
;;;
(yas-define-snippets 'css-mode
'(("boxshadow" "box-shadow: ${1:offset-x} ${2:offset-y}${3: [blur-radius]}${4: [spread-radius]}${5: [color]};" "box-shadow" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/css-mode/box-shadow" nil nil)))
;;; Do not edit! File generated at Tue Nov 22 15:37:52 2016

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: box-shadow
# key: boxshadow
# --
box-shadow: ${1:offset-x} ${2:offset-y}${3: [blur-radius]}${4: [spread-radius]}${5: [color]};

View file

@ -0,0 +1,9 @@
;;; Compiled snippets and support files for `emacs-lisp-mode'
;;; Snippet definitions:
;;;
(yas-define-snippets 'emacs-lisp-mode
'(("face" " `($1 ((t (${2::foreground} $0))))" "face" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/emacs-lisp-mode/face" nil nil)
("do" "(depends-on \"$1\")$0" "depends-on" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/emacs-lisp-mode/depends-on" nil nil)))
;;; Do not edit! File generated at Tue Nov 22 15:37:52 2016

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: depends-on
# key: do
# --
(depends-on "$1")$0

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: face
# key: face
# --
`($1 ((t (${2::foreground} $0))))

View file

@ -0,0 +1,10 @@
;;; Compiled snippets and support files for `haml-mode'
;;; Snippet definitions:
;;;
(yas-define-snippets 'haml-mode
'(("faq" "%dt\n = link_to '#' do\n .expand_icon\n $1\n%dd\n %p\n $0" "FAQ Question & Answer" nil nil
((yas-indent-line 'fixed))
"/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/haml-mode/faq" nil nil)))
;;; Do not edit! File generated at Tue Nov 22 15:37:52 2016

View file

@ -0,0 +1,12 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: FAQ Question & Answer
# key: faq
# expand-env: ((yas-indent-line 'fixed))
# --
%dt
= link_to '#' do
.expand_icon
$1
%dd
%p
$0

View file

@ -0,0 +1,12 @@
;;; Compiled snippets and support files for `html-mode'
;;; Snippet definitions:
;;;
(yas-define-snippets 'html-mode
'(("trans" "{% trans \"$1\"|capfirst %}" "trans with cap" pony-tpl-minor-mode nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/html-mode/trans-with-cap" nil nil)
("script" "<script src=\"$1\" type=\"${2:text/javascript}\" language=\"${3:javascript}\"></script>" "script" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/html-mode/script" nil nil)
("%" "{% $1 %}\n $0\n{% end$1 %}" "Template Block" pony-tpl-minor-mode nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/html-mode/generic-block" nil nil)
("for" "{% for $1 in $2 %}\n $0\n{% endfor %}" "for" pony-tpl-minor-mode nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/html-mode/for" nil nil)
("block" "{% block $1 %}\n $0\n{% endblock %}" "block" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/html-mode/block" nil nil)))
;;; Do not edit! File generated at Tue Nov 22 15:37:52 2016

View file

@ -0,0 +1,7 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: block
# key: block
# --
{% block $1 %}
$0
{% endblock %}

View file

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: for
# key: for
# condition: pony-tpl-minor-mode
# --
{% for $1 in $2 %}
$0
{% endfor %}

View file

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: Template Block
# key: %
# condition: pony-tpl-minor-mode
# --
{% $1 %}
$0
{% end$1 %}

View file

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: script
# key: script
# --
<script src="$1" type="${2:text/javascript}" language="${3:javascript}"></script>

View file

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: trans with cap
# key: trans
# condition: pony-tpl-minor-mode
# --
{% trans "$1"|capfirst %}

View file

@ -0,0 +1,10 @@
;;; Compiled snippets and support files for `nxml-mode'
;;; Snippet definitions:
;;;
(yas-define-snippets 'nxml-mode
'(("s" "<Shortcut displayName=\"$1\"\n icon=\"$2\"\n to=\"$3\">\n $0\n</Shortcut>" "Shortcut" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/nxml-mode/pencil-shortcut" nil nil)
("pv" "<PropertyValue name=\"$1\">$2</PropertyValue>" "PropertyValue" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/nxml-mode/pencil-property-value" nil nil)
("p" "<Property name=\"$1\"\n displayName=\"$2\"\n type=\"$3\">$4</Property>" "PencilProperty" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/nxml-mode/pencil-property" nil nil)))
;;; Do not edit! File generated at Tue Nov 22 15:37:52 2016

View file

@ -0,0 +1,7 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: PencilProperty
# key: p
# --
<Property name="$1"
displayName="$2"
type="$3">$4</Property>

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: PropertyValue
# key: pv
# --
<PropertyValue name="$1">$2</PropertyValue>

View file

@ -0,0 +1,9 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: Shortcut
# key: s
# --
<Shortcut displayName="$1"
icon="$2"
to="$3">
$0
</Shortcut>

View file

@ -0,0 +1,11 @@
;;; Compiled snippets and support files for `org-mode'
;;; Snippet definitions:
;;;
(yas-define-snippets 'org-mode
'(("snippet" "#+TITLE: ${1:snippet-name}\n#+OPTIONS: toc:nil\n\n* $1\n\n ${2:A short description abount $1}\n\n #+BEGIN_SRC $3 :tangle yes\n$0\n #+END_SRC" "snippet" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/org-mode/snippet" nil nil)
("project" "#+TITLE: ${1:project_name}\n#+LINK: src ${2:http://code.ryuslash.org/cgit.cgi/$3$1/}\n#+LINK: tar_gz $2${4:snapshot/$1-master}.tar.gz\n#+LINK: zip $2$4.zip\n#+STARTUP: showall\n\n#+begin_html\n <script src=\"/keyjs.js\" type=\"text/javascript\"></script>\n <script type=\"text/javascript\">\n keyjs_initialize({ \"u\": [ \"keyjs_goto\", \"../index.html\" ],\n \"h\": [ \"keyjs_goto\", \"http://ryuslash.org\" ] });\n </script>\n#+end_html\n\n#+INCLUDE: \"dlmenu.inc\"\n\n* About\n\n ${5:A short description about $1}\n\n | $0Status | $6 |\n | Language | $7 |\n | License | ${8:GPLv3} |\n\n* Why?\n\n ${9:Why did you even think of writing $1?}\n\n* Features\n\n ${10:$1 does...}\n\n* Dependencies\n\n ${11:$1 needs to have...}\n\n* Download\n\n ${12:To download $1...}\n\n* Install\n\n ${13:To install $1...}\n\n* Usage\n\n ${14:Using $1...}" "project" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/org-mode/project" nil nil)
("*" "${1:*} ${2:TODO} $3\n${1:$(make-string (length text) ?\\ )} :PROPERTIES:\n${1:$(make-string (length text) ?\\ )} :CATEGORY: $4\n${1:$(make-string (length text) ?\\ )} :END:\n${1:$(make-string (length text) ?\\ )} $0" "Heading" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/org-mode/heading" nil nil)
("code" "#+begin_src $1\n $0\n#+end_src" "codeblock" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/org-mode/codeblock" nil nil)))
;;; Do not edit! File generated at Tue Nov 22 15:37:52 2016

View file

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: codeblock
# key: code
# --
#+begin_src $1
$0
#+end_src

View file

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: Heading
# key: *
# --
${1:*} ${2:TODO} $3
${1:$(make-string (length text) ?\ )} :PROPERTIES:
${1:$(make-string (length text) ?\ )} :CATEGORY: $4
${1:$(make-string (length text) ?\ )} :END:
${1:$(make-string (length text) ?\ )} $0

View file

@ -0,0 +1,51 @@
# -*- mode: snippet -*-
# name: project
# key: project
# --
#+TITLE: ${1:project_name}
#+LINK: src ${2:http://code.ryuslash.org/cgit.cgi/$3$1/}
#+LINK: tar_gz $2${4:snapshot/$1-master}.tar.gz
#+LINK: zip $2$4.zip
#+STARTUP: showall
#+begin_html
<script src="/keyjs.js" type="text/javascript"></script>
<script type="text/javascript">
keyjs_initialize({ "u": [ "keyjs_goto", "../index.html" ],
"h": [ "keyjs_goto", "http://ryuslash.org" ] });
</script>
#+end_html
#+INCLUDE: "dlmenu.inc"
* About
${5:A short description about $1}
| $0Status | $6 |
| Language | $7 |
| License | ${8:GPLv3} |
* Why?
${9:Why did you even think of writing $1?}
* Features
${10:$1 does...}
* Dependencies
${11:$1 needs to have...}
* Download
${12:To download $1...}
* Install
${13:To install $1...}
* Usage
${14:Using $1...}

View file

@ -0,0 +1,14 @@
# -*- mode: snippet -*-
# name: snippet
# key: snippet
# --
#+TITLE: ${1:snippet-name}
#+OPTIONS: toc:nil
* $1
${2:A short description abount $1}
#+BEGIN_SRC $3 :tangle yes
$0
#+END_SRC

View file

@ -0,0 +1,10 @@
;;; Compiled snippets and support files for `php-mode'
;;; Snippet definitions:
;;;
(yas-define-snippets 'php-mode
'(("header" "/*\n * Plugin Name: $1\n * Plugin URI: $2\n * Description: $3\n * Version: ${4:1.0}\n * Author: ${5:Tom Willemse}\n * Author URI: ${6:https://ryuslash.org}\n * License: ${7:GPLv2}\n */" "WP Plugin Header" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/php-mode/wpheader.php" nil nil)
("(" "( $0 " "opening-brace" electric-pair-mode nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/php-mode/opening-brace" nil nil)
("function" "function $1($2)\n{\n $0\n}" "function" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/php-mode/function" nil nil)))
;;; Do not edit! File generated at Tue Nov 22 15:37:52 2016

View file

@ -0,0 +1,8 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: function
# key: function
# --
function $1($2)
{
$0
}

View file

@ -0,0 +1,13 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: WP Plugin Header
# key: header
# --
/*
* Plugin Name: $1
* Plugin URI: $2
* Description: $3
* Version: ${4:1.0}
* Author: ${5:Tom Willemse}
* Author URI: ${6:https://ryuslash.org}
* License: ${7:GPLv2}
*/

View file

@ -0,0 +1,15 @@
;;; Compiled snippets and support files for `python-mode'
;;; Snippet definitions:
;;;
(yas-define-snippets 'python-mode
'(("url" "url(r'^$1', $2, name='$3')," "url" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/python-mode/url" nil nil)
("defm" "@method_decorator(permission_required('$1',\n raise_exception=True))\ndef dispatch(self, *args, **kwargs):\n '''Make sure the user has the $1 permission.'''\n return super(${3:`(progn (re-search-backward \"^[ \\t]*class \\\\(.+\\\\)(\") (match-string 1)))`}, self).dispatch(*args, **kwargs)" "Permission guard" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/python-mode/permission_guard" nil nil)
("defm" "def $1(self$2):\n '''$3'''\n $0" "method" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/python-mode/method" nil nil)
("from" "from ${1:module} import ${2:class_or_module}\n" "from ... import ..." nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/python-mode/import_from" nil nil)
("formvalid" "def form_valid(self, form):\n rv = super(`(let ((name (python-info-current-defun))) (substring name 0 (cl-position ?. name)))`, self).form_valid(form)\n $0\n return rv" "form_valid with return" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/python-mode/form_valid_with_return" nil nil)
("defm" "@record_activity(model=${1:`(progn (re-search-backward \"^[ \\t]*model = \\\\([a-zA-Z_].*\\\\)$\") (match-string 1))`})\ndef form_valid(self, form):\n '''Make sure any changes to the $1 model get logged.'''\n return super(${2:`(progn (re-search-backward \"^[ \\t]*class \\\\(.+\\\\)(\") (match-string 1)))`}, self).form_valid(form)" "Record form" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/python-mode/form_valid" nil nil)
("form" "class ${1:Model}Form(forms.ModelForm):\n '''Form for the $1 model.'''\n\n class Meta:\n model = $1" "Model Form" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/python-mode/form" nil nil)
("defm" "def ${1:name}(self, *args, **kwargs):\n '''$2'''\n return super(${3:`(progn (re-search-backward \"^[ \\t]*class \\\\(.+\\\\)(\") (match-string 1)))`}, self).$1(*args, **kwargs)" "Empty Defmethod" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/python-mode/defm_empty" nil nil)))
;;; Do not edit! File generated at Tue Nov 22 15:37:52 2016

View file

@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
# name: Empty Defmethod
# key: defm
# --
def ${1:name}(self, *args, **kwargs):
'''$2'''
return super(${3:`(progn (re-search-backward "^[ \t]*class \\(.+\\)(") (match-string 1)))`}, self).$1(*args, **kwargs)

View file

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: Model Form
# key: form
# --
class ${1:Model}Form(forms.ModelForm):
'''Form for the $1 model.'''
class Meta:
model = $1

View file

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: Record form
# key: defm
# --
@record_activity(model=${1:`(progn (re-search-backward "^[ \t]*model = \\([a-zA-Z_].*\\)$") (match-string 1))`})
def form_valid(self, form):
'''Make sure any changes to the $1 model get logged.'''
return super(${2:`(progn (re-search-backward "^[ \t]*class \\(.+\\)(") (match-string 1)))`}, self).form_valid(form)

View file

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: form_valid with return
# key: formvalid
# --
def form_valid(self, form):
rv = super(`(let ((name (python-info-current-defun))) (substring name 0 (cl-position ?. name)))`, self).form_valid(form)
$0
return rv

View file

@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# name: from ... import ...
# contributor: Tom Willemse
# key: from
# --
from ${1:module} import ${2:class_or_module}

View file

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: method
# key: defm
# --
def $1(self$2):
'''$3'''
$0

View file

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: Permission guard
# key: defm
# --
@method_decorator(permission_required('$1',
raise_exception=True))
def dispatch(self, *args, **kwargs):
'''Make sure the user has the $1 permission.'''
return super(${3:`(progn (re-search-backward "^[ \t]*class \\(.+\\)(") (match-string 1)))`}, self).dispatch(*args, **kwargs)

View file

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: url
# key: url
# --
url(r'^$1', $2, name='$3'),

View file

@ -0,0 +1,18 @@
;;; Compiled snippets and support files for `ruby-mode'
;;; Snippet definitions:
;;;
(yas-define-snippets 'ruby-mode
'(("reduce" "reduce { |a, e| $0 }" "reduce" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/ruby-mode/reduce" nil nil)
("mod" "module ${1:`(let ((fn (capitalize (file-name-nondirectory\n (directory-file-name\n default-directory)))))\n (replace-regexp-in-string \"_\" \"\" fn t t))`}\n $0\nend" "module ... end" nil
("definitions")
nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/ruby-mode/mod" nil nil)
("fin" "fill_in '$1', with: $2" "fill_in" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/ruby-mode/fill_in" nil nil)
("factory" "FactoryGirl.define do\n factory :${1:`(file-name-sans-extension (file-name-nondirectory buffer-file-name))`} do\n $0\n end\nend" "factory" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/ruby-mode/factory" nil nil)
("do" "do$0\nend" "do" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/ruby-mode/do" nil nil)
("desc" "describe '$1' do\n $0\nend" "describe" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/ruby-mode/describe" nil nil)
("pseed" "Product.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Small', price: '20.00', width_in_cm: '25.00', height_in_cm: '21.00', width_in_mm: '250', height_in_mm: '210')\nProduct.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Medium', price: '20.00', width_in_cm: '30.00', height_in_cm: '25.80', width_in_mm: '300', height_in_mm: '258')\nProduct.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Large', price: '20.00', width_in_cm: '35.00', height_in_cm: '30.00', width_in_mm: '350', height_in_mm: '300')\nProduct.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Extra large', price: '20.00', width_in_cm: '40.00', height_in_cm: '34.00', width_in_mm: '400', height_in_mm: '340')\n" "ProductSeedWithHWGroup" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/ruby-mode/ProductSeedHWGroup" nil nil)
("pseed" "Product.find_or_create_by_name(parent_id: $1, name: '$2', description: '$3', price: '$4', width_in_cm: '$5', height_in_cm: '$6', width_in_mm: '${5:$(round (* 10 (string-to-int yas-text)))}', height_in_mm: '${6:$(round (* 10 (string-to-int yas-text)))}')" "ProductSeedWithHW" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/ruby-mode/ProductSeedHW" nil nil)
("pseed" "Product.find_or_create_by_name(parent_id: $1, name: '$2', description: '$3', price: '$4')" "ProductSeed" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/ruby-mode/ProductSeed" nil nil)))
;;; Do not edit! File generated at Tue Nov 22 15:37:52 2016

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: ProductSeed
# key: pseed
# --
Product.find_or_create_by_name(parent_id: $1, name: '$2', description: '$3', price: '$4')

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: ProductSeedWithHW
# key: pseed
# --
Product.find_or_create_by_name(parent_id: $1, name: '$2', description: '$3', price: '$4', width_in_cm: '$5', height_in_cm: '$6', width_in_mm: '${5:$(round (* 10 (string-to-int yas-text)))}', height_in_mm: '${6:$(round (* 10 (string-to-int yas-text)))}')

View file

@ -0,0 +1,8 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: ProductSeedWithHWGroup
# key: pseed
# --
Product.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Small', price: '20.00', width_in_cm: '25.00', height_in_cm: '21.00', width_in_mm: '250', height_in_mm: '210')
Product.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Medium', price: '20.00', width_in_cm: '30.00', height_in_cm: '25.80', width_in_mm: '300', height_in_mm: '258')
Product.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Large', price: '20.00', width_in_cm: '35.00', height_in_cm: '30.00', width_in_mm: '350', height_in_mm: '300')
Product.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Extra large', price: '20.00', width_in_cm: '40.00', height_in_cm: '34.00', width_in_mm: '400', height_in_mm: '340')

View file

@ -0,0 +1,7 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: describe
# key: desc
# --
describe '$1' do
$0
end

View file

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: do
# key: do
# --
do$0
end

View file

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: factory
# key: factory
# --
FactoryGirl.define do
factory :${1:`(file-name-sans-extension (file-name-nondirectory buffer-file-name))`} do
$0
end
end

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: fill_in
# key: fin
# --
fill_in '$1', with: $2

View file

@ -0,0 +1,11 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: module ... end
# key: mod
# group: definitions
# --
module ${1:`(let ((fn (capitalize (file-name-nondirectory
(directory-file-name
default-directory)))))
(replace-regexp-in-string "_" "" fn t t))`}
$0
end

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: reduce
# key: reduce
# --
reduce { |a, e| $0 }

View file

@ -0,0 +1,18 @@
;;; Compiled snippets and support files for `twig-mode'
;;; Snippet definitions:
;;;
(yas-define-snippets 'twig-mode
'(("set" "{% set $1 = $2 %}" "set" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/twig-mode/set" nil nil)
("mac" "{% macro ${1:name}(${2:args}) %}\n $0\n{% endmacro %}" "macro" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/twig-mode/mac" nil nil)
("imp" "{% import \"${1:module}\" as ${1:$(if (string-match \"/\\\\\\\\([^/]*\\\\\\\\)$\" yas-text)\n (match-string 1 yas-text)\n yas-text)} %}" "import" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/twig-mode/imp" nil nil)
("iif" "{% if $1 %}$0{% endif %}" "Inline if" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/twig-mode/iif" nil nil)
("ife" "{% if $1 %}\n $0\n{% else %}\n\n{% endif %}" "if...else" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/twig-mode/ife" nil nil)
("if" "{% if $1 %}\n $0\n{% endif %}" "if" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/twig-mode/if" nil nil)
("for" "{% for $1 in $2 %}\n `yas-selected-text`$0\n{% endfor %}" "for" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/twig-mode/for" nil nil)
("ext" "{% extends \"$1\" %}" "extends" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/twig-mode/ext" nil nil)
("def" "{% if $1 is not defined %}\n {% set $1 = $2 %}\n{% endif %}" "default value" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/twig-mode/def" nil nil)
("blk" "{% block $1 %}\n $0\n{% endblock %}" "block" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/twig-mode/blk" nil nil)
("_self" "{% import _self as ${1:`(file-name-nondirectory (file-name-sans-extension buffer-file-name))`} %}" "_self" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/twig-mode/_self" nil nil)))
;;; Do not edit! File generated at Tue Nov 22 15:37:52 2016

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: _self
# key: _self
# --
{% import _self as ${1:`(file-name-nondirectory (file-name-sans-extension buffer-file-name))`} %}

View file

@ -0,0 +1,7 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: block
# key: blk
# --
{% block $1 %}
$0
{% endblock %}

View file

@ -0,0 +1,7 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: default value
# key: def
# --
{% if $1 is not defined %}
{% set $1 = $2 %}
{% endif %}

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: extends
# key: ext
# --
{% extends "$1" %}

View file

@ -0,0 +1,7 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: for
# key: for
# --
{% for $1 in $2 %}
`yas-selected-text`$0
{% endfor %}

View file

@ -0,0 +1,7 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: if
# key: if
# --
{% if $1 %}
$0
{% endif %}

View file

@ -0,0 +1,9 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: if...else
# key: ife
# --
{% if $1 %}
$0
{% else %}
{% endif %}

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: Inline if
# key: iif
# --
{% if $1 %}$0{% endif %}

View file

@ -0,0 +1,7 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: import
# key: imp
# --
{% import "${1:module}" as ${1:$(if (string-match "/\\\\([^/]*\\\\)$" yas-text)
(match-string 1 yas-text)
yas-text)} %}

View file

@ -0,0 +1,7 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: macro
# key: mac
# --
{% macro ${1:name}(${2:args}) %}
$0
{% endmacro %}

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: set
# key: set
# --
{% set $1 = $2 %}

View file

@ -1,205 +0,0 @@
;;; circe-serenity.el --- Clean up Circe buffers -*- lexical-binding: t; -*-
;; Copyright (C) 2016 Tom Willemse
;; Author: Tom Willemse <chelys@drd>
;; Keywords: convenience
;; 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 <http://www.gnu.org/licenses/>.
;;; Commentary:
;; This is an extension module for Circe. It creates what I think is
;; a more minimalistic view of Circe buffers. It right-aligns all the
;; nicks, right-justifies and simplifies certain messages. It takes
;; care of both `fill-prefix' and `wrap-prefix' so it should be usable
;; with and without `lui-fill-type'.
;; The name circe-serenity was chosen because I think the buffers feel
;; cleaner and more serene with this setup.
;;; Code:
(defvar circe-serenity-longest-nick 0
"The longest known nick.")
(make-variable-buffer-local 'circe-serenity-longest-nick)
(defvar circe-serenity--formatters-alist nil
"Alist of which formatter to use for which circe format.")
(defun circe-serenity--define-formatter (formatter format)
"Define that FORMATTER should be used for FORMAT."
(setf (alist-get format circe-serenity--formatters-alist) formatter))
(defun circe-serenity--fill-string ()
"Create a padded string as long as `circe-serenity-longest-nick'."
(make-string (+ circe-serenity-longest-nick 3) ?\s))
(defun circe-serenity--update-longest-nick (keywords)
"Keep track of the longest nick seen so far.
KEYWORDS is a plist which should contain a :nick key."
(let* ((nick (plist-get keywords :nick))
(len (length nick)))
(when (> len circe-serenity-longest-nick)
(setq circe-serenity-longest-nick len)
(when lui-fill-type
(setq-local lui-fill-type (circe-serenity--fill-string))))))
(defun circe-serenity-say-formatter (&rest keywords)
"Format a message from a user.
KEYWORDS should be a plist with at least a :nick and :body. It
is passed on to `lui-format'."
(circe-serenity--update-longest-nick keywords)
(propertize
(lui-format (format "{nick:%ds} {body}" circe-serenity-longest-nick)
keywords)
'wrap-prefix (circe-serenity--fill-string)))
(circe-serenity--define-formatter 'circe-serenity-say-formatter 'circe-format-say)
(circe-serenity--define-formatter 'circe-serenity-say-formatter 'circe-format-self-say)
(defun circe-serenity-action-formatter (&rest keywords)
"Format a user's action message.
KEYWORDS should be plist with at least the keys :nick and :body.
A key :intro is added to the plist and then passed on to
`lui-format'."
(propertize
(lui-format
(format "{intro:%ds} {nick} {body}" circe-serenity-longest-nick)
(plist-put keywords :intro "*"))
'wrap-prefix (circe-serenity--fill-string)))
(circe-serenity--define-formatter 'circe-serenity-action-formatter 'circe-format-action)
(defun circe-serenity-server-message-formatter (&rest keywords)
"Format a message from the server.
KEYWORDS should be a plist with at least a :body key. A key
:intro is added to the plist and then passed on to `lui-format'."
(propertize
(lui-format
(format "{intro:%ds} {body}" circe-serenity-longest-nick)
(plist-put keywords :intro "***"))
'wrap-prefix (circe-serenity--fill-string)))
(circe-serenity--define-formatter 'circe-serenity-server-message-formatter 'circe-format-server-message)
(defun circe-serenity-server-join-in-channel-formatter (&rest keywords)
"Format a message from a user joining a channel.
KEYWORDS should be a plist with at least a :nick and :channel
key. A key :intro is added to the plist and then passed on to
`lui-format'."
(propertize
(lui-format
(format "{intro:%ds} {nick} joined {channel}"
circe-serenity-longest-nick)
(plist-put keywords :intro ">>>"))
'wrap-prefix (circe-serenity--fill-string)))
(circe-serenity--define-formatter 'circe-serenity-server-join-in-channel-formatter
'circe-format-server-join-in-channel)
(defun circe-serenity-server-join-formatter (&rest keywords)
"Format a message from a user joining the server.
KEYWORDS should be a plist with at least a :nick key. A key
:intro is added to the plist and then passed on to `lui-format'."
(propertize
(lui-format
(format "{intro:%ds} {nick} logged on"
circe-serenity-longest-nick)
(plist-put keywords :intro ">>>"))
'wrap-prefix (circe-serenity--fill-string)))
(circe-serenity--define-formatter 'circe-serenity-server-join-formatter 'circe-format-server-join)
(defun circe-serenity-server-quit-formatter (&rest keywords)
"Format a message from a user quitting the server.
KEYWORDS should be a plist with at least a :nick key. A key
:intro is added to the plist and then passed on to `lui-format'."
(propertize
(lui-format
(format "{intro:%ds} {nick} logged off"
circe-serenity-longest-nick)
(plist-put keywords :intro "<<<"))
'wrap-prefix (circe-serenity--fill-string)))
(circe-serenity--define-formatter 'circe-serenity-server-quit-formatter 'circe-format-server-quit)
(defun circe-serenity-server-quit-channel-formatter (&rest keywords)
"Format a message from a user quitting a channel.
KEYWORDS should be a plist with at least a :nick and :channel
key. A key :intro is added to the plist and then passed on to
`lui-format'."
(propertize
(lui-format
(format "{intro:%ds} {nick} left {channel}"
circe-serenity-longest-nick)
(plist-put keywords :intro "<<<"))
'wrap-prefix (circe-serenity--fill-string)))
(circe-serenity--define-formatter 'circe-serenity-server-quit-channel-formatter
'circe-format-server-quit-channel)
(defun circe-serenity-server-part-formatter (&rest keywords)
"Format a message from a user parting a channel.
KEYWORDS should be a plist with at least a :nick and :channel
key. A key :intro is added to the plist and then passed on to
`lui-format'."
(propertize
(lui-format
(format "{intro:%ds} {nick} parted from {channel}"
circe-serenity-longest-nick)
(plist-put keywords :intro "***"))
'wrap-prefix (circe-serenity--fill-string)))
(circe-serenity--define-formatter 'circe-serenity-server-part-formatter 'circe-format-server-part)
(defun circe-serenity-server-nick-change-formatter (&rest keywords)
"Format a message from a user changing their nick.
KEYWORDS should be a plist with at least a :new-nick and
:old-nick key. A key :intro is added to the plist and then
passed on to `lui-format'."
(propertize
(lui-format
(format "{intro:%ds} {old-nick} is now know as {new-nick}"
circe-serenity-longest-nick)
(plist-put keywords :intro "***"))
'wrap-prefix (circe-serenity--fill-string)))
(circe-serenity--define-formatter 'circe-serenity-server-nick-change-formatter
'circe-format-server-nick-change)
(defun circe-serenity-server-topic-formatter (&rest keywords)
"Format a message of a topic having changed.
KEYWORDS should be a plist with at least a :nick and :new-topic
key. A key :intro is added to the plist and then passed on to
`lui-format'."
(propertize
(lui-format
(format "{intro:%ds} {nick} changed topic to: {new-topic}"
circe-serenity-longest-nick)
(plist-put keywords :intro "***"))
'wrap-prefix (circe-serenity--fill-string)))
(circe-serenity--define-formatter 'circe-serenity-server-topic-formatter 'circe-format-server-topic)
;;;###autoload
(defun enable-circe-serenity ()
"Enable Serenity for Circe."
(interactive)
(dolist (format-pair circe-serenity--formatters-alist)
(cl-destructuring-bind (format . formatter) format-pair
(if (null (get format 'circe-serenity-original))
(put format 'circe-serenity-original (symbol-value format)))
(set format formatter))))
(defun disable-circe-serenity ()
"Disable Serenity for Circe."
(interactive)
(dolist (format-pair circe-serenity--formatters-alist)
(let ((format (car format-pair)))
(set format (get format 'circe-serenity-original))
(put format 'circe-serenity-original nil))))
(provide 'circe-serenity)
;;; circe-serenity.el ends here

View file

@ -130,8 +130,6 @@ hc mousebind $Mod-Button3 resize
# focus
hc keybind $Mod-BackSpace cycle_monitor
hc keybind $Mod-Tab cycle_all +1
hc keybind $Mod-Shift-Tab cycle_all -1
# Use u because i is already used by by navigation commands.
hc keybind $Mod-u jumpto urgent

View file

@ -1,7 +1,10 @@
# -*- geiser-default-implementation: chicken; -*-
#+TITLE: Mowedline init
Load the =matchable= module so I can use =match-lambda=.
#+BEGIN_SRC scheme
(use matchable)
(use matchable dbus)
#+END_SRC
Set the default font and color to something nicer.
@ -11,41 +14,73 @@ Set the default font and color to something nicer.
(text-widget-color "#ededed")
#+END_SRC
This formatter will parse the herbstluftwm tag status line, which
looks like this:
#+BEGIN_EXAMPLE
#1 -2 :3 :4 :5 .6 .7 .8 .9
#+END_EXAMPLE
And turn it into something more useful. The symbols before the tag
names (numbers) have the following meaning:
- =#= :: This tag is currently active.
- =-= :: This tag is visible on another monitor.
- =:= :: This tag isn't displayed, but has windows on it.
- =.= :: This tag isn't displayed and is empty.
- =!= :: This tag has an urgent window on it.
First the tag line has to be split into separate parts. Each tag
status/name pair is split by a tab character and each status is only
one character. So I split the whole string on tabs and then make a
list out of each individual part, for easy access to the status
character. So we end up with something like:
#+BEGIN_EXAMPLE
((#\# #\1) (#\- #\2) (#\: #\3) ...)
#+END_EXAMPLE
Define a convenience function to check if a formatter's argument is
not some text.
#+BEGIN_SRC scheme
(define (split-tag-list str)
(map string->list (string-split str "\t")))
(define (not-text? text)
(or (null? text) (and (not (pair? text)) (string-null? text))))
#+END_SRC
Next we turn each part into something practical for display in
mowedline.
Define a convenience function that adds spaces around its argument if
its argument is text.
#+BEGIN_SRC scheme
(define (text-maybe-pad-both text)
(if (not-text? text)
text
(list " " text " ")))
#+END_SRC
Define a convenience function to add a Font Awesome icon to a widget.
#+BEGIN_SRC scheme
(define (add-fa-icon icon)
(lambda (text)
(if (not-text? text)
text
(list (list 'font "FontAwesome-10"
(string-append " " icon " "))
text))))
#+END_SRC
* Tag list
This formatter will parse the herbstluftwm tag status line, which
looks like this:
#+BEGIN_EXAMPLE
#1 -2 :3 :4 :5 .6 .7 .8 .9
#+END_EXAMPLE
And turn it into something more useful. The symbols before the tag
names (numbers) have the following meaning:
- =#= :: This tag is currently active.
- =-= :: This tag is visible on another monitor.
- =:= :: This tag isn't displayed, but has windows on it.
- =.= :: This tag isn't displayed and is empty.
- =!= :: This tag has an urgent window on it.
First the tag line has to be split into separate parts. Each tag
status/name pair is split by a tab character and each status is only
one character. So I split the whole string on tabs and then make a
list out of each individual part, for easy access to the status
character. So we end up with something like:
#+BEGIN_EXAMPLE
((#\# #\1) (#\- #\2) (#\: #\3) ...)
#+END_EXAMPLE
#+BEGIN_SRC scheme
(define (split-tag-list str)
(map string->list (string-split str "\t")))
#+END_SRC
Next we turn each part into something practical for display in
mowedline.
#+BEGIN_SRC scheme
(define tag-display
(match-lambda
((#\# . name-list)
@ -58,19 +93,53 @@ mowedline.
(define (tag-list-display tag-list)
(map tag-display tag-list))
#+END_SRC
#+END_SRC
Finally, bring it all together in a function that can be used as a
mowedline text formatter.
Finally, bring it all together in a function that can be used as a
mowedline text formatter.
#+BEGIN_SRC scheme
#+BEGIN_SRC scheme
(define (tag-list-formatter text)
(tag-list-display (split-tag-list text)))
#+END_SRC
#+END_SRC
Create a mowedline window, put it at the bottom.
Define the widget to be used in the window.
#+BEGIN_SRC scheme
(define taglist-widget
(widget:text #:name "taglist" #:format tag-list-formatter))
#+END_SRC
* Email
Define a widget to show email notifications in.
#+BEGIN_SRC scheme
(define email-widget
(widget:text
#:name "email"
#:format (compose text-maybe-pad-left (add-fa-icon ""))))
#+END_SRC
* The window
Create a mowedline window, put it at the bottom.
#+BEGIN_SRC scheme
(define clipboard-widget
(widget:text #:format text-maybe-pad-left))
(let ((ctx (make-context #:service 'org.gnome.GPaste
#:interface 'org.gnome.GPaste1
#:path "/org/gnome/GPaste")))
(register-signal-handler ctx
"Update"
(lambda (type replace id)
(update clipboard-widget "Text copied!")
(thread-start! (make-thread (lambda ()
(thread-sleep! 3)
(update clipboard-widget "")))))))
#+BEGIN_SRC scheme
(window #:position 'bottom
#:width 1843
#:margin-bottom 15
@ -78,7 +147,12 @@ Create a mowedline window, put it at the bottom.
#:margin-right 15
#:background 'transparent
(widget:text #:name "taglist" #:format tag-list-formatter)
taglist-widget
(widget:spacer #:flex 1)
(widget:clock))
#+END_SRC
clipboard-widget
(widget:text #:name "irc" #:format (lambda (text) (text-maybe-pad-left (with-input-from-string text read))))
email-widget
(widget:clock #:format text-maybe-pad-left))
#+END_SRC

View file

@ -2,5 +2,6 @@ include ../dotfiles.mk
all: .config/mowedline/init.scm
%.scm: SCHEME_IMPLEMENTATION = chicken
%.scm: %.org
$(call tangle,scheme)

View file

@ -0,0 +1,9 @@
[Unit]
Description=synchronize IMAP4 and Maildir mailboxes
[Service]
Type=oneshot
ExecStart=/usr/bin/mbsync -aqV
[Install]
WantedBy=default.target

View file

@ -0,0 +1,9 @@
[Unit]
Description=Run mbsync every minute
[Timer]
OnBootSec=1s
OnUnitActiveSec=1min
[Install]
WantedBy=timers.target

View file

@ -35,8 +35,10 @@ URxvt.visualBell: false
! default. Fix it by setting the letterspace to a negative value.
URxvt.letterSpace: -2
! Enable the url-select plugin along with the default plugins.
URxvt.perl-ext-common: default,url-select
! Enable the url-select plugin along with the default plugins. Also
! enable the selection-to-clipboard plugin so that the primary
! selection gets added to the clipboard as well.
URxvt.perl-ext-common: default,url-select,selection-to-clipboard
! Use Conkeror to open URLs
URxvt.url-launcher: conkeror

View file

@ -1,4 +1,5 @@
#+TITLE: ZSH
#+STARTUP: showall
Autoload any ZSH function from =$HOME/.zsh/functions=.
@ -18,6 +19,13 @@ Autoload any ZSH function from =$HOME/.zsh/functions=.
alias sbcl="rlwrap sbcl"
#+END_SRC
This alias is useful for when I'm trying something new with
herbstluftwm.
#+BEGIN_SRC sh
alias hc=herbstclient
#+END_SRC
* History
Store ZSH history in a non-intrusive place.
@ -120,3 +128,21 @@ Autoload any ZSH function from =$HOME/.zsh/functions=.
autoload -Uz compinit
compinit
#+END_SRC
* Less
I use a terminal that's always 80 columns wide. This means that a
lot of output doesn't fit on a single line. I use the less command a
lot to look at output that's too big and wide to view in my
terminal. The default doesn't make this any better though, so I use
these switches. Most of these I originally got from what git uses.
#+BEGIN_SRC sh
export LESS="FXRSi"
#+END_SRC
This causes less to immediately quit if there is no need to use a
pager (everything fits in a single screen) (=-F=). Doesn't clear the
screen when less is closed (=-X=). Handles ANSI colors (=-R=). Stops
long lines from wraping (=-S=). And makes searches case-insensitive
(=-i=).