-
Notifications
You must be signed in to change notification settings - Fork 1
/
my-libs.el
70 lines (57 loc) · 1.49 KB
/
my-libs.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
;;; my-libs --- demand loading of common libraries
;;
;; Copyright (C) 2014 Alex Bennée
;;
;; Author: Alex Bennée <[email protected]>
;;
;; This file is not part of GNU Emacs.
;;
;; This file 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, or (at your option)
;; any later version.
;;
;;; Commentary:
;;
;; Where I use 3rd party libraries in multiple places I put their
;;demand loading code in here.
;;
;;; Code:
;; Require prerequisites
(eval-when-compile (require 'use-package))
;; Variables
;; Code
;; Magnar's handy libs
(use-package dash
:ensure t)
(use-package s
:ensure t
:commands s-suffix? s-contains? s-replace-all s-chop-suffix s-trim s-prefix-p)
(use-package fn
:ensure t)
;; Helpers for use-package
(use-package bind-key
:ensure t)
(use-package diminish
:ensure t)
(use-package async
:ensure t)
;; Up GC threshold from 800k to 2Mb
(use-package emacs-gc-stats
:ensure t
:config (setq gc-cons-threshold (* 2 1024 1024))
:init (emacs-gc-stats-mode))
;; Other helpers
(defun my-return-path-if-ok (path)
"Return an expanded file-path if it exists."
(let ((ep (expand-file-name path)))
(when (file-exists-p ep)
ep)))
;;
;; Some helper predicates
;;
(defun my-current-frame-is-portrait-p ()
"Return t if the current frame is in portrait mode."
(< (/ (float (frame-width)) (frame-height)) 1.5))
(provide 'my-libs)
;;; my-libs.el ends here