If frame named “xyz” exists, then switch to that frame

不羁的心 提交于 2019-11-29 08:41:15

There may be more elegant solutions but this gets the job done:

(defun switch-to-frame (frame-name)
  (interactive "sFrame name:")
  (let ((frames (frame-list)))
    (catch 'break
      (while frames
        (let ((frame (car frames)))
          (if (equal (frame-parameter frame 'name) frame-name)
              (throw 'break (select-frame-set-input-focus frame))
            (setq frames (cdr frames))))))))
  1. Wrt your request for "a function that detects whether a frame named "xyz" exists": You already have that, since you say you are using frame-cmds.el, which requires frame-fns.el --- Function get-a-frame does just that.

  2. Icicles provides multi-command icicle-select-frame, which lets you choose frames by name using completion.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!