Commit ff95b1cb833c

Vincent Demeester <vincent@sbr.pm>
2024-12-06 09:27:31
tools/emacs: trying "auto-close" on capture frames
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent b62d2fe
Changed files (3)
tools
users
vincent
tools/emacs/config/config-org.el
@@ -302,6 +302,7 @@ file which do not already have one."
 
   (add-to-list 'org-capture-templates
                `("w" "Writing"))
+  (add-hook 'org-capture-after-finalize-hook #'prot-window-delete-popup-frame)
   :bind (("C-c o c" . org-capture)))
 
 (defun vde/dired-notes ()
tools/emacs/config/config-windows.el
@@ -5,6 +5,12 @@
 
 (setq switch-to-buffer-obey-display-actions t)
 
+(defun vde/window-delete-popup-frame (&rest _)
+  "Kill selected selected frame if it has parameter `prot-window-popup-frame'.
+Use this function via a hook."
+  (when (frame-parameter nil 'vde/window-popup-frame)
+    (delete-frame)))
+
 (defun vde/save-desktop-no-ask ()
   "Save the desktop without asking questions by modifying the modtime."
   (interactive)
users/vincent/dev/emacs.nix
@@ -4,7 +4,7 @@ with lib;
 let
   capture = pkgs.writeScriptBin "capture" ''
     #!${pkgs.stdenv.shell}
-    emacsclient -n -c -F '((name . "capture") (width . 150) (height . 90))' -e '(org-capture)'
+    emacsclient -n -c -F '((name . "capture") (width . 150) (height . 90) (vde/window-popup-frame . t))' -e '(org-capture)'
   '';
   et = pkgs.writeScriptBin "et" ''
     #!${pkgs.stdenv.shell}
@@ -59,6 +59,7 @@ let
     # use-package # it's now part of built-in packages
     # whole-line-or-region
     # bbdb
+    age
     ace-window
     adoc-mode
     aggressive-indent