From 7b8d9c9da4cfaba9e1fcb7a2796bdf084340e95a Mon Sep 17 00:00:00 2001 From: fpi Date: Wed, 29 Jan 2020 17:37:23 +0100 Subject: Functions to create floating frames --- emacs-init.org | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/emacs-init.org b/emacs-init.org index 6b2ad17..afb6f90 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -1693,6 +1693,7 @@ Use imagemagick and standalone class for latex preview. #+END_SRC *** Org-Capture +Templates #+BEGIN_SRC emacs-lisp (use-package org-capture :custom ( @@ -1760,6 +1761,36 @@ Use imagemagick and standalone class for latex preview. ) ))) #+END_SRC +Setup for floating capture window. For reference see [[https://www.windley.com/archives/2010/12/capture_mode_and_emacs.shtml][here]]. +#+begin_src emacs-lisp +(defun fpi/make-floating-frame (&optional width height minibuffer name) + (interactive) + (let ((width (or width 80)) + (height (or height 36)) + (name (or name "*Floating Emacs*"))) + (make-frame `((name . ,name) + (window-system . x) + (width . ,width) + (height . ,height) + (minibuffer . ,minibuffer))))) + +(defadvice org-capture-finalize + (after delete-capture-frame activate) + "Advise capture-finalize to close the frame" + (if (equal "*Capture*" (frame-parameter nil 'name)) + (delete-frame))) +(defadvice org-capture-destroy + (after delete-capture-frame activate) + "Advise capture-destroy to close the frame" + (if (equal "*Capture*" (frame-parameter nil 'name)) + (delete-frame))) +(defun fpi/make-floating-capture-frame () + (interactive) + (select-frame (fpi/make-floating-frame 70 20 t "*Capture*")) + (add-hook 'org-capture-mode-hook 'delete-other-windows) + (org-capture) + (remove-hook 'org-capture-mode-hook 'delete-other-windows)) +#+end_src *** Ricing #+begin_src emacs-lisp (setq line-spacing 0.1) -- cgit v1.2.3