Add elisp utility lib

This commit is contained in:
Jeremy Dormitzer 2021-02-20 22:00:23 -05:00
parent 92b74eda73
commit 70e8ba5d52
2 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,19 @@
;; -*- lexical-binding: t; -*-
;; Elisp utilities
(defun make-process-sentinel (success err)
"Makes a process sentinel that calls `success` on success and `err` on error"
(lambda (proc event)
(cond ((string-match-p "finished" event) (funcall success))
(t (funcall err)))))
(defun make-success-err-msg-sentinel (buf success-msg err-msg &optional kill-on-err)
(make-process-sentinel
(lambda ()
(message success-msg)
(kill-buffer buf))
(lambda ()
(message err-msg)
(when kill-on-err
(kill-buffer buf)))))
(provide 'init-lib)

View File

@ -53,6 +53,7 @@
(require 'init-evil)
(require 'init-keybindings)
(require 'init-auth)
(require 'init-lib)
(require 'init-profiler)
(require 'init-built-ins)
(require 'init-dashboard)