Can someone please give me a hand with a function that determines if a frame with the name "xyz" exists, and if so, switch to that frame. I use frame-cmds to give each frame a custom name: http://www.emacswiki.org/emacs/frame-cmds.el
I would suggest that it looks like a buffer, but I don't find anything on Google. Here is the buffer function:
(defun buffer-exists (bufname) (not (eq nil (get-buffer bufname)))) (defun lawlist-switch-to-buffer-xyz () (interactive) (if (buffer-exists "xyz") (switch-to-buffer "xyz") ))
Here is a semi-dedicated post: https://superuser.com/questions/358037/emacsclient-create-a-frame-if-a-frame-does-not-exist
EDIT (September 15, 2014): The ido-switch-frame function has been changed to make frame-to valid variable and delete message . Previous changes have been removed since the get-a-frame and get-frame-name functions written by Drew Adams are sufficient when used in conjunction with select-frame-set-input-focus - see His answer below.
(defun ido-switch-frame () (interactive) (when (not (minibufferp)) (let* ( (frames (frame-list)) (frame-to (ido-completing-read "Select Frame: " (mapcar (lambda (frame) (frame-parameter frame 'name)) frames)))) (catch 'break (while frames (let ((frame (car frames))) (if (equal (frame-parameter frame 'name) frame-to) (throw 'break (select-frame-set-input-focus frame)) (setq frames (cdr frames)))))))))
source share