 (defun shackle--display-buffer-aligned-window (buffer alist plist)
   "Display BUFFER in an aligned window.
 ALIST is passed to `window--display-buffer' internally.
-Optionally use a different alignment and/or ratio if PLIST
+Optionally use a different alignment and/or size if PLIST
 contains the :alignment key with an alignment different than the
 default one in `shackle-default-alignment' and/or PLIST contains
-the :ratio key with a floating point value."
+the :size key with a number value."
   (let ((frame (shackle--splittable-frame)))
     (when frame
       (let* ((alignment-argument (plist-get plist :align))
              (alignments '(above below left right))
-             (alignment (if (memq alignment-argument alignments)
-                            alignment-argument
-                          shackle-default-alignment))
+             (alignment (cond
+                         ((functionp alignment-argument)
+                          (funcall alignment-argument))
+                         ((memq alignment-argument alignments)
+                          alignment-argument)
+                         ((functionp shackle-default-alignment)
+                          (funcall shackle-default-alignment))
+                         (t shackle-default-alignment)))
              (horizontal (when (memq alignment '(left right)) t))
              (old-size (window-size (frame-root-window) horizontal))
-             (ratio (or (plist-get plist :ratio) shackle-default-ratio))
-             (new-size (round (* (- 1 ratio) old-size))))
+             (size (or (plist-get plist :ratio) ; yey, backwards compatibility
+                       (plist-get plist :size)
+                       shackle-default-size))
+             (new-size (round (if (>= size 1)
+                                  (- old-size size)
+                                (* (- 1 size) old-size)))))
         (if (or (< new-size (if horizontal window-min-width window-min-height))
                 (> new-size (- old-size (if horizontal window-min-width
                                           window-min-height))))
-            (error "Invalid alignment ratio, aborting")
+            (error "Invalid alignment size %s, aborting" new-size)
           (let ((window (split-window (frame-root-window frame)
                                       new-size alignment)))
             (prog1 (window--display-buffer buffer window 'window alist

;;; shackle.el --- Enforce rules for popups

;; Copyright (C) 2014-2015 Vasilij Schneidermann <v.schneidermann@gmail.com>

;; Author: Vasilij Schneidermann <v.schneidermann@gmail.com>
;; URL: https://github.com/wasamasa/shackle
;; Version: 0.7.0
;; Keywords: convenience
;; Package-Requires: ((cl-lib "0.5"))


                       (and (plist-get plist :regexp)
                            (string-match condition buffer-name))))
              (and (consp condition)
                   (or (and (eq (car condition) :custom)
                            (funcall (cadr condition) buffer))
                       (cl-some (lambda (c) (shackle--match buffer-or-name
                                                            c plist))
                                condition))))
      plist)))

(defun shackle-match (buffer-or-name)
