summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2021-04-02 13:07:24 -0500
committerCase Duckworth2021-04-02 13:28:22 -0500
commitb649a257550f37ff7b0f96d417d4b80613141977 (patch)
tree04f09f59ba9751f788323223c7e4faa9e381faee /lisp
parentTweak elisp-mode settings (diff)
downloademacs-b649a257550f37ff7b0f96d417d4b80613141977.tar.gz
emacs-b649a257550f37ff7b0f96d417d4b80613141977.zip
Add `defun-with-hooks'
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/acdw.el b/lisp/acdw.el index 0203f3b..b127827 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -58,6 +58,16 @@ Ready for use with `after-focus-change-function'."
58 (run-at-time sunset-time (* 60 60 24) sunset-command) 58 (run-at-time sunset-time (* 60 60 24) sunset-command)
59 (run-at-time "12:00am" (* 60 60 24) sunset-command))) 59 (run-at-time "12:00am" (* 60 60 24) sunset-command)))
60 60
61;;;; Define a function and add it to hooks
62(defun defun-with-hooks (hooks function-def)
63 "Add FUNCTION-DEF to HOOKS.
64
65FUNCTION-DEF should be a `defun' form. This function is just to
66 put functions that only exist for hooks closer to the hooks
67 they bind to."
68 (let ((func function-def))
69 (dolist (hook hooks)
70 (add-hook hook func))))
61;;; Garbage collection hacks 71;;; Garbage collection hacks
62 72
63(defconst acdw/gc-cons-threshold-basis (* 800 1024) 73(defconst acdw/gc-cons-threshold-basis (* 800 1024)