Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't display in terminal-frame when the current Emacs is a daemon #194

Merged
merged 1 commit into from
May 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions window-purpose-switch.el
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,15 @@ the purpose PURPOSE."
(and (not (window-dedicated-p window))
(eql purpose (purpose-window-purpose window))))

(defun purpose--frame-list ()
"Return a list of all live frames.
Similar to `frame-list', the only difference being that the
initial, hidden, frame which is kept around when Emacs is run as
a daemon is excluded."
(if (daemonp)
(delq terminal-frame (frame-list))
(frame-list)))

(defun purpose--reusable-frames (alist)
"Return a list of reusable frames.
If ALIST contains a `reusable-frames' entry, its value determines which
Expand Down Expand Up @@ -252,9 +261,9 @@ terminal if it's non-nil."
(cl-remove-if-not
#'(lambda (frame)
(eql (frame-terminal frame) (frame-terminal)))
(frame-list)))
(purpose--frame-list)))
((eql reusable-frames t)
(frame-list))
(purpose--frame-list))
(t
(message "Bad value for reusable-frames in ALIST: %S"
reusable-frames)
Expand Down Expand Up @@ -489,7 +498,7 @@ This function doesn't raise the new frame."
(mapcar
#'(lambda (frame)
(purpose-display--frame-usable-windows frame buffer))
(remove (selected-frame) (frame-list)))))
(remove (selected-frame) (purpose--frame-list)))))
(window (car windows)))
(when window
(purpose-change-buffer buffer window 'reuse alist)
Expand Down
Loading