aboutsummaryrefslogtreecommitdiff
path: root/.emacs.d
diff options
context:
space:
mode:
Diffstat (limited to '.emacs.d')
-rw-r--r--.emacs.d/rul-lisp/packages/rul-wm.el36
1 files changed, 21 insertions, 15 deletions
diff --git a/.emacs.d/rul-lisp/packages/rul-wm.el b/.emacs.d/rul-lisp/packages/rul-wm.el
index 90bd031..f33ad8f 100644
--- a/.emacs.d/rul-lisp/packages/rul-wm.el
+++ b/.emacs.d/rul-lisp/packages/rul-wm.el
@@ -1,6 +1,6 @@
;;;; window.el
;; Inspiration: https://christiantietze.de/posts/2022/12/updated-org-mode-agenda-display-buffer-alist/
-(defun rul/display-buffer-org-agenda-managed-p (buffer-name action)
+(defun rul-display-buffer-org-agenda-managed-p (buffer-name action)
"Determine whether BUFFER-NAME is an org-agenda managed buffer."
(with-current-buffer buffer-name
(or (derived-mode-p 'org-mode 'org-agenda-mode)
@@ -34,24 +34,24 @@
;; (tab-bar-mode 1)
;; Pop-up buffers
-;; https://protesilaos.com/codelog/2024-09-19-emacs-command-popup-frame-emacsclient/
-(defun prot-window-delete-popup-frame (&rest _)
- "Kill selected selected frame if it has parameter `prot-window-popup-frame'.
+;; Inspiration: https://protesilaos.com/codelog/2024-09-19-emacs-command-popup-frame-emacsclient/
+(defun rul-window-delete-popup-frame (&rest _)
+ "Kill selected selected frame if it has parameter `rul-window-popup-frame'.
Use this function via a hook."
- (when (frame-parameter nil 'prot-window-popup-frame)
+ (when (frame-parameter nil 'rul-window-popup-frame)
(delete-frame)))
-(defmacro prot-window-define-with-popup-frame (command)
+(defmacro rul-window-define-with-popup-frame (command)
"Define interactive function which calls COMMAND in a new frame.
-Make the new frame have the `prot-window-popup-frame' parameter."
- `(defun ,(intern (format "prot-window-popup-%s" command)) ()
- ,(format "Run `%s' in a popup frame with `prot-window-popup-frame' parameter.
-Also see `prot-window-delete-popup-frame'." command)
+Make the new frame have the `rul-window-popup-frame' parameter."
+ `(defun ,(intern (format "rul-window-popup-%s" command)) ()
+ ,(format "Run `%s' in a popup frame with `rul-window-popup-frame' parameter.
+Also see `rul-window-delete-popup-frame'." command)
(interactive)
- (let ((frame (make-frame '((prot-window-popup-frame . t)))))
+ (let ((frame (make-frame '((rul-window-popup-frame . t)))))
(select-frame frame)
;; Placeholder for frame, otherwise it'll get autoclosed.
- (switch-to-buffer " prot-window-hidden-buffer-for-popup-frame")
+ (switch-to-buffer " rul-window-hidden-buffer-for-popup-frame")
(condition-case nil
(call-interactively ',command)
((quit error user-error)
@@ -60,10 +60,16 @@ Also see `prot-window-delete-popup-frame'." command)
(declare-function org-capture "org-capture" (&optional goto keys))
(defvar org-capture-after-finalize-hook)
-;;;###autoload (autoload 'prot-window-popup-org-capture "prot-window")
-(prot-window-define-with-popup-frame org-capture)
+(rul-window-define-with-popup-frame org-capture)
-(add-hook 'org-capture-after-finalize-hook #'prot-window-delete-popup-frame)
+(add-hook 'org-capture-after-finalize-hook #'rul-window-delete-popup-frame)
+
+(defun rul-org-capture-single-window ()
+ "Show only the capture buffer in a popup capture frame."
+ (when (frame-parameter nil 'rul-window-popup-frame)
+ (delete-other-windows)))
+
+(add-hook 'org-capture-mode-hook #'rul-org-capture-single-window)
(use-package olivetti
:ensure t
nihil fit ex nihilo