;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\303\304\305\306\307\310\307\311&\210\312\313\314\315\316DD\317\320\321%\210\312\322\314\315\323DD\324\320\321%\210\312\325\314\315\326DD\327\320\321%\210\312\330\314\315\331DD\332\320\321%\210\312\333\314\315\334DD\335\320\336%\210\312\337\314\315\340DD\341\320\342%\210\312\343\314\315\344DD\345\320\346%\210\312\347\314\315\350DD\351\320\352%\210\312\353\314\315\354DD\355\320\321%\210\312\356\314\315\357DD\360\320\361%\210\312\362\314\315\363DD\364\320\365%\210\366\367\370\371#\210\366\372\373\374#\210\366\375\376\377#\207" [require filenotify seq custom-declare-group nix-modeline nil "Display running Nix builders in the modeline." :group mode-line tools custom-declare-variable nix-modeline-default-text funcall function #[0 "\300\207" [#1=" λ(?) "] 1 #1#] "The text for nix-modeline to display before its watchers start." :type string nix-modeline-idle-text #[0 "\300\207" [#2=" λ(✓) "] 1 #2#] "The text for nix-modeline to show when no builders are running." nix-modeline-running-text #[0 "\300\207" [#3=" λ⇒%s "] 1 #3#] "The text for nix-modeline to display when builders are running.\n\nNote that a %s format specifier in this string will be replaced with the number\nof Nix builders running." nix-modeline-error-text #[0 "\300\207" [#4=" λ(X) "] 1 #4#] "The text to display when nix-modeline encounters an error." nix-modeline-trigger-files #[0 "\300\207" [("/nix/var/nix/db")] 1] "A list of files and directories nix-modeline will monitor.\n\nChanges to any of these files will cause nix-modeline to update, which forces a\nmodeline redisplay. The ideal files for this purpose should reliably be changed\nonly when Nix operations begin and end." (repeat string) nix-modeline-users #[0 "\300\207" [self] 1] "A symbol indicating which users' Nix builders should be tracked.\n\nUsually, setting this variable only makes sense in multi-user Nix environments.\n\n`self' means to track only your own builders.\n`self-and-root' means your builders and those belonging to root get tracked.\n`all' means to track all of the builders on the system." (choice (const :tag "Your User" 'self) (const :tag "Your User and root" 'self-and-root) (const :tag "All Users" 'all)) nix-modeline-process-regex #[0 "\300\207" [#5="\\(nix-build\\)\\|\\(nix-instantiate\\)"] 1 #5#] "A regex of process names that should count as Nix builders.\n\nnix-modeline uses the number of matching processes to report how many Nix\nbuilders are in progress." regexp nix-modeline-process-counter #[0 "\301=\203\302\207\303\207" [system-type darwin pgrep lisp] 2] "The method nix-modeline should use to count Nix builders.\n\n`lisp' is a pure Emacs Lisp process counter with no runtime dependencies.\n`pgrep' starts a pgrep process on every nix-modeline event. This is useful on\nplatforms like macOS where `process-attributes' returns nothing useful." (choice (const :tag "Pure Lisp" 'lisp) (const :tag "pgrep" 'pgrep)) nix-modeline-pgrep-string #[0 "\300\207" [#6="pgrep %s %s"] 1 #6#] "The command line used when counting processes with pgrep.\n\nNote: the first %s in this variable gets replaced by the value of\n`nix-modeline--pgrep-users', and the second %s gets replaced by the value of\n`nix-modeline-process-regex'." nix-modeline-delay #[0 "\300\207" [0.1] 1] "The delay between when nix-modeline triggers and when it updates.\n\nThis value is in seconds. Short delays help coalesce file watcher events, and\nprevent race conditions in nix-modeline during lengthy Nix builds." number nix-modeline-hook #[0 "\300\207" [nil] 1] "List of functions to be called when nix-modeline updates." hook custom-declare-face nix-modeline-idle-face ((t :inherit mode-line)) "Face used when no Nix builders are running." nix-modeline-running-face ((t :inherit homoglyph)) "Face used when one or more Nix builders are running." nix-modeline-error-face ((t :inherit warning)) "Face used when nix-modeline's encounters an error."] 8) #@61 The list of file watchers nix-modeline uses to monitor Nix. (defvar nix-modeline--watchers nil (#$ . 4038)) #@47 The timer configured by `nix-modeline-delay'. (defvar nix-modeline--timer nil (#$ . 4152)) #@57 The string representing the current Nix builder status. (defvar nix-modeline--status-text "" (#$ . 4249)) #@62 Set nix-modeline to the error state and print MSG. (fn MSG) (defalias 'nix-modeline--error #[257 "\302\303\304#\305\306\307\"!\207" [nix-modeline-error-text nix-modeline--status-text propertize face nix-modeline-error-face message format "nix-modeline: %s"] 5 (#$ . 4361)]) #@209 Update nix-modeline's text and force redisplay all modelines. NUM-BUILDERS is a string from the nix-modeline child process representing the number of Nix builder processes it saw running. (fn NUM-BUILDERS) (defalias 'nix-modeline--update #[257 "\211\303=\203\304\305\306#\202\211\304\307 \"\305\310#\262\311\312!\210\313\314!\207" [nix-modeline-idle-text nix-modeline-running-text nix-modeline--status-text 0 propertize face nix-modeline-idle-face format nix-modeline-running-face run-hooks nix-modeline-hook force-mode-line-update all] 6 (#$ . 4646)]) #@84 Update nix-modeline based on the OUTPUT of its pgrep PROCESS. (fn PROCESS OUTPUT) (defalias 'nix-modeline--pgrep-filter #[514 "\300\301\302#\303G!\207" [split-string nil omit-nulls nix-modeline--update] 6 (#$ . 5215)]) #@169 When the pgrep PROCESS signals an EVENT, handle it. An oddity of pgrep is that it exits with code 1 when no processes match, which we handle here. (fn PROCESS EVENT) (defalias 'nix-modeline--pgrep-sentinel #[514 "\211\300\267\202\f\301\207\302\303!\207\211\304\305\306\"!\207" [#s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 purecopy t data ("finished\n" 6 "exited abnormally with code 1\n" 8)) nil nix-modeline--update 0 nix-modeline--error format "pgrep %s"] 7 (#$ . 5444)]) #@61 Convert a nix-modeline users setting into a pgrep argument. (defalias 'nix-modeline--pgrep-users #[0 "\301\267\202\302\303\304 \"\207\302\305\304 \"\207\306\207\307\207" [nix-modeline-users #s(hash-table size 3 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (self 6 self-and-root 12 all 18)) format "-U %s" user-uid "-U %s -U 0" "" nil] 3 (#$ . 5956)]) #@42 Count Nix builder processes using pgrep. (defalias 'nix-modeline--pgrep-callback #[0 "\303\304\305\306\307\303\310\311\312 \313 \314\315\316\n##\303\317#\320\321\322\323\324\325&\f)\207" [process-connection-type nix-modeline-pgrep-string nix-modeline-process-regex nil make-process :name "Nix Process Counter" :buffer :command split-string format nix-modeline--pgrep-users replace-regexp-in-string "\\\\" "" omit-nulls :filter nix-modeline--pgrep-filter :sentinel nix-modeline--pgrep-sentinel :noquery t] 14 (#$ . 6335)]) #@52 Count Nix builder processes using pure Emacs Lisp. (defalias 'nix-modeline--pure-callback #[0 "\300\301\302\303\304 \"\"\305G!\207" [seq-filter #[257 "\302\303\304#\305\306\307#)\266\203\205\302\310\"\311 =\207" [nix-modeline-process-regex inhibit-changing-match-data alist-get comm "" nil t string-match euid user-uid] 8 "\n\n(fn P)"] mapcar #[257 "\300!\207" [process-attributes] 3 "\n\n(fn PID)"] list-system-processes nix-modeline--update] 5 (#$ . 6864)]) #@53 On a watch event, select a callback implementation. (defalias 'nix-modeline--callback #[0 "\203\302 \210 \303\267\202\304 \207\305 \207\306\207" [nix-modeline-mode nix-modeline-process-counter nix-modeline--start-watchers #s(hash-table size 2 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (lisp 13 pgrep 16)) nix-modeline--pure-callback nix-modeline--pgrep-callback nil] 2 (#$ . 7341)]) #@63 Start watchers for the paths in `nix-modeline-trigger-files'. (defalias 'nix-modeline--start-watchers #[0 "\302\303\"\211\207" [nix-modeline-trigger-files nix-modeline--watchers mapcar #[257 "\300\301\302#\207" [file-notify-add-watch (change) #[257 "\211A@\302=\206 \303@!??\205%\304 \210\305!\203\306!\210\307 \310\311#\211\207" [nix-modeline--timer nix-modeline-delay stopped file-notify-valid-p nix-modeline--stop-watchers timerp cancel-timer run-with-timer nil nix-modeline--callback] 5 "\n\n(fn EVENT)"]] 5 "\n\n(fn PATH)"]] 3 (#$ . 7757)]) #@48 Stop the watchers in `nix-modeline--watchers'. (defalias 'nix-modeline--stop-watchers #[0 "\211\203\211@\301!\210A\266\202\202\210\302\211\207" [nix-modeline--watchers file-notify-rm-watch nil] 4 (#$ . 8320)]) (byte-code "\300\301\302\303\304DD\305\306\307\310\311\312\313\314\315& \207" [custom-declare-variable nix-modeline-mode funcall function #[0 "\300\207" [nil] 1] "Non-nil if Nix-Modeline mode is enabled.\nSee the `nix-modeline-mode' command\nfor a description of this minor mode.\nSetting this variable directly does not take effect;\neither customize it (see the info node `Easy Customization')\nor call the function `nix-modeline-mode'." :set custom-set-minor-mode :initialize custom-initialize-default :type boolean :group nix-modeline] 12) #@637 Displays the number of running Nix builders in the modeline. This is a minor mode. If called interactively, toggle the `Nix-Modeline mode' mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode. If called from Lisp, toggle the mode if ARG is `toggle'. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number. To check whether the minor mode is enabled in the current buffer, evaluate `(default-value 'nix-modeline-mode)'. The mode's hook is called both when the mode is enabled and when it is disabled. (fn &optional ARG) (defalias 'nix-modeline-mode #[256 "\305 \306\303\307=\203\310\303!?\202!\247\203 \311W\203 \312\202!\313\"\210\314\300!\2038\315\303\"\310\303!\2038\303B\316 \210\317\n\204C\320 \203Y\321\302\322\323#\210\324\f\325\326#\327 \210\202^\330\331\n\"\332\333\310\303!\203j\334\202k\335\"\210\336\337!\203\223\340\303!\210\305 \203\203\211\305 \232\203\223\341\342\310\303!\203\217\343\202\220\344\317#\210\210\345 \210\310\303!\207" [global-minor-modes nix-modeline--status-text global-mode-string nix-modeline-mode nix-modeline-default-text current-message set-default toggle default-value 1 nil t boundp delq nix-modeline--stop-watchers #1="" (#1#) add-to-list (t (:eval nix-modeline--status-text)) append propertize face nix-modeline-idle-face nix-modeline--callback remove (t (:eval nix-modeline--status-text)) run-hooks nix-modeline-mode-hook nix-modeline-mode-on-hook nix-modeline-mode-off-hook called-interactively-p any customize-mark-as-set message "Nix-Modeline mode %sabled%s" "en" "dis" force-mode-line-update] 6 (#$ . 9089) (byte-code "\203\n\301!\202 \302C\207" [current-prefix-arg prefix-numeric-value toggle] 2)]) (defvar nix-modeline-mode-hook nil) (byte-code "\301\302N\204\f\303\301\302\304#\210\303\301\305\306#\210\303\301\307\310C#\210\311\312\310\313\300!\205#\310\211%\210\314\315!\207" [nix-modeline-mode-map nix-modeline-mode-hook variable-documentation put "Hook run after entering or leaving `nix-modeline-mode'.\nNo problems result if this variable is not bound.\n`add-hook' automatically binds it. (This is true for all hook variables.)" custom-type hook standard-value nil add-minor-mode nix-modeline-mode boundp provide nix-modeline] 6)