]> code.delx.au - dotemacs/blob - lisp/my-shackle.el
kotline-mode
[dotemacs] / lisp / my-shackle.el
1 ;;; -*- lexical-binding: t -*-
2
3 (require 'shackle)
4
5 (defun my/shackle-rules ()
6 (let ((rules-common
7 '(((:custom buffer-file-name) :other t)
8 (direx:direx-mode :align left :size 40 :select t)
9 ("*Flycheck error messages*" :align below :size 15 :select nil)))
10 (rules-wide
11 '(("magit-.*-popup" :regexp t :align right :select t)
12 ((magit-log-mode magit-status-mode) :align bottom :size 15 :select t)
13 ((magit-diff-mode magit-revision-mode) :align right :size 80)))
14 (rules-narrow-tall
15 '(("magit-.*-popup" :regexp t :align bottom :select t)
16 (magit-status-mode :align bottom :size 25 :select t)
17 ((magit-diff-mode magit-revision-mode) :align bottom :size 25)))
18 (rules-narrow-short
19 '(("magit-.*-popup" :regexp t :align bottom :select t)
20 (magit-status-mode :align bottom :size 0.8 :select t)
21 ((magit-diff-mode magit-revision-mode) :align bottom :size 0.65))))
22 (cond
23 ((>= (frame-text-cols) 120)
24 (append rules-common rules-wide))
25 ((>= (frame-text-lines) 30)
26 (append rules-common rules-narrow-tall))
27 (t
28 (append rules-common rules-narrow-short)))))
29
30 (setq shackle-default-rule '(:align below :select t :size 15))
31
32 (setq shackle-default-size 0.5)
33
34 (defun shackle-match (buffer-or-name)
35 (cl-loop for (condition . plist) in (my/shackle-rules)
36 when (shackle--match buffer-or-name condition plist)
37 return plist
38 finally return shackle-default-rule))
39
40 (shackle-mode)