Skip to content

Commit

Permalink
[Fix #1147] Add an extra keybinding for ace-window that's Windows
Browse files Browse the repository at this point in the history
friendly
  • Loading branch information
bbatsov committed May 6, 2018
1 parent bf57696 commit d6786e3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/prelude-global-keybindings.el
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@

(global-set-key (kbd "C-c j") 'avy-goto-word-or-subword-1)
(global-set-key (kbd "s-.") 'avy-goto-word-or-subword-1)

;; improved window navigation with ace-window
(global-set-key (kbd "s-w") 'ace-window)
(global-set-key [remap other-window] 'ace-window)

(provide 'prelude-global-keybindings)

Expand Down

15 comments on commit d6786e3

@awkspace
Copy link

@awkspace awkspace commented on d6786e3 May 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I updated Prelude, I found the new behavior of C-x o surprising. Could ace-window be bound to something else without overriding other-window?

@blueberry
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bbatsov @awkspace It seems that the authors of ace-window recommend M-o

@bbatsov
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which Prelude uses for something else. :-) I don't see the point in having a dedicated keybinding for something that replaces other-windows in pretty much all cases. Probably the real problem is setting ace-window to be contained to just one frame, right?

@blueberry
Copy link

@blueberry blueberry commented on d6786e3 Jun 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bbatsov As it is now, I am unable to change that default setting in any way. I've tried all three suggested solutions in my personal.el none has any effect. I agree that this setting may be better for most people, but for my case it really is not :)

Suggested solutions were:

(global-set-key [remap ace-window] 'other-window) 

(setq aw-scope ’frame)

(global-set-key (kbd "C-x o") 'other-window)

@blueberry
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to add, now when I think about restricting ace-window to one frame wouldn't be better at all, since then I'll have to type numbers and deal with display grey-out each time (annoyance) and would still not get ace-windows benefits (being able to quickly jump to window 13 in other workspace)...

In my case (3 monitors managed by xmonad, 2-3 windows per emacsclient's frame) other-window is just the right function...

@awkspace
Copy link

@awkspace awkspace commented on d6786e3 Jun 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behavior of other-window is different than ace-window in the case where more than two windows are present, so I don't view it as a replacement. This seems like something that should be opt-in rather than opt-out.

Emacs and/or Prelude being as wildly customizable as they are, I've of course since updated my own personal configuration to go back to my preferred behavior. I only left a note here because, as a Prelude user, it was quite surprising to find an extra step added to window-switching (something I do a lot) after a routine git pull. (And yes, having windows numbered that weren't even open in the frame I was operating in was plenty annoying, too!)

@blueberry
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@awkspace Can you please share how you updated that personal configuration, since I wasn't able to do this?

@awkspace
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blueberry Sure. (global-set-key [remap other-window] 'other-window)

@blueberry
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@awkspace That works for me, too! Thanks a lot!

@adherr
Copy link

@adherr adherr commented on d6786e3 Jun 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised by this change also. Haven't we done this before? Should we reopen #656?

@codabrink
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this, please?
Having to read window numbers and reach for the number keys every time I want to switch windows is a significant hassle.
s-w is fine if I want to use ace-window, but in most cases; I don't.

@blueberry
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codabrink Why would we remove this when you can set it to normal behavior with (global-set-key [remap other-window] 'other-window)?

(I would also prefer the old behavior to be the default, but since bbatsov prefers the new, and he is the one doing the work, I think it's a bit annoying if we nag him about that when there is a one-liner setting that makes emacs work exactly as we like).

@codabrink
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It just feels like a weird decision to overwrite such a fundamental key-combination with something inherently more complicated and mentally tasking.
With other-window I don't have to think while switching windows. With ace-window, I have to stop thinking about the code I'm writing, read the window numbers, match that to a number key, press it, and refocus my thought process back to the track it was on. It just seems like it gets in the way.
Idk, maybe I need to give it a couple weeks for it to become second nature. I might give it a second chance.
It feels like this should be opt-in.

@blueberry
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with you, but, again, I think we should respect the preference of the author of the package, especially when one line makes things work exactly as we like?

@awkspace
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about anyone else, but I regularly use Prelude (or sometimes Spacemacs) as my go-to "kickstart your Emacs configuration" repository when helping new users get into Emacs. Maybe that's not what this repository is for, but it's certainly how I was introduced to Emacs myself. Viewed through the perspective of this use case, ace-window makes Prelude significantly more confusing for new users.

Not to mention it's actually buggy as all get-out if you're using Emacs as a server. For whatever reason, ace-window will enumerate windows you can't even see, let alone switch to, in use on other desktops or backgrounded tmux panes.

Please sign in to comment.