From 84c3ec35b18288ca76a334d9e534cce5339ff533 Mon Sep 17 00:00:00 2001 From: rearman Date: Thu, 2 Oct 2025 10:41:43 -0400 Subject: [PATCH] Make running fn in new frame a macro, new org bind Plain org agenda in new frame now on "S-". New macro 're/open-with-new-frame' to make those bindings easier. --- re/re-editing-defuns.el | 6 ++++++ re/re-howm-defuns.el | 3 +-- re/re-org-defuns.el | 8 ++++++-- re/re-packages.el | 4 +++- re/re-repl-defuns.el | 3 +-- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/re/re-editing-defuns.el b/re/re-editing-defuns.el index 9aafac9..3c77d51 100644 --- a/re/re-editing-defuns.el +++ b/re/re-editing-defuns.el @@ -184,5 +184,11 @@ Start from bottom if given a negative line number." (forward-line (1- line-number)))) (buffer-substring-no-properties (line-beginning-position) (line-end-position)))) +(defmacro re/open-with-new-frame (frname function) + "Run the function in its own named frame." + `(progn + (select-frame (make-frame '((name . ,(eval frname))))) + (call-interactively ,function))) + (provide 're-editing-defuns) ;;; re-editing-defuns.el ends here diff --git a/re/re-howm-defuns.el b/re/re-howm-defuns.el index 852ec50..1126a4a 100644 --- a/re/re-howm-defuns.el +++ b/re/re-howm-defuns.el @@ -6,8 +6,7 @@ (defun re/howm-menu-new-frame (&optional arg) "Show the howm menu in a new frame" (interactive "P") - (select-frame (make-frame '((name . "HOWM")))) - (funcall #'howm-menu)) + (re/open-with-new-frame "HOWM" #'howm-menu)) (defun re/howm-create-keyword () "Reads a keyword from the minibuffer and appends it to the keywords file." diff --git a/re/re-org-defuns.el b/re/re-org-defuns.el index 1fe9c92..12e49c6 100644 --- a/re/re-org-defuns.el +++ b/re/re-org-defuns.el @@ -13,11 +13,15 @@ (interactive "P") (org-agenda arg "a")) +(defun re/org-agenda-new-frame (&optional arg) + "Show the main agenda in a new frame" + (interactive "P") + (re/open-with-new-frame "ORG" #'re/org-show-agenda)) + (defun re/org-agenda-custom-new-frame (&optional arg) "Show my custom agenda in a new frame" (interactive "P") - (select-frame (make-frame '((name . "ORG")))) - (funcall #'re/org-agenda-show-custom)) + (re/open-with-new-frame "ORG" #'re/org-agenda-show-custom)) (defun re/org-auto-generate-ids-in-file () "Add ID properties to all headlines in the current diff --git a/re/re-packages.el b/re/re-packages.el index 08d8af9..62b340b 100644 --- a/re/re-packages.el +++ b/re/re-packages.el @@ -128,6 +128,7 @@ ("C-c c" . org-capture) ("C-c b" . org-switchb) ("" . re/org-show-agenda) + ("S-" . re/org-agenda-new-frame) ("" . re/org-agenda-show-custom) ("S-" . re/org-agenda-custom-new-frame) :map @@ -168,7 +169,8 @@ (add-hook 'after-save-hook 'howm-mode-set-buffer-name) (add-hook 'howm-mode-hook 'howm-mode-set-buffer-name) :bind - (("S-" . howm-menu) + ( + ;; ("S-" . howm-menu) ;; ("S-" . re/howm-menu-new-frame) :map howm-mode-map ("C-c , k" . re/howm-create-keyword))) diff --git a/re/re-repl-defuns.el b/re/re-repl-defuns.el index b0462b2..df97458 100644 --- a/re/re-repl-defuns.el +++ b/re/re-repl-defuns.el @@ -59,8 +59,7 @@ Stolen from https://depp.brause.cc/dotemacs" (defun re/sly-repl-new-frame (&optional arg) "Start a SLY repl in a new frame." (interactive "P") - (select-frame (make-frame '((name . "SLY")))) - (call-interactively 'sly)) + (re/open-with-new-frame "SLY" #'sly)) (defun re/sly-quit-current-lisp () "Quit the current lisp repl connection without prompting." -- 2.39.5