I use (ns-next-frame) to cycle focus between Emacs frames. However, if I place Emacs frames in separate virtual desktops, I would like focus to cycle only among frames on the current desktop.

That is, imagine I have two virtual desktops I and II and four Emacs frames with frames A and B residing on virtual desktop I and frames C and D residing on virtual desktop II.

If frame A has focus, I would expect the first invocation of ns-next-frame to move focus to frame B. Then, another invocation to move it back to frame A.

Instead, focus moves to frame C, then frame D, then back to A, et cetera.

I tried looking at frame-visible-p, but it evaluates to t for all non-iconified frames.

How can I accomplish what I want?

  • macOS Sierra 10.12.6
  • GNU Emacs 25.3.1
  • As far as I am aware, the Emacs team has never put any effort into making Emacs play nice with Mission Control and/or virtual desktops on OSX. You may wish to conduct an internet search to see if that feature request has already been assigned a bug report; and, if it has not, then consider submitting an enhancement request. Otherwise, you may wish to consider designing your own applescript and calling it from Emacs to achieve your goal. You may also wish to contact Mitsuharu Yamamoto regarding this feature request bitbucket.org/mituharu/emacs-mac – lawlist Jan 25 '18 at 18:34
  • In general, the Emacs team is most interested in features that would be applicable to all platforms ... rather than OSX specifically. – lawlist Jan 25 '18 at 18:39
  • The problem seems to be that frame-visible-p returns t for all non-iconified (non-minimized) frames. How does the function other-frame behave under X11 window managers that support virtual desktops? – Colin Fraizer Jan 25 '18 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.