Commit 8ee5717d498b

Vincent Demeester <vincent@sbr.pm>
2024-12-05 11:22:38
tools/emacs: alert when compilation finishes in background
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 3b4ce82
Changed files (2)
tools/emacs/config/config-appearance.el
@@ -157,24 +157,12 @@ questions.  Else use completion to select the tab to switch to."
   :hook (after-init-hook . tooltip-mode))
 
 (use-package alert
+  :init
+  (defun alert-after-finish-in-background (buf str)
+    (when (or (not (get-buffer-window buf 'visible)) (not (frame-focus-state)))
+      (alert str :buffer buf)))
   :config
   (setq alert-default-style 'libnotify))
 
-;; (use-package ligature
-;;   :config
-;;   (ligature-set-ligatures 'prog-mode '("-|" "-~" "---" "-<<" "-<" "--" "->" "->>" "-->" "///" "/=" "/=="
-;;                                        "/>" "//" "/*" "*>" "***" "*/" "<-" "<<-" "<=>" "<=" "<|" "<||"
-;;                                        "<|||" "<|>" "<:" "<>" "<-<" "<<<" "<==" "<<=" "<=<" "<==>" "<-|"
-;;                                        "<<" "<~>" "<=|" "<~~" "<~" "<$>" "<$" "<+>" "<+" "</>" "</" "<*"
-;;                                        "<*>" "<->" "<!--" ":>" ":<" ":::" "::" ":?" ":?>" ":=" "::=" "=>>"
-;;                                        "==>" "=/=" "=!=" "=>" "===" "=:=" "==" "!==" "!!" "!=" ">]" ">:"
-;;                                        ">>-" ">>=" ">=>" ">>>" ">-" ">=" "&&&" "&&" "|||>" "||>" "|>" "|]"
-;;                                        "|}" "|=>" "|->" "|=" "||-" "|-" "||=" "||" ".." ".?" ".=" ".-" "..<"
-;;                                        "..." "+++" "+>" "++" "[||]" "[<" "[|" "{|" "??" "?." "?=" "?:" "##"
-;;                                        "###" "####" "#[" "#{" "#=" "#!" "#:" "#_(" "#_" "#?" "#(" ";;" "_|_"
-;;                                        "__" "~~" "~~>" "~>" "~-" "~@" "$>" "^=" "]#"))
-;;   :hook
-;;   (after-init . global-ligature-mode))
-
 (provide 'config-appearance)
 ;;; config-appearance.el ends here
tools/emacs/config/config-compile.el
@@ -66,6 +66,7 @@
                 ;; Show three lines of context around the current message
                 compilation-context-lines 3
                 )
+  (add-hook 'compilation-finish-functions #'alert-after-finish-in-background)
   (add-hook 'comint-output-filter-functions
             'comint-watch-for-password-prompt)
   (setq-default comint-password-prompt-regexp