dev.fron.io nixrc / 66cb1b8
emacs: rejig init for dumping Tony Olagbaiye a month ago
3 changed file(s) with 36 addition(s) and 32 deletion(s). Raw diff Collapse all Expand all
44 (lib.mapAttrsToList (file: _: ./. + "/${file}") # strings to paths
55 (lib.filterAttrs (f: _: f != ".dir-locals.el") # remove bad files
66 (builtins.readDir ./.))); # enumerate folder
7
8 emacs.loader.scraps = {
9 package = lib.const null;
10 script = epkgs: ''
11 (defun bqv/load-scraps ()
12 ${builtins.readFile ./scraps+bufmgmt.el}
13 ${builtins.readFile ./scraps+misc.el}
14 ${builtins.readFile ./scraps+shell.el}
15 t)
16 (add-to-list 'emacs-startup-hook #'bqv/load-scraps)
17 '';
18 };
719 }
+0
-12
emacs/scraps.nix less more
0 { config, lib, usr, pkgs, ... }:
1
2 {
3 emacs.loader.scraps = {
4 package = lib.const null;
5 script = epkgs: ''
6 ${builtins.readFile ./scraps+bufmgmt.el}
7 ${builtins.readFile ./scraps+misc.el}
8 ${builtins.readFile ./scraps+shell.el}
9 '';
10 };
11 }
7373 (log--log-enable-logging)
7474 (log--log-enable-messaging)
7575
76 (require 'ffi)
77 (define-ffi-library lib/systemd "${pkgs.systemd}/lib/libsystemd.so")
78 ;; (define-ffi-function lib/systemd/sd_notify "sd_notify" :int [:int :pointer] lib/systemd)
79 ;; (defun sd_notify (&rest assocs)
80 ;; (let* ((assignments (mapcar (lambda (p) (format "%s=%s" (car p) (cdr p))) assocs))
81 ;; (lstr (s-join "\n" assignments)))
82 ;; (with-ffi-string (cstr lstr)
83 ;; (lib/systemd/sd_notify 0 cstr))))
84
85 ;; (defun watchdog-systemd-notify ()
86 ;; (with-timeout (10)
87 ;; (sd_notify '("READY" . 1)
88 ;; );;(`("WATCHDOG_USEC" . ,(* 120 1000000)))
89 ;; (log--trace "Notified at %s" (format-time-string "%D %T"))))
76 (defun load-ffi-systemd ()
77 (require 'ffi)
78 (define-ffi-library lib/systemd "${pkgs.systemd}/lib/libsystemd.so")
79 (define-ffi-function lib/systemd/sd_notify "sd_notify" :int [:int :pointer] lib/systemd)
80 (defun sd_notify (&rest assocs)
81 (let* ((assignments (mapcar (lambda (p) (format "%s=%s" (car p) (cdr p))) assocs))
82 (lstr (s-join "\n" assignments)))
83 (with-ffi-string (cstr lstr)
84 (lib/systemd/sd_notify 0 cstr))))
85
86 (defun watchdog-systemd-notify ()
87 (with-timeout (10)
88 (sd_notify '("READY" . 1)
89 );;(`("WATCHDOG_USEC" . ,(* 120 1000000)))
90 (log--trace "Notified at %s" (format-time-string "%D %T"))))
91 ;(run-at-time t 10 #'watchdog-systemd-notify)
92 t)
9093 (defun config-end ()
9194 (message
9295 "Configuring...done (%.3fs) [after-init]"
9396 (float-time (time-subtract (current-time)
9497 before-user-init-time)))
95 (fmakunbound 'config-end)
96 ;;(run-at-time t 10 #'watchdog-systemd-notify)
97 )
98 (fmakunbound 'config-end))
9899
99100 (defvar config-registry '()
100101 "Profiling and initialization status data")
142143 (let ((name (cond ((symbolp package) package)
143144 ((stringp package) (make-symbol package))
144145 (t nil))))
145 `(config-segment ',name
146 (leaf ,name ,@args))))
146 (if noninteractive
147 `(require ',name)
148 `(config-segment ',name
149 (leaf ,name ,@args)))))
147150
148151 (defun config-errors ()
149152 (let ((error-registry (seq-remove (lambda (c) (eq (type-of (cdr c)) 'config-ok)) config-registry)))
191194 (setq max-mini-window-height 0.5)
192195 (when (fboundp 'windmove-default-keybindings)
193196 (windmove-default-keybindings))
194 (when (fboundp 'winner-mode)
197 (when (and (not noninteractive) ; breaks in batch mode
198 (fboundp 'winner-mode))
195199 (winner-mode 1))
196200 (fset 'yes-or-no-p 'y-or-n-p)
197201 (progn